From dc843a8597ef7ac7f2663120ae96c689c2dbbadb Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Mon, 30 Jul 2018 08:30:06 +0000 Subject: [PATCH] lra: consider clobbers when selecting hard_regno to spill The idea behind the rclass loop in spill_hard_reg_in_range() seems to be: find a hard_regno, which in general conflicts with reload regno, but does not do so between `from` and `to`, and then do the live range splitting based on this information. To check the absence of conflicts, we make use of insn_bitmap, which does not contain insns which clobber the hard_regno. gcc/ChangeLog: 2018-07-30 Ilya Leoshkevich PR target/86547 * lra-constraints.c (spill_hard_reg_in_range): When selecting the hard_regno, make sure no insn between `from` and `to` clobbers it. From-SVN: r263063 --- gcc/ChangeLog | 6 ++++++ gcc/lra-constraints.c | 16 +++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5da43787528..c635f776e34 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-07-30 Ilya Leoshkevich + + PR target/86547 + * lra-constraints.c (spill_hard_reg_in_range): When selecting the + hard_regno, make sure no insn between `from` and `to` clobbers it. + 2018-07-30 Cesar Philippidis Tom de Vries diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 7eeec767445..6d4042ebdc2 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -5722,9 +5722,19 @@ spill_hard_reg_in_range (int regno, enum reg_class rclass, rtx_insn *from, rtx_i || TEST_HARD_REG_BIT (ignore, hard_regno)) continue; for (insn = from; insn != NEXT_INSN (to); insn = NEXT_INSN (insn)) - if (bitmap_bit_p (&lra_reg_info[hard_regno].insn_bitmap, - INSN_UID (insn))) - break; + { + lra_insn_recog_data_t id = lra_insn_recog_data[uid = INSN_UID (insn)]; + struct lra_static_insn_data *static_id = id->insn_static_data; + struct lra_insn_reg *reg; + + if (bitmap_bit_p (&lra_reg_info[hard_regno].insn_bitmap, uid)) + break; + for (reg = static_id->hard_regs; reg != NULL; reg = reg->next) + if (reg->regno == hard_regno) + break; + if (reg != NULL) + break; + } if (insn != NEXT_INSN (to)) continue; if (split_reg (TRUE, hard_regno, from, NULL, to)) -- 2.30.2