aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra.c
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2021-01-06 14:48:53 -0500
committerVladimir N. Makarov <vmakarov@redhat.com>2021-01-06 16:13:30 -0500
commit15a47f437d2ba320aa9cb72986812f115498dbf9 (patch)
tree07efc4b7b1aaef24877b44d0ec6d48533cec9d98 /gcc/lra.c
parentabb1b6058c09a7c0430d9bf019466ada07ca7b40 (diff)
downloadgcc-15a47f437d2ba320aa9cb72986812f115498dbf9.zip
gcc-15a47f437d2ba320aa9cb72986812f115498dbf9.tar.gz
gcc-15a47f437d2ba320aa9cb72986812f115498dbf9.tar.bz2
[PR97978] LRA: Permit temporary allocation incorrectness after hard reg split.
LRA can crash when a hard register was split and the same hard register was assigned on the previous assignment sub-pass. The following patch fixes this problem. gcc/ChangeLog: PR rtl-optimization/97978 * lra-int.h (lra_hard_reg_split_p): New external. * lra.c (lra_hard_reg_split_p): New global. (lra): Set up lra_hard_reg_split_p after splitting a hard reg. * lra-assigns.c (lra_assign): Don't check allocation correctness after hard reg splitting. gcc/testsuite/ChangeLog: PR rtl-optimization/97978 * gcc.target/i386/pr97978.c: New.
Diffstat (limited to 'gcc/lra.c')
-rw-r--r--gcc/lra.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/lra.c b/gcc/lra.c
index 380a21a..aa49de6 100644
--- a/gcc/lra.c
+++ b/gcc/lra.c
@@ -2211,6 +2211,9 @@ bitmap_head lra_subreg_reload_pseudos;
/* File used for output of LRA debug information. */
FILE *lra_dump_file;
+/* True if we split hard reg after the last constraint sub-pass. */
+bool lra_hard_reg_split_p;
+
/* True if we found an asm error. */
bool lra_asm_error_p;
@@ -2359,6 +2362,7 @@ lra (FILE *f)
if (live_p)
lra_clear_live_ranges ();
bool fails_p;
+ lra_hard_reg_split_p = false;
do
{
/* We need live ranges for lra_assign -- so build them.
@@ -2403,6 +2407,7 @@ lra (FILE *f)
live_p = false;
if (! lra_split_hard_reg_for ())
break;
+ lra_hard_reg_split_p = true;
}
}
while (fails_p);