fwprop.c  currently has a bug where a successful  propagation to one operand 
of an instruction will prevent propagation to any remaining operands.


The cause is due to the use of loc_mentioned_in_p() to check that a reference,
provided by earlier DF scan, still exist in an instruction.

The test is intended to check that an earlier propagation and simplification 
has not removed D/U references.

However, loc_mentioned_in_p(), compares addresses of rtx to determine 
equivalence. If an instruction has already been modified and simplified, this
will
longer apply - even if the def/use is still valid.

This problem was already noted in Nov, but no bug report seems to have been 
filed.

http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00170.html


I will attach patch, that uses reg_mentioned_p() as a substitute. The only
differences I noted where:

a) reg_mentioned_p() does not match physical sub registers of longer hard
registers.
This seems to have no consequence since fwprop entirely rejects hard_registers 
 in latter code. Perhaps for clarity, hard registers could be ignored earlier.

b) registers in asm_operands are found. Which seems beneficial if they are
pseudos and again ignored if they are hard registers.


I am only able to test this with AVR port. In that it was 100% successful with
no 
regressions of torture/execute testsuite.


-- 
           Summary: fwprop only propagates one operand
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hutchinsonandy at aim dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35542

Reply via email to