https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112645
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-11-21 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. I guess for the first testcase we're missing a "switch-merging" transform. For the last one we do Linear transformation with A = 1 and B = 0 ... <bb 2> : _1 = v_3(D) & 3; _6 = (unsigned int) _1; _7 = _6 + 4294967295; if (_7 <= 2) goto <bb 4>; [INV] else goto <bb 3>; [INV] <bb 3> : <L7>: _9 = 0; goto <bb 5>; [100.00%] <bb 4> : <L8>: _4 = (unsigned int) _1; _5 = _1; <bb 5> : # _2 = PHI <_5(4), _9(3)> possibly because we earlier optimize the switch to switch (v & 3) { default: return 0; case 1: return 1; case 2: return 2; case 3: return 3; } and fail to recover.