From db69f666a728ce800a840115829f6b64bc3174d2 Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Thu, 17 Feb 2022 11:31:50 -0500 Subject: [PATCH] [PR104447] LRA: Do not split non-alloc hard regs. LRA tried to split non-allocated hard reg for reload pseudos again and again until number of assignment passes reaches the limit. The patch fixes this. gcc/ChangeLog: PR rtl-optimization/104447 * lra-constraints.cc (spill_hard_reg_in_range): Initiate ignore hard reg set by lra_no_alloc_regs. gcc/testsuite/ChangeLog: PR rtl-optimization/104447 * gcc.target/i386/pr104447.c: New. --- gcc/lra-constraints.cc | 2 +- gcc/testsuite/gcc.target/i386/pr104447.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr104447.c diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index c700c3f..b2c4590 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -6008,7 +6008,7 @@ spill_hard_reg_in_range (int regno, enum reg_class rclass, rtx_insn *from, rtx_i HARD_REG_SET ignore; lra_assert (from != NULL && to != NULL); - CLEAR_HARD_REG_SET (ignore); + ignore = lra_no_alloc_regs; EXECUTE_IF_SET_IN_BITMAP (&lra_reg_info[regno].insn_bitmap, 0, uid, bi) { lra_insn_recog_data_t id = lra_insn_recog_data[uid]; diff --git a/gcc/testsuite/gcc.target/i386/pr104447.c b/gcc/testsuite/gcc.target/i386/pr104447.c new file mode 100644 index 0000000..bf11e86 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr104447.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -pg" } */ + +int +bar (int x) +{ + asm goto ("" : : "r" (x), "r" (x + 1), "r" (x + 2), "r" (x + 3), /* { dg-error "operand has impossible constraints" } */ + "r" (x + 4), "r" (x + 5), "r" (x + 6), "r" (x + 7), + "r" (x + 8), "r" (x + 9), "r" (x + 10), "r" (x + 11), + "r" (x + 12), "r" (x + 13), "r" (x + 14), "r" (x + 15), + "r" (x + 16) : : lab); + lab: + return 0; +} -- 2.7.4