This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

A problem simplifying subregs of the hard frame pointer

While testing some other Thumb-1 changes, I got an abort while
generating thumb_movhi_clobber for a secondary reload.  The pattern
calls gcc_unreachable when it finds a case it can't handle.

There's a FIXME there that other cases might need to be handled, but
looking closer, the entire pattern seems bogus; it requests two scratch
regs (one DImode reg) and doesn't use them.  The circumstances in which
we arrive there also seemed suspect.  We were reloading an insn of the form

 (set (mem:HI (some address)) (subreg:HI (reg:SI 7)))

Reload did _not_ choose the reg->mem alternative of the movhi pattern,
which is crazy.  The reason it didn't is that reg 7 is the hard frame
pointer, and simplify_subreg_regno didn't want to simplify the subreg
here (-fomit-frame-pointer was on of course).  So, find_reloads set
force_reload for the register operand, which seems to have been enough
to confuse its cost calculations.

Fixed by the first part of this patch; I see no reason to treat the hard
frame pointer register specially - it's typically just a general reg.
the same effect as before, which is probably still wrong, but for now
it's a safe change to make.

The other part removes the strange-looking part frmo the
thumb_movhi_clobber register and restores it to just a call to
gcc_unreachable.  This is still ugly, but it's essentially the state it
was in before
which presumably changed this because of the bug I'm fixing here.

Regression tested, together with some other patches, on

which only showed up one unrelated problem for which I'm testing a fix.

Ok (rtlanal and ARM parts)?


Attachment: subreg-problem.diff
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]