tree-ssa-dom.c (record_equivalences_from_incoming_edge): Only look at case labels...
authorSteven Bosscher <stevenb@suse.de>
Mon, 31 May 2004 10:18:36 +0000 (10:18 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Mon, 31 May 2004 10:18:36 +0000 (10:18 +0000)
* tree-ssa-dom.c (record_equivalences_from_incoming_edge):
Only look at case labels if the immediate dominator is also
the only predecessor.  Don't look for more case labels if the
first seen is a case range.

From-SVN: r82480

gcc/ChangeLog
gcc/tree-ssa-dom.c

index 28c70ec38eb4e73dd8ccbb81a7b5dfca2d686f1a..ca109d99911bf7565cb8b9869d90ee17e6d9902b 100644 (file)
@@ -1,3 +1,10 @@
+2004-05-31  Steven Bosscher  <stevenb@suse.de>
+
+       * tree-ssa-dom.c (record_equivalences_from_incoming_edge):
+       Only look at case labels if the immediate dominator is also
+       the only predecessor.  Don't look for more case labels if the
+       first seen is a case range.
+
 2004-05-31  Kazu Hirata  <kazu@cs.umass.edu>
 
        * builtins.c: Add a prototype for fold_builtin_strchr().
index c74dd5d532553b860124bfe92398da2bc743fc0c..0ca36b09c80efd4a799964e1be734a90eb0609e7 100644 (file)
@@ -1450,9 +1450,12 @@ record_equivalences_from_incoming_edge (struct dom_walk_data *walk_data,
                                       &bd->avail_exprs,
                                       bb,
                                       &bd->vrp_variables);
-  /* Similarly when the parent block ended in a SWITCH_EXPR.  */
+  /* Similarly when the parent block ended in a SWITCH_EXPR.
+     We can only know the value of the switch's condition if the dominator
+     parent is also the only predecessor of this block.  */
   else if (parent_block_last_stmt
           && bb->pred->pred_next == NULL
+          && bb->pred->src == parent
           && TREE_CODE (parent_block_last_stmt) == SWITCH_EXPR)
     {
       tree switch_cond = SWITCH_COND (parent_block_last_stmt);
@@ -1473,7 +1476,7 @@ record_equivalences_from_incoming_edge (struct dom_walk_data *walk_data,
              tree elt = TREE_VEC_ELT (switch_vec, i);
              if (label_to_block (CASE_LABEL (elt)) == bb)
                {
-                 if (++case_count > 1)
+                 if (++case_count > 1 || CASE_HIGH (elt))
                    break;
                  match_case = elt;
                }
@@ -1484,6 +1487,7 @@ record_equivalences_from_incoming_edge (struct dom_walk_data *walk_data,
             the exact value of SWITCH_COND which caused us to get to
             this block.  Record that equivalence in EQ_EXPR_VALUE.  */
          if (case_count == 1
+             && match_case
              && CASE_LOW (match_case)
              && !CASE_HIGH (match_case))
            {