aboutsummaryrefslogtreecommitdiff
path: root/gcc/ira.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2020-09-18 16:55:45 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2020-09-18 16:55:45 +0100
commit3c7c5f1d4a4b8328fb4c07483cdbfe4ea7762155 (patch)
tree0f8006892f070e8f42d6c46084958d9cf64b5320 /gcc/ira.c
parentf89e9bfac36d45dcf82c462ce51163b0b196cc45 (diff)
downloadgcc-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.c8
1 files changed, 6 insertions, 2 deletions
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);