+2016-11-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/78542
+ * tree-ssa-ccp.c (evaluate_stmt): Only valueize simplification
+ if allowed.
+
2016-11-28 Paolo Bonzini <bonzini@gnu.org>
* combine.c (simplify_if_then_else): Simplify IF_THEN_ELSE
+2016-11-28 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/78542
+ * gcc.dg/torture/pr78542.c: New testcase.
+
2016-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/78343
--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-options "-w -Wno-psabi" } */
+
+typedef unsigned V __attribute__ ((vector_size (16)));
+
+V
+foo (unsigned x, V v)
+{
+ do {
+ v %= x;
+ x = 1;
+ } while (v[1]);
+ return v;
+}
+
+int
+main ()
+{
+ V x = foo (5, (V) { 0, 1 });
+ if (x[0] || x[1] || x[2] || x[3])
+ __builtin_abort();
+ return 0;
+}
{
fold_defer_overflow_warnings ();
simplified = ccp_fold (stmt);
- if (simplified && TREE_CODE (simplified) == SSA_NAME)
+ if (simplified
+ && TREE_CODE (simplified) == SSA_NAME
+ /* We may not use values of something that may be simulated again,
+ see valueize_op_1. */
+ && (SSA_NAME_IS_DEFAULT_DEF (simplified)
+ || ! prop_simulate_again_p (SSA_NAME_DEF_STMT (simplified))))
{
ccp_prop_value_t *val = get_value (simplified);
if (val && val->lattice_val != VARYING)