{
int i;
int n_labels = gimple_switch_num_labels (switch_stmt);
+ /* info contains NULL, error_mark_node or a value.
+ error_mark signifies there are multiple values already.
+ A NULL signifies there it is uninitialized.
+ A value signifies that is the only value on that edge
+ to that bb. */
tree *info = XCNEWVEC (tree, last_basic_block_for_fn (cfun));
for (i = 0; i < n_labels; i++)
tree label = gimple_switch_label (switch_stmt, i);
basic_block target_bb
= label_to_block (cfun, CASE_LABEL (label));
+ /* The default case is a case with multiple values.
+ If the value is already set then it has multiple values. */
if (CASE_HIGH (label)
|| !CASE_LOW (label)
|| info[target_bb->index])
info[target_bb->index] = error_mark_node;
else
- info[target_bb->index] = label;
+ /* Record the one value that can be on that edge to the
+ target_bb. */
+ info[target_bb->index] = CASE_LOW (label);
}
FOR_EACH_EDGE (e, ei, bb->succs)
{
basic_block target_bb = e->dest;
- tree label = info[target_bb->index];
+ tree value = info[target_bb->index];
- if (label != NULL && label != error_mark_node)
+ if (value != NULL && value != error_mark_node)
{
tree x = fold_convert_loc (loc, TREE_TYPE (index),
- CASE_LOW (label));
+ value);
edge_info = new class edge_info (e);
edge_info->record_simple_equiv (index, x);
}