diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2020-09-18 16:55:45 +0100 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2020-09-18 16:55:45 +0100 |
commit | 3c7c5f1d4a4b8328fb4c07483cdbfe4ea7762155 (patch) | |
tree | 0f8006892f070e8f42d6c46084958d9cf64b5320 /gcc/ira.c | |
parent | f89e9bfac36d45dcf82c462ce51163b0b196cc45 (diff) | |
download | gcc-3c7c5f1d4a4b8328fb4c07483cdbfe4ea7762155.zip gcc-3c7c5f1d4a4b8328fb4c07483cdbfe4ea7762155.tar.gz gcc-3c7c5f1d4a4b8328fb4c07483cdbfe4ea7762155.tar.bz2 |
ira: Fix elimination for global hard FPs [PR91957]
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 <richard.sandiford@arm.com>
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 <hjl.tools@gmail.com>
Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/91957
* g++.target/i386/pr97054.C: New test.
* gcc.target/i386/pr82673.c: Remove redundant extra message.
Diffstat (limited to 'gcc/ira.c')
-rw-r--r-- | gcc/ira.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); |