From 7e507322dc5a06590b17700cdb55eb71e6921710 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 14 Feb 2008 12:54:30 +0000 Subject: [PATCH] PR target/34930 * function.c (instantiate_virtual_regs_in_insn): Reload address before falling back to reloading the whole operand. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132317 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/function.c | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23d2bec..936ae64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-02-14 Michael Matz + + PR target/34930 + * function.c (instantiate_virtual_regs_in_insn): Reload address + before falling back to reloading the whole operand. + 2008-02-14 Andreas Krebbel * config/s390/s390.c (s390_mainpool_start): Emit the pool diff --git a/gcc/function.c b/gcc/function.c index 514d1a6..d3fbd17 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1468,6 +1468,20 @@ instantiate_virtual_regs_in_insn (rtx insn) start_sequence (); x = replace_equiv_address (x, addr); + /* It may happen that the address with the virtual reg + was valid (e.g. based on the virtual stack reg, which might + be acceptable to the predicates with all offsets), whereas + the address now isn't anymore, for instance when the address + is still offsetted, but the base reg isn't virtual-stack-reg + anymore. Below we would do a force_reg on the whole operand, + but this insn might actually only accept memory. Hence, + before doing that last resort, try to reload the address into + a register, so this operand stays a MEM. */ + if (!safe_insn_predicate (insn_code, i, x)) + { + addr = force_reg (GET_MODE (addr), addr); + x = replace_equiv_address (x, addr); + } seq = get_insns (); end_sequence (); if (seq) -- 2.7.4