diff options
Diffstat (limited to 'gnu/egcs/gcc/emit-rtl.c')
-rw-r--r-- | gnu/egcs/gcc/emit-rtl.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/gnu/egcs/gcc/emit-rtl.c b/gnu/egcs/gcc/emit-rtl.c index ddbf026e2c2..ccf077120cc 100644 --- a/gnu/egcs/gcc/emit-rtl.c +++ b/gnu/egcs/gcc/emit-rtl.c @@ -1851,25 +1851,17 @@ copy_rtx_if_shared (orig) return x; case MEM: - /* A MEM is allowed to be shared if its address is constant - or is a constant plus one of the special registers. */ - if (CONSTANT_ADDRESS_P (XEXP (x, 0)) - || XEXP (x, 0) == virtual_stack_vars_rtx - || XEXP (x, 0) == virtual_incoming_args_rtx) + /* A MEM is allowed to be shared if its address is constant. + + We used to allow sharing of MEMs which referenced + virtual_stack_vars_rtx or virtual_incoming_args_rtx, but + that can lose. instantiate_virtual_regs will not unshare + the MEMs, and combine may change the structure of the address + because it looks safe and profitable in one context, but + in some other context it creates unrecognizable RTL. */ + if (CONSTANT_ADDRESS_P (XEXP (x, 0))) return x; - if (GET_CODE (XEXP (x, 0)) == PLUS - && (XEXP (XEXP (x, 0), 0) == virtual_stack_vars_rtx - || XEXP (XEXP (x, 0), 0) == virtual_incoming_args_rtx) - && CONSTANT_ADDRESS_P (XEXP (XEXP (x, 0), 1))) - { - /* This MEM can appear in more than one place, - but its address better not be shared with anything else. */ - if (! x->used) - XEXP (x, 0) = copy_rtx_if_shared (XEXP (x, 0)); - x->used = 1; - return x; - } break; default: @@ -2363,10 +2355,18 @@ try_split (pat, trial, last) it, in turn, will be split (SFmode on the 29k is an example). */ if (GET_CODE (seq) == SEQUENCE) { + int i; + + /* Avoid infinite loop if any insn of the result matches + the original pattern. */ + for (i = 0; i < XVECLEN (seq, 0); i++) + if (GET_CODE (XVECEXP (seq, 0, i)) == INSN + && rtx_equal_p (PATTERN (XVECEXP (seq, 0, i)), pat)) + return trial; + /* If we are splitting a JUMP_INSN, look for the JUMP_INSN in SEQ and copy our JUMP_LABEL to it. If JUMP_LABEL is non-zero, increment the usage count so we don't delete the label. */ - int i; if (GET_CODE (trial) == JUMP_INSN) for (i = XVECLEN (seq, 0) - 1; i >= 0; i--) |