https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100391
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Component|target |tree-optimization Last reconfirmed| |2021-05-03 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. There is a missed optimization at the tree level in the first place. The cast to uint32_t is not prograded back through the PHI node. _1 = kt_4 >> 60; if (_1 != 0) goto <bb 3>; [50.00%] else goto <bb 4>; [50.00%] <bb 3> [local count: 536870913]: kt_5 = kt_4 & 1152921504606846975; <bb 4> [local count: 1073741824]: # kt_2 = PHI <kt_4(2), kt_5(3)> _6 = (uint32_t) kt_2; If it was then the above would have became just: _6 = (uint32_t) kt_4;