diff options
author | Vladimir N. Makarov <vmakarov@redhat.com> | 2021-01-06 14:48:53 -0500 |
---|---|---|
committer | Vladimir N. Makarov <vmakarov@redhat.com> | 2021-01-06 16:13:30 -0500 |
commit | 15a47f437d2ba320aa9cb72986812f115498dbf9 (patch) | |
tree | 07efc4b7b1aaef24877b44d0ec6d48533cec9d98 /gcc/lra-assigns.c | |
parent | abb1b6058c09a7c0430d9bf019466ada07ca7b40 (diff) | |
download | gcc-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-assigns.c')
-rw-r--r-- | gcc/lra-assigns.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c index 9335e4c..c6a941f 100644 --- a/gcc/lra-assigns.c +++ b/gcc/lra-assigns.c @@ -1636,10 +1636,11 @@ lra_assign (bool &fails_p) bitmap_initialize (&all_spilled_pseudos, ®_obstack); create_live_range_start_chains (); setup_live_pseudos_and_spill_after_risky_transforms (&all_spilled_pseudos); - if (! lra_asm_error_p && flag_checking) - /* Check correctness of allocation for call-crossed pseudos but - only when there are no asm errors as in the case of errors the - asm is removed and it can result in incorrect allocation. */ + if (! lra_hard_reg_split_p && ! lra_asm_error_p && flag_checking) + /* Check correctness of allocation but only when there are no hard reg + splits and asm errors as in the case of errors explicit insns involving + hard regs are added or the asm is removed and this can result in + incorrect allocation. */ for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) if (lra_reg_info[i].nrefs != 0 && reg_renumber[i] >= 0 |