aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2020-03-13 14:58:57 -0400
committerVladimir N. Makarov <vmakarov@redhat.com>2020-03-13 14:58:57 -0400
commita4504f32c056db781a2bdc104dffa1b29684c930 (patch)
tree691e3b6f8f72dc1a0c4ced279eb087b12b8da170
parent45ee7a35f347e59f003d65bce0d43d5123d827cf (diff)
downloadgcc-a4504f32c056db781a2bdc104dffa1b29684c930.zip
gcc-a4504f32c056db781a2bdc104dffa1b29684c930.tar.gz
gcc-a4504f32c056db781a2bdc104dffa1b29684c930.tar.bz2
PR92303: Try to simplify memory subreg.
2020-03-13 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/92303 * lra-spills.c (remove_pseudos): Try to simplify memory subreg.
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/lra-spills.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d63b831..4ea81e6 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 0022611..01256e7 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