https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88271
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- GCC can handle these in the combiner, but for that needs the two instructions (add, etc. or in this case left shift by 1) be in the same basic block as the comparison. That is not the case here, during combine the shift by 1 is in one bb, which jumps to another bb in which is the comparison, but that other bb is preceded also by the bb with just val = data[level]; We only duplicate the comparison late and we really can't use the combiner late after RA. So, I'm afraid it is too hard to do anything here and the benefit would be small.