aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2005-05-18 23:29:45 -0700
committerRichard Henderson <rth@gcc.gnu.org>2005-05-18 23:29:45 -0700
commitd2751e9ed5e31a902b308114082fe4a53e808564 (patch)
treec21523868f20e9be133621772715cb46382fcfbd
parente82766657d896c6d935d50bc5820245208075d62 (diff)
downloadgcc-d2751e9ed5e31a902b308114082fe4a53e808564.zip
gcc-d2751e9ed5e31a902b308114082fe4a53e808564.tar.gz
gcc-d2751e9ed5e31a902b308114082fe4a53e808564.tar.bz2
re PR tree-optimization/21541 (gcc.c-torture/execute/20031215-1.c compilation fails)
PR 21541 * ifcvt.c (noce_process_if_block): Avoid conversion when the memory destination is readonly. From-SVN: r99951
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ifcvt.c8
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fb7cc49..10657a4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,12 @@
2005-05-18 Richard Henderson <rth@redhat.com>
PR 21541
+ * ifcvt.c (noce_process_if_block): Avoid conversion when the
+ memory destination is readonly.
+
+2005-05-18 Richard Henderson <rth@redhat.com>
+
+ PR 21541
* tree-ssa-operands.c (opf_non_specific): New.
(get_asm_expr_operands): Set it.
(add_call_clobber_ops, add_call_read_ops): Likewise.
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 8367316..be02aaa 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -1981,6 +1981,14 @@ noce_process_if_block (struct ce_if_block * ce_info)
if (side_effects_p (x))
return FALSE;
+ /* If x is a read-only memory, then the program is valid only if we
+ avoid the store into it. If there are stores on both the THEN and
+ ELSE arms, then we can go ahead with the conversion; either the
+ program is broken, or the condition is always false such that the
+ other memory is selected. */
+ if (!set_b && MEM_P (x) && MEM_READONLY_P (x))
+ return FALSE;
+
b = (set_b ? SET_SRC (set_b) : x);
/* Only operate on register destinations, and even then avoid extending