https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61837
--- Comment #7 from luoxhu at gcc dot gnu.org --- (In reply to Segher Boessenkool from comment #6) > But -funswitch-loops is much stronger than we want here, and the wrong > thing to use at -O2 (it often generates *slower* code!) Not sure your meaning here, -funswitch-loops is to generate "blelr 0" as you pointed out in (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61837#c4), not to optimize "-1, zero_ext, +1", which is to move loop invariant out, and if "-1, zero_ext, +1" could be simplified to "zero_ext" for non zero, this is actually a special case of PR67288.