https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87543
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- As I mentioned in PR 87987: So I think LLVM's unrolling notices the load will become constant and the whole induction variable basically goes away for sum. I also said something similar in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97077#c3 too.