This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] lra: Don't remove the scratch in (mem:BLK (scratch))


LRA wants to replace SCRATCH registers with real registers.  It should
not do that with (mem:BLK (scratch)), which is special, not really a
scratch register.

I don't know if this patch handles this in the best place to handle it;
I don't even know if it is really correct.  It does solve the rs6000
bootstrap problems with LRA enabled by default (it ICEd building libitm),
with no apparent ill effects.

It seems other targets can do without this.  rs6000 uses this construct
inside of a PARALLEL, maybe that is the difference?

Any hints appreciated!


Segher


2015-10-29  Segher Boessenkool  <segher@kernel.crashing.org>

	* lra-constraints.c (process_address_1): Handle (mem:BLK (scratch))
	by ignoring it.

---
 gcc/lra-constraints.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index bc7a292..b04b426 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2877,6 +2877,11 @@ process_address_1 (int nop, bool check_only_p,
   enum constraint_num cn = lookup_constraint (constraint);
   bool change_p = false;
 
+  if (MEM_P (op)
+      && GET_MODE (op) == BLKmode
+      && GET_CODE (XEXP (op, 0)) == SCRATCH)
+    return false;
+
   if (insn_extra_address_constraint (cn))
     decompose_lea_address (&ad, curr_id->operand_loc[nop]);
   else if (MEM_P (op))
-- 
1.9.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]