+2016-09-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/77454
+ * tree-ssa-dom.c (optimize_stmt): Set modified flag on stmt after
+ changing GIMPLE_COND. Move update_stmt_if_modified call after this.
+ Formatting fix.
+
2016-09-13 Tamar Christina <tamar.christina@arm.com>
* config/aarch64/aarch64-builtins.c
2016-09-13 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/77454
+ * gcc.dg/pr77454.c: New test.
+
PR c++/77553
* g++.dg/cpp1y/constexpr-77553.C: New test.
--- /dev/null
+/* PR tree-optimization/77454 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+foo (unsigned char x, char y)
+{
+ while (x != 0)
+ {
+ unsigned char *a = &x;
+ int b;
+
+ if (y != 0)
+ a = (unsigned char *) &y;
+ else if (y + 1 != 0)
+ a = (unsigned char *) &y;
+ for (x = 0; x < 1; ++x)
+ b = 0;
+ for (y = 0; y < 3; ++y)
+ {
+ y = !!y;
+ if (y != 0)
+ x = y;
+ }
+ if ((b != 0 ? -1 : *a) < (y = b))
+ b = 1;
+ }
+}
{
tree val = NULL;
- update_stmt_if_modified (stmt);
-
if (gimple_code (stmt) == GIMPLE_COND)
val = fold_binary_loc (gimple_location (stmt),
- gimple_cond_code (stmt), boolean_type_node,
- gimple_cond_lhs (stmt), gimple_cond_rhs (stmt));
+ gimple_cond_code (stmt), boolean_type_node,
+ gimple_cond_lhs (stmt),
+ gimple_cond_rhs (stmt));
else if (gswitch *swtch_stmt = dyn_cast <gswitch *> (stmt))
val = gimple_switch_index (swtch_stmt);
gimple_cond_make_true (as_a <gcond *> (stmt));
else
gcc_unreachable ();
+
+ gimple_set_modified (stmt, true);
}
/* Further simplifications may be possible. */
}
}
+ update_stmt_if_modified (stmt);
+
/* If we simplified a statement in such a way as to be shown that it
cannot trap, update the eh information and the cfg to match. */
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt))