https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119103
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #9) > Shouldn't we optimize this in match.pd when global range says it is ok or > during vrp/evrp using local ranges? I mean turn the int shift into > {,un}signed {char,short} one depending on the shift amount range and casts > before/after the shift. Sure, but I think this is orthogonal to the addressed issues. I think there are a lot of targets that cannot do shifts on smaller than word_mode so the question is whether the demotion would result in extensions that are hard to eliminate later? There were talks about a promotion pass on GIMPLE in the past as well.