https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81165
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization --- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Note that whatever clever optimization we did in GCC 7 it only happened during RTL optimization. The root cause of the regression is a change in the GIMPLE IL. Andrew figured we miss some simplification patterns. I think that for x1.1_4 ={v} x1; _5 = (unsigned short) x1.1_4; _6 = _5 ^ 8; _7 = (short int) _6; _29 = _7 & 1; _8 = (int) _29; _9 = _8 + -1; _15 = (unsigned int) _9; _30 = 1 >> _15; we miss to optimize (int)((short int)((unsigned short) x1.1_4 ^ 8) & 1) to (int)(x1.1_4 & 1) as well. Not enough to eliminate the loop. Somebody has to investigate what RTL opt did which transform to do that...