+2013-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/56098
+ * tree-ssa-phiopt.c (nt_init_block): Don't call add_or_mark_expr
+ for stmts with volatile ops.
+ (cond_store_replacement): Don't optimize if assign has volatile ops.
+ (cond_if_else_store_replacement_1): Don't optimize if either
+ then_assign or else_assign have volatile ops.
+ (hoist_adjacent_loads): Don't optimize if either def1 or def2 have
+ volatile ops.
+
2013-01-25 Georg-Johann Lay <avr@gjlay.de>
* doc/invoke.texi (AVR Built-in Macros): Document __XMEGA__.
+2013-01-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/56098
+ * gcc.dg/pr56098-1.c: New test.
+ * gcc.dg/pr56098-2.c: New test.
+
2013-01-25 Georg-Johann Lay <avr@gjlay.de>
PR target/54222
--- /dev/null
+/* PR tree-optimization/56098 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fhoist-adjacent-loads -fdump-tree-optimized" } */
+
+struct S { volatile int i; volatile int j; };
+
+int
+bar (struct S *x, int y)
+{
+ int r;
+ if (y)
+ r = x->i;
+ else
+ r = x->j;
+ return r;
+}
+
+/* { dg-final { scan-tree-dump-not "r_\[0-9]* =.v. \[^\n\r]*;\[\n\r]* r_\[0-9]* =.v. " "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
{
gimple stmt = gsi_stmt (gsi);
- if (gimple_assign_single_p (stmt))
+ if (gimple_assign_single_p (stmt) && !gimple_has_volatile_ops (stmt))
{
add_or_mark_expr (bb, gimple_assign_lhs (stmt), nontrap_set, true);
add_or_mark_expr (bb, gimple_assign_rhs1 (stmt), nontrap_set, false);
/* Check if middle_bb contains of only one store. */
if (!assign
- || !gimple_assign_single_p (assign))
+ || !gimple_assign_single_p (assign)
+ || gimple_has_volatile_ops (assign))
return false;
locus = gimple_location (assign);
if (then_assign == NULL
|| !gimple_assign_single_p (then_assign)
|| gimple_clobber_p (then_assign)
+ || gimple_has_volatile_ops (then_assign)
|| else_assign == NULL
|| !gimple_assign_single_p (else_assign)
- || gimple_clobber_p (else_assign))
+ || gimple_clobber_p (else_assign)
+ || gimple_has_volatile_ops (else_assign))
return false;
lhs = gimple_assign_lhs (then_assign);
/* Both statements must be assignments whose RHS is a COMPONENT_REF. */
if (!gimple_assign_single_p (def1)
- || !gimple_assign_single_p (def2))
+ || !gimple_assign_single_p (def2)
+ || gimple_has_volatile_ops (def1)
+ || gimple_has_volatile_ops (def2))
continue;
ref1 = gimple_assign_rhs1 (def1);