re PR tree-optimization/43614 (ice in gimple_rhs_has_side_effects, at gimple.c:2248)

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.

	* gcc.c-torture/compile/pr43614.c: New testcase.

From-SVN: r157913
This commit is contained in:
Richard Guenther 2010-04-01 16:18:07 +00:00 committed by Richard Biener
parent eb258d7f5d
commit 5e9fb3dbde
7 changed files with 58 additions and 2 deletions

View File

@ -1,3 +1,14 @@
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

View File

@ -1,3 +1,8 @@
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

View File

@ -0,0 +1,27 @@
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;
}

View File

@ -765,6 +765,8 @@ copy_mem_ref_info (tree to, tree from)
{
/* 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

View File

@ -5517,7 +5517,11 @@ copy_ref_info (tree new_ref, tree old_ref)
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. */

View File

@ -732,6 +732,9 @@ get_indirect_ref_operands (gimple stmt, tree expr, int flags,
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));

View File

@ -3824,10 +3824,14 @@ build6_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
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;
}