https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79028
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-01-09
CC| |rguenth at gcc dot gnu.org
Component|c |tree-optimization
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. This is folding via match-and-simplify
ticks_16 = _4 / 1000;
instance_14(D)->dio_next_delay = ticks_16;
_5 = ticks_16 / 2;
_6 = ticks_16 / 2;
to
ticks_16 = _4 / 1000;
instance_14(D)->dio_next_delay = ticks_16;
_5 = _4 / 2000;
_6 = _4 / 2000;
which would be ok if ticks_16 would become dead but it isn't.
forwprop misses global liveness analysis to do a better than nothing cost model
so it blindly assumes there'll be followup optimization opportunities.
It's hard to fix cases like this without pessimizing other cases (without
actually implementing such global cost modeling).