The original code only propagated into PHI arguments if the value was
a constant. This behavior was lost in the conversion, allowing
any value (SSAs for instance) to be propagated into PHIs.
gcc/ChangeLog:
PR tree-optimization/95649
* tree-ssa-propagate.c (propagate_into_phi_args): Do not propagate unless
value is a constant.
gcc/testsuite/ChangeLog:
* g++.dg/tree-ssa/pr95649.C: New test.
* gcc.dg/tree-ssa/pr95649.c: New test.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern unsigned short var_5;
+extern int var_8, var_9;
+extern short arr_7[];
+void test() {
+ for (; 0 < (char)var_5;)
+ for (int a(var_9 ? var_5 : 0); a < 3002972621U + 1291994699;
+ a += 19499 - 19497)
+ for (long b(var_8); b; b += 4)
+ arr_7[a * b] = 0;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-scev-cprop" } */
+
+char b (void);
+char *d;
+int e;
+int f;
+void
+g (char *h)
+{
+ while (d)
+ {
+ long i = b ();
+ if (h + i > d)
+ break;
+ if (f > 0 || e)
+ do
+ *h++ = *h;
+ while (--i);
+ }
+}
|| virtual_operand_p (arg))
continue;
tree val = get_value (arg, phi);
- if (val && may_propagate_copy (arg, val))
+ if (val && is_gimple_min_invariant (val)
+ && may_propagate_copy (arg, val))
propagate_value (use_p, val);
}
}