From 3c7c5f1d4a4b8328fb4c07483cdbfe4ea7762155 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Fri, 18 Sep 2020 16:55:45 +0100 Subject: ira: Fix elimination for global hard FPs [PR91957] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the hard frame pointer is being used as a global register, we should skip the usual handling for eliminations. As the comment says, the register cannot in that case be eliminated (or eliminated to) and is already marked live where appropriate. Doing this removes the duplicate error for gcc.target/i386/pr82673.c. The “cannot be used in 'asm' here” message is meant to be for asm statements rather than register asms, and the function that the error is reported against doesn't use asm. gcc/ 2020-09-18 Richard Sandiford PR middle-end/91957 * ira.c (ira_setup_eliminable_regset): Skip the special elimination handling of the hard frame pointer if the hard frame pointer is fixed. gcc/testsuite/ 2020-09-18 H.J. Lu Richard Sandiford PR middle-end/91957 * g++.target/i386/pr97054.C: New test. * gcc.target/i386/pr82673.c: Remove redundant extra message. --- gcc/ira.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/ira.c') diff --git a/gcc/ira.c b/gcc/ira.c index a759f3c..27d1b3c 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -2310,8 +2310,12 @@ ira_setup_eliminable_regset (void) if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) { for (i = 0; i < fp_reg_count; i++) - if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, - HARD_FRAME_POINTER_REGNUM + i)) + if (global_regs[HARD_FRAME_POINTER_REGNUM + i]) + /* Nothing to do: the register is already treated as live + where appropriate, and cannot be eliminated. */ + ; + else if (!TEST_HARD_REG_BIT (crtl->asm_clobbers, + HARD_FRAME_POINTER_REGNUM + i)) { SET_HARD_REG_BIT (eliminable_regset, HARD_FRAME_POINTER_REGNUM + i); -- cgit v1.1