https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62025
--- Comment #12 from amker at gcc dot gnu.org --- Hi, I can reproduce the exact mis-scheduled instruction issue as in Jakub's comment with/without the ivopt patch (204497). Turns out gcc chooses candidate like {&K512, 128}_loop with the patch while candidate {&K512[16], 128}_loop without the patch. This is caused by candidate cost change. As far as I can see, both candidate are good for the iv use and shouldn't generate wrong code either. The interesting thing is, mis-scheduled instruction is the only code difference (apart from some offset difference as base of candidates are different) caused by ivopt patch. Normally middle-end patch should have larger impact on generated code if there is. I will have a look why different iv candidate can result in one instruction mis-scheduled. Maybe it's useful for investigation. Anyway, I think 204497 is generally fine in this case. Thanks, bin