aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1992-12-07 21:43:55 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1992-12-07 21:43:55 -0500
commit7c791b139c5143cc357c0c48c14af5a962197503 (patch)
treef02a2e58e54c9983eab4d5c447113e0bef1d5989 /gcc
parentdf6c0bdc911b40b90dd9d29a7cb2cebcfe9fc5dc (diff)
downloadgcc-7c791b139c5143cc357c0c48c14af5a962197503.zip
gcc-7c791b139c5143cc357c0c48c14af5a962197503.tar.gz
gcc-7c791b139c5143cc357c0c48c14af5a962197503.tar.bz2
(eliminate_regs_in_insn): Make another copy of all the RTL if we
changed something and we aren't permanently replacing. From-SVN: r2845
Diffstat (limited to 'gcc')
-rw-r--r--gcc/reload1.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 7ffef0d..7458018 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -2996,6 +2996,14 @@ eliminate_regs_in_insn (insn, replace)
new_body = eliminate_regs (old_body, 0, replace ? insn : NULL_RTX);
if (new_body != old_body)
{
+ /* If we aren't replacing things permanently and we changed something,
+ make another copy to ensure that all the RTL is new. Otherwise
+ things can go wrong if find_reload swaps commutative operands
+ and one is inside RTL that has been copied while the other is not. */
+
+ if (! replace)
+ new_body = copy_rtx (new_body);
+
/* If we had a move insn but now we don't, rerecognize it. */
if ((GET_CODE (old_body) == SET && GET_CODE (SET_SRC (old_body)) == REG
&& (GET_CODE (new_body) != SET