[LRA] Do not use eliminable registers for spilling
authorKwok Cheung Yeung <kcy@codesourcery.com>
Sun, 10 Nov 2019 18:22:38 +0000 (18:22 +0000)
committerKwok Cheung Yeung <kcy@gcc.gnu.org>
Sun, 10 Nov 2019 18:22:38 +0000 (18:22 +0000)
The liveness of eliminable hard registers is not tracked by LRA between
basic blocks, so they should not be used as spill registers as LRA may
decide to allocate them to pseudos while the spilled value is still live.

2019-11-10  Kwok Cheung Yeung  <kcy@codesourcery.com>

gcc/
* lra-spills.c (assign_spill_hard_regs): Do not spill into
registers in eliminable_regset.

From-SVN: r278024

gcc/ChangeLog
gcc/lra-spills.c

index 02b24d3b4b19d95052e41bc3f631f7cbd0b6cfe7..8b7ed6358c33f09712109494efb98c0a25f1b3db 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-10  Kwok Cheung Yeung  <kcy@codesourcery.com>
+
+       * lra-spills.c (assign_spill_hard_regs): Do not spill into
+       registers in eliminable_regset.
+
 2019-11-10  Jan Hubicka  <hubicka@ucw.cz>
 
        * ipa-inline.c (compute_uninlined_call_time,
index 0068e52ace1e061ad7582a66e8d69fe7cdffbb06..54f76ccf8644ee4e7d2a64d8d05e19406ea1462e 100644 (file)
@@ -283,6 +283,8 @@ assign_spill_hard_regs (int *pseudo_regnos, int n)
       for (k = 0; k < spill_class_size; k++)
        {
          hard_regno = ira_class_hard_regs[spill_class][k];
+         if (TEST_HARD_REG_BIT (eliminable_regset, hard_regno))
+           continue;
          if (! overlaps_hard_reg_set_p (conflict_hard_regs, mode, hard_regno))
            break;
        }