diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-19 06:29:45 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-19 06:29:45 +0000 |
commit | 1569b5a36f65a5ec3490f0d68396331772160190 (patch) | |
tree | c21523868f20e9be133621772715cb46382fcfbd /gcc/ifcvt.c | |
parent | daeca4c85e0dbe5d10c5fe246b4b3313fe08f2cb (diff) | |
download | gcc-1569b5a36f65a5ec3490f0d68396331772160190.tar.gz |
PR 21541
* ifcvt.c (noce_process_if_block): Avoid conversion when the
memory destination is readonly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99951 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ifcvt.c')
-rw-r--r-- | gcc/ifcvt.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index 8367316847f..be02aaa7d24 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 |