Hi!

The SSA_NAME range info consists of two fields, SSA_NAME_RANGE_INFO pointer
and SSA_NAME_ANTI_RANGE_P flag, but the recently added clearing of range
info cleared just SSA_NAME_RANGE_INFO, leading to ICE on the following
testcase where we asserted that SSA_NAME_ANTI_RANGE_P flag is cleared
on a SSA_NAME that doesn't have SSA_NAME_RANGE_INFO non-NULL.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2015-01-05  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/64494
        * tree-ssa-loop-im.c (move_computations_dom_walker::before_dom): Also
        clear SSA_NAME_ANTI_RANGE_P flag.

        * gcc.c-torture/compile/pr64494.c: New test.

--- gcc/tree-ssa-loop-im.c.jj   2014-12-10 20:57:54.000000000 +0100
+++ gcc/tree-ssa-loop-im.c      2015-01-05 10:34:26.294637773 +0100
@@ -1236,7 +1236,11 @@ move_computations_dom_walker::before_dom
          && (!ALWAYS_EXECUTED_IN (bb)
              || (ALWAYS_EXECUTED_IN (bb) != level
                  && !flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level))))
-       SSA_NAME_RANGE_INFO (gimple_assign_lhs (new_stmt)) = NULL;
+       {
+         tree lhs = gimple_assign_lhs (new_stmt);
+         SSA_NAME_RANGE_INFO (lhs) = NULL;
+         SSA_NAME_ANTI_RANGE_P (lhs) = 0;
+       }
       gsi_insert_on_edge (loop_preheader_edge (level), new_stmt);
       remove_phi_node (&bsi, false);
     }
@@ -1302,7 +1306,11 @@ move_computations_dom_walker::before_dom
          && (!ALWAYS_EXECUTED_IN (bb)
              || !(ALWAYS_EXECUTED_IN (bb) == level
                   || flow_loop_nested_p (ALWAYS_EXECUTED_IN (bb), level))))
-       SSA_NAME_RANGE_INFO (gimple_get_lhs (stmt)) = NULL;
+       {
+         tree lhs = gimple_get_lhs (stmt);
+         SSA_NAME_RANGE_INFO (lhs) = NULL;
+         SSA_NAME_ANTI_RANGE_P (lhs) = 0;
+       }
       /* In case this is a stmt that is not unconditionally executed
          when the target loop header is executed and the stmt may
         invoke undefined integer or pointer overflow rewrite it to
--- gcc/testsuite/gcc.c-torture/compile/pr64494.c.jj    2015-01-05 
10:38:11.766781507 +0100
+++ gcc/testsuite/gcc.c-torture/compile/pr64494.c       2015-01-05 
10:37:58.000000000 +0100
@@ -0,0 +1,18 @@
+/* PR tree-optimization/64494 */
+
+int a, b;
+unsigned char c;
+
+int
+main ()
+{
+  int d;
+  a = 0;
+  for (d = 0; d < 2; d++)
+    {
+      a &= (b >= 1);
+      c = (204 > (((unsigned char) ~0) >> a)) ? 0 : 204 << a;
+      b = 0;
+    }
+  return 0;
+}

        Jakub

Reply via email to