public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] LRA: fix for PR92303
@ 2020-03-13 19:06 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2020-03-13 19:06 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 169 bytes --]

   The following committed patch solves

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92303

   The patch was successfully bootstrapped and tested on x86-64.



[-- Attachment #2: pr92303.patch --]
[-- Type: text/x-patch, Size: 1304 bytes --]

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d63b83194d5..4ea81e6c404 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-13  Vladimir Makarov  <vmakarov@redhat.com>
+
+	PR rtl-optimization/92303
+	* lra-spills.c (remove_pseudos): Try to simplify memory subreg.
+
 2020-03-13  Segher Boessenkool  <segher@kernel.crashing.org>
 
 	PR rtl-optimization/94148
diff --git a/gcc/lra-spills.c b/gcc/lra-spills.c
index 0022611785c..01256e711bc 100644
--- a/gcc/lra-spills.c
+++ b/gcc/lra-spills.c
@@ -421,7 +421,16 @@ remove_pseudos (rtx *loc, rtx_insn *insn)
   if (*loc == NULL_RTX)
     return res;
   code = GET_CODE (*loc);
-  if (code == REG && (i = REGNO (*loc)) >= FIRST_PSEUDO_REGISTER
+  if (code == SUBREG && REG_P (SUBREG_REG (*loc)))
+    {
+      /* Try to remove memory subregs to simplify LRA job
+         and avoid LRA cycling in case of subreg memory reload.  */
+      res = remove_pseudos (&SUBREG_REG (*loc), insn);
+      if (GET_CODE (SUBREG_REG (*loc)) == MEM)
+	alter_subreg (loc, false);
+      return res;
+    }
+  else if (code == REG && (i = REGNO (*loc)) >= FIRST_PSEUDO_REGISTER
       && lra_get_regno_hard_regno (i) < 0
       /* We do not want to assign memory for former scratches because
 	 it might result in an address reload for some targets.	 In

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-13 19:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13 19:06 [PATCH] LRA: fix for PR92303 Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).