combine: Fix for PR82024
With the testcase in the PR, with all the command line options mentioned
there, a (comparison) instruction becomes dead in fwprop1 but is not
deleted until all the way in rtl_dce.
Before combine this insn look like:
20: flags:CC=cmp(r106:DI,0xffffffffffffffff)
REG_DEAD r106:DI
REG_UNUSED flags:CC
REG_EQUAL cmp(0,0xffffffffffffffff)
(note the only output is unused).
Combining some earlier insns gives
13: r106:DI=0
14: r105:DI=r101:DI+r103:DI
14+13+20 then gives
(parallel [
(set (reg:CC 17 flags)
(compare:CC (const_int 0 [0])
(const_int -1 [0xffffffffffffffff])))
(set (reg:DI 105)
(plus:DI (reg/v:DI 101 [ e ])
(reg:DI 103)))
])
which doesn't match; but the set of flags is dead, so combine makes the
set of r105 the whole new instruction, which it then places at i3. But
that is wrong, because r105 is used after i2 but before i3! We forget
to check for that in this case.
This patch fixes it.
PR rtl-optimization/82024
* combine.c (try_combine): If the combination result is a PARALLEL,
and we only need to retain the SET in there that would be placed
at I2, check that we can place that at I3 instead, before doing so.
From-SVN: r251607