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]

Re: your mail


> 
> Do you still have the testcase which triggered this change?

It was in crafty (ftp.cis.uab.edu:/pub/hyatt/v15/crafty-15.19.tar.gz); file
movgen.c, function GenerateCaptures.  The system was i586-linux with
glibc-2.0.95 (with some header file modifications that I hope didn't affect
anything).

> The reason I ask is I just tracked down a problem in this same hunk of code
> and was wondering if yours just papered over the underlying bug I saw.
> 
> 
> In a nutshell we had a value in hard register X.
> 
> We can't directly use X to satisfy a RELOAD_INPUT reload because X is in the
> wrong class (call it reload A).
> 
> However, copying from X to a reg of the proper class is cheap.
> 
> So, we set reload_override_in to X.
> 
> 
> Unfortunately, we have an earlier RELOAD_INPUT reload in the same insn which
> will be assigned register X as its reload register.  Call this reload B.
> 
> The code in choose_reload_regs calls reload_reg_free_before_p to verify that
> it can use the value in X at as an input for reload A.  But
> reload_reg_free_before_p is badly broken for this kind of check.
> 
> To see if a value previously known to be in X is still available in X, we
> must verify that X is not killed by *every* reload before the reload where
> we want to "inherit" the value that was previously in X.
> 
> But that's not what reload_reg_free_before_p does.  As far as I can tell it's
> badly broken for cases where EQUIV is nonzero (as will be the case with this
> bug).

That sounds like a different problem.  If I remember correctly, the other
problem resulted from rtl of the form

(set (reg 42) (reg 33))

(set (reg 42) (ashift (reg 42) (const_int 6))

where reg 33 was allocated to ecx, and reg 42 had no hard reg.  At the second
insn, the inheritance code remembered (correctly) that reg 42 can be inherited
from ecx.
The problem was that the test whether ecx may safely be modified was
incorrect, and so the second insn was reloaded to use ecx for both occurrences
of reg 42.

Bernd



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