This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Fix target/45063, caller-save.c problem induced by IRA multiword changes


After the IRA changes to track words separately, the same hard register
may appear to hold more than one live pseudo.  This confuses
caller-save.c into turning

(... reg:DI 18 is used ...)
call somehwere ;; clobber reg:DI 18
set (reg:SI 19) something else
use (reg:SI 19)

into

(... reg:DI 18 is used ...)
save reg:DI 18
call somehwere ;; clobber reg:DI 18
set (reg:SI 19) something else
restore REG:SI 19 ;; because the next insn uses it...
use (reg:SI 19)

Fixed by making it look for stores into regs it thinks it still has to
restore.  There's comment elsewhere in caller-save already which
describes a similar problem:
         /* Record all registers set in this call insn.  These don't
             need to be saved.  N.B. the call insn might set a subreg
             of a multi-hard-reg pseudo; then the pseudo is considered
             live during the call, but the subreg that is set
             isn't.  */

For a while I was worried that there might be other places in reload
which could be confused, until I found
      /* Similarly, only do this if we can be sure that the death
         note is still valid.  global can assign some hardreg to
         the pseudo referenced in the note and simultaneously a
         subword of this hardreg to a different, also live pseudo,
         because only another subword of the hardreg is actually
         used in the insn.  This cannot happen if the pseudo has
         been assigned exactly one hardreg.  See PR 33732.  */

and remembered that the IRA change isn't actually a new thing, just a
regression fix for something local-alloc was able to do for a long time.

Bootstrapped and regression tested on i686-linux; committed.  It's been
reported to fix the PA bootstrap problem.


Bernd

Attachment: caller-save.diff
Description: Text document


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