On 11/19/13 09:43, Richard Earnshaw wrote:
PR 54300 is a problem in regcprop where the compiler sees
(parallel [(set (x) (y)
            (set (y) (x)])  (REG_UNUSED (y))

as a single-set insn (since the other operand, y, is not used) and
replaces a use of x with a use of y.  However, it fails to take into
account that y has been clobbered in the insn itself.

I considered changing single_set() to not return this case, but then
decided that would potentially cause missed optimization opportunities
in passes like combine which do know how to deal with cases like this.

The fix consists of two parts:
a) Spotting the unused sets and ensuring that their values are killed in
the value chains
b) Disabling the simple-move optimization when we've killed something in a).

The test is unfortunately ARM specific -- I'm not aware of any generic
code that triggers this.

gcc/

        PR rtl-optimization/54300
        * regcprop.c (copyprop_hardreg_forward_1): Ensure any unused
        outputs in a single-set are killed from the value chains.

gcc/testsuite:

        PR rtl-optimization/54300
        * gcc.target/arm/pr54300.C: New test.

Bootstrapped/tested on x86_64 and tested on arm-eabi.
This is good.  Please install.

Thanks,
Jeff

Reply via email to