+2010-04-01 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/43614
+ * tree-ssa-address.c (copy_mem_ref_info): Copy TREE_SIDE_EFFECTS
+ and TREE_THIS_VOLATILE.
+ (copy_ref_info): Likewise.
+ * tree-ssa-operands.c (get_tmr_operands): Check TREE_THIS_VOLATILE.
+ * tree.c (build6_stat): Ignore side-effects of all but arg5
+ for TARGET_MEM_REF. Set TREE_THIS_VOLATILE from arg5 of
+ TARGET_MEM_REF.
+
2010-04-01 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43607
+2010-04-01 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/43614
+ * gcc.c-torture/compile/pr43614.c: New testcase.
+
2010-04-01 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/43141
--- /dev/null
+volatile int g_2[7];
+
+void foo (unsigned);
+
+int main (void)
+{
+ int i_459 = 0;
+ int t2818;
+ int t2819;
+ volatile char *t2820;
+ int t2821;
+ volatile char *t2822;
+ int *t2823;
+ unsigned t2824;
+LL655:
+ t2822 = (volatile char *)g_2;
+ t2821 = i_459;
+ t2820 = t2822 + t2821;
+ t2823 = (int *)t2820;
+ t2824 = *t2823;
+ foo (t2824);
+ t2818 = i_459;
+ t2819 = t2818 + 1;
+ i_459 = t2819;
+ goto LL655;
+}
+
{
/* And the info about the original reference. */
TMR_ORIGINAL (to) = TMR_ORIGINAL (from);
+ TREE_SIDE_EFFECTS (to) = TREE_SIDE_EFFECTS (from);
+ TREE_THIS_VOLATILE (to) = TREE_THIS_VOLATILE (from);
}
/* Move constants in target_mem_ref REF to offset. Returns the new target
if (TREE_CODE (old_ref) == TARGET_MEM_REF)
copy_mem_ref_info (new_ref, old_ref);
else
- TMR_ORIGINAL (new_ref) = unshare_and_remove_ssa_names (old_ref);
+ {
+ TMR_ORIGINAL (new_ref) = unshare_and_remove_ssa_names (old_ref);
+ TREE_SIDE_EFFECTS (new_ref) = TREE_SIDE_EFFECTS (old_ref);
+ TREE_THIS_VOLATILE (new_ref) = TREE_THIS_VOLATILE (old_ref);
+ }
}
/* Rewrites USE (address that is an iv) using candidate CAND. */
static void
get_tmr_operands (gimple stmt, tree expr, int flags)
{
+ if (TREE_THIS_VOLATILE (expr))
+ gimple_set_has_volatile_ops (stmt, true);
+
/* First record the real operands. */
get_expr_operands (stmt, &TMR_BASE (expr), opf_use | (flags & opf_no_vops));
get_expr_operands (stmt, &TMR_INDEX (expr), opf_use | (flags & opf_no_vops));
PROCESS_ARG(2);
PROCESS_ARG(3);
PROCESS_ARG(4);
+ if (code == TARGET_MEM_REF)
+ side_effects = 0;
PROCESS_ARG(5);
TREE_SIDE_EFFECTS (t) = side_effects;
- TREE_THIS_VOLATILE (t) = 0;
+ TREE_THIS_VOLATILE (t)
+ = (code == TARGET_MEM_REF
+ && arg5 && TREE_THIS_VOLATILE (arg5));
return t;
}