https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67153
--- Comment #14 from ncm at cantrip dot org --- A notable difference between g++-4.9 output and g++-5 output is that, while both hoist the "(word == seven)" comparison out of the innermost loop, gcc-4.9 splits inner loop into two versions, one that increments scores by 3 and another that increments by 1, where g++-5 saves 3 or 1 into a register and uses the same inner loop for both cases. Rewriting the critical loop - to run with separate inner loops - does not slow down the fast g++-4.9-compiled program, but - fails to speed up the slow g++-5-compiled program. - to precompute a 1 or 3 increment, with one inner loop for both cases - does slow down the previously fast g++-4.9-compiled program, and - does not change the speed of the slow g++-5-compiled program