https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78120
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-10-26
Ever confirmed|0 |1
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> ---
First I thought that the widening_mul pass detected the add_overflow pattern
too late for later optimization to happen, but even if I write directly:
if(__builtin_add_overflow(a.lo,b.lo,&a.lo))
a.hi++;
nothing (even with -Ofast -ftree-loop-if-convert-stores) turns it into the
equivalent of
a.hi+=__builtin_add_overflow(a.lo,b.lo,&a.lo);
which anyway also generates a mix of branch and setc instead of using the carry
as one might hope...