https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79405
Segher Boessenkool <segher at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |segher at gcc dot
gnu.org
--- Comment #7 from Segher Boessenkool <segher at gcc dot gnu.org> ---
The testcase has undefined behaviour, of course.
We start with these insns, all in the same basic block, in this order:
B := A|Z (1)
A := B (2)
D := A (3)
First propagating (1) into (2) is tried. This fails, because the IOR makes
this not simple enough to propagate.
Later Z is found to be 0, but it never tries to propagate (1) into (2) again.
If fwprop would try that there would be no problem, and this is a missed
optimisation anyway!
If all propagations would be tried it would result in
B := A
A := A
D := A
but with what we have now we get
B := A
A := B
D := A
oscillating with
B := A
A := B
D := B