https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64853

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/tree-vrp.c.jj    2015-01-28 08:39:51.000000000 +0100
+++ gcc/tree-vrp.c    2015-01-29 10:44:37.395688127 +0100
@@ -7093,14 +7093,14 @@ vrp_valueize_1 (tree name)
   if (TREE_CODE (name) == SSA_NAME)
     {
       value_range_t *vr = get_value_range (name);
-      if (range_int_cst_singleton_p (vr))
-    return vr->min;
       /* If the definition may be simulated again we cannot follow
          this SSA edge as the SSA propagator does not necessarily
      re-visit the use.  */
       gimple def_stmt = SSA_NAME_DEF_STMT (name);
       if (prop_simulate_again_p (def_stmt))
     return NULL_TREE;
+      if (range_int_cst_singleton_p (vr))
+    return vr->min;
     }
   return name;
 }

fixes this, even when a VR is singleton, it might be singleton just because it
is singleton only in the first iteration and not afterwards.
That said, I'd worry that this patch might degrade VRP folding too much.

Reply via email to