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.

Thanks,
Richard

Reply via email to