https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116817
--- Comment #5 from Tamar Christina <tnfchris at gcc dot gnu.org> --- Waiting for regression testing to finish and will submit. The condition used before to check for loop invariant is !internal_def. This of course fails when it's a reduction, which is what happened here. I now just check for the external or constant def. For reductions I leave it as it's always been, since we don't support codegen for these kinds of reductions anyway.