summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-04-01 16:18:07 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-04-01 16:18:07 +0000
commit5e9fb3dbde748212ff0b025dcf196da9b086b1c4 (patch)
tree678ba6a902249fc47cbebb2dbc758ecac5476c69 /gcc
parenteb258d7f5d615232494c75db7e6dfab151a7b7d0 (diff)
downloadgcc-5e9fb3dbde748212ff0b025dcf196da9b086b1c4.tar.gz
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr43614.c27
-rw-r--r--gcc/tree-ssa-address.c2
-rw-r--r--gcc/tree-ssa-loop-ivopts.c6
-rw-r--r--gcc/tree-ssa-operands.c3
-rw-r--r--gcc/tree.c6
7 files changed, 58 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e70ef8f246..c2a6a64dfae 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,16 @@
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
* ipa-type-escape.c (check_call): Do not access non-existing
arguments.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 77ebaa66cd5..c182186e61f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43614.c b/gcc/testsuite/gcc.c-torture/compile/pr43614.c
new file mode 100644
index 00000000000..411b25dac48
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr43614.c
@@ -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;
+}
+
diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index 5cd5d9d29c6..b17257a2a74 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -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
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index e6565dbdf99..f6db2415a36 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -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. */
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index 9b6d3a325e6..0c525b9da94 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -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));
diff --git a/gcc/tree.c b/gcc/tree.c
index 86fe2bb3b62..863b51eda94 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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;
}