Fix PR/25677, rare bug in combine

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Mon Jan 9 18:01:00 GMT 2006


This is a severe, but very rare, bug in combine, that one of the recent 
changes have exposed.  I don't know which.

Basically, combine will not try combining across call instructions, but 
on the other hand it will not invalidate equivalences with registers 
that are explicitly set in the call instruction.  This patch teaches it 
about this case.

Also, record_value_for_reg had a comment saying

  "If INSN is zero, don't update reg_stat[].last_set; this is
   only permitted with VALUE also zero and is used to invalidate the
   register"

However, this feature was never used, and as implemented it was not 
sufficient to fix the bug.  So, I made combine set "last_set_invalid" 
too when INSN == VALUE == NULL_RTX.

Combine already has a loop that tries to invalidate call-clobbered 
register.  The logic is the same as calling record_value_for_reg 
*before* my bug fix.  However I did not change this because I was not 
sure if it was necessary -- and anyway, call-clobbered hard regs should 
only be present in combine if the user is using the "register ... asm" 
extension.  In this case, the user cannot rely much on their semantics 
across function calls if they specify call-clobbered registers.

This patch was bootstrapped on powerpc-apple-darwin8.3.0, and H-P 
Nilsson tested on cris-axis-elf that it causes no assembly code 
generation difference on the testsuite (except for fixing the bug!) and 
CSiBE.

Ok for mainline?
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr25677.patch
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20060109/91b57e12/attachment.ksh>


More information about the Gcc mailing list