On 9/16/20 8:46 AM, Richard Sandiford wrote:
> "H.J. Lu" <hjl.to...@gmail.com> writes:
>> On Tue, Sep 15, 2020 at 7:44 AM Richard Sandiford
>> <richard.sandif...@arm.com> wrote:
>>> Thanks for looking at this.
>>>
>>> "H.J. Lu" <hjl.to...@gmail.com> writes:
>>>> commit 1bcb4c4faa4bd6b1c917c75b100d618faf9e628c
>>>> Author: Richard Sandiford <richard.sandif...@arm.com>
>>>> Date:   Wed Oct 2 07:37:10 2019 +0000
>>>>
>>>>     [LRA] Don't make eliminable registers live (PR91957)
>>>>
>>>> didn't make eliminable registers live which breaks
>>>>
>>>> register void *cur_pro asm("reg");
>>>>
>>>> where "reg" is an eliminable register.  Make fixed eliminable registers
>>>> live to fix it.
>>> I don't think fixedness itself is the issue here: it's usual for at
>>> least some registers involved in eliminations to be fixed registers.
>>>
>>> I think what makes this case different is instead that cur_pro/ebp
>>> is a global register.  But IMO things have already gone wrong if we
>>> think that a global register is eliminable.
>>>
>>> So I wonder if instead we should check global_regs at the beginning of:
>>>
>>>       for (i = 0; i < fp_reg_count; i++)
>>>         if (!TEST_HARD_REG_BIT (crtl->asm_clobbers,
>>>                                 HARD_FRAME_POINTER_REGNUM + i))
>>>           {
>>>             SET_HARD_REG_BIT (eliminable_regset,
>>>                               HARD_FRAME_POINTER_REGNUM + i);
>>>             if (frame_pointer_needed)
>>>               SET_HARD_REG_BIT (ira_no_alloc_regs,
>>>                                 HARD_FRAME_POINTER_REGNUM + i);
>>>           }
>>>         else if (frame_pointer_needed)
>>>           error ("%s cannot be used in %<asm%> here",
>>>                  reg_names[HARD_FRAME_POINTER_REGNUM + i]);
>>>         else
>>>           df_set_regs_ever_live (HARD_FRAME_POINTER_REGNUM + i, true);
>>>
>>> (ira_setup_eliminable_regset), and handle the global_regs[] case in
>>> the same way as the else case, i.e. short-circuiting both of the ifs.
>>>
>> Like this?
> Sorry for the delay.  I was testing this in parallel.
>
> Bootstrapped & regression-tested on x86_64-linux-gnu.
>
> Thanks,
> Richard
>
>
> 0001-ira-Fix-elimination-for-global-hard-FPs-PR91957.patch
>
> From af4499845d26fe65573b21197a79fd22fd38694e Mon Sep 17 00:00:00 2001
> From: "H.J. Lu" <hjl.to...@gmail.com>
> Date: Tue, 15 Sep 2020 06:23:26 -0700
> Subject: [PATCH] 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-16  Richard Sandiford  <richard.sandif...@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-16  H.J. Lu  <hjl.to...@gmail.com>
>           Richard Sandiford  <richard.sandif...@arm.com>
>
>       PR middle-end/91957
>       * g++.target/i386/pr97054.C: New test.
>       * gcc.target/i386/pr82673.c: Remove redundant extra message.

OK

jeff


Attachment: pEpkey.asc
Description: application/pgp-keys

Reply via email to