https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70341
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Fredrik Hederstierna from comment #8) > Could it be something in tree-ssa-forwprop pass? > > This pass is executed 4 times in -Os, and starting with GCC-4.9 it seems > like statements that seems to generate instructions that are hard to > eliminate later in compilation could be propagated? No that is correct for this pass, this was done on purpose to allow for better optimizations and better aliasing info. Anyways if we change case 4: to default: for GCC 7, we get even better code on aarch64 than previous versions (even at -O2): add x0, x0, x1, sxtw 4 ldp w2, w0, [x0, 4] cmp w2, 2 beq .L3 cmp w2, 3 beq .L4 cmp w2, 1 beq .L8 b handle_case_4 .p2align 3 .L8: b handle_case_1 .p2align 3 .L4: b handle_case_3 .p2align 3 .L3: b handle_case_2