https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64537
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |NEW Resolution|FIXED |--- Target Milestone|9.0 |--- --- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Well it was just this case that was fixed. here is another one which is still broken: unsigned int adds_shift_ext ( unsigned long long a, unsigned short b, unsigned c) { unsigned long long d = (a - ((unsigned long long)b << 3)); if (d == 0) return a + c + b; else return b + d + c; } Note I think there is a missed reassociation/code hoisting too. <bb 3> [local count: 536870913]: _3 = (unsigned int) a_11(D); _4 = _3 + c_13(D); _15 = _4 + _8; goto <bb 5>; [100.00%] <bb 4> [local count: 536870913]: _7 = (unsigned int) d_12; _17 = _8 + c_13(D); _14 = _7 + _17; c_13(D) + _8 is full redundant here