aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-12-21 10:25:26 -0800
committerJim Wilson <wilson@gcc.gnu.org>1993-12-21 10:25:26 -0800
commit3eb8f14cbc240ac542ac954dccf0fe8569cc1c30 (patch)
tree641115a7cc05f88fda611706434f815d07d72ba4
parent77541d4e8357345d6234f3664b8b2dce7a660275 (diff)
downloadgcc-3eb8f14cbc240ac542ac954dccf0fe8569cc1c30.zip
gcc-3eb8f14cbc240ac542ac954dccf0fe8569cc1c30.tar.gz
gcc-3eb8f14cbc240ac542ac954dccf0fe8569cc1c30.tar.bz2
(replace_regs, case REG): Return copies of SUBREGs, to
avoid invalid sharing. From-SVN: r6253
-rw-r--r--gcc/rtlanal.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 48aa6f9..486ef5f 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1662,7 +1662,14 @@ replace_regs (x, reg_map, nregs, replace_dest)
case REG:
/* Verify that the register has an entry before trying to access it. */
if (REGNO (x) < nregs && reg_map[REGNO (x)] != 0)
- return reg_map[REGNO (x)];
+ {
+ /* SUBREGs can't be shared. Always return a copy to ensure that if
+ this replacement occurs more than once then each instance will
+ get distinct rtx. */
+ if (GET_CODE (reg_map[REGNO (x)]) == SUBREG)
+ return copy_rtx (reg_map[REGNO (x)]);
+ return reg_map[REGNO (x)];
+ }
return x;
case SUBREG: