[LoopLoadElim] Make sure all loops are in simplify form. PR48150
authorMax Kazantsev <mkazantsev@azul.com>
Thu, 26 Nov 2020 03:49:44 +0000 (10:49 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Thu, 26 Nov 2020 03:51:11 +0000 (10:51 +0700)
commit664e1da485d244325947d056a271c3c733ad4c7c
tree325af6ec4b78a4c3fdffb1e7eb896eee08b3c978
parent2fb5f4a1cf41af31eaf31ea90cdda7f644794b99
[LoopLoadElim] Make sure all loops are in simplify form. PR48150

LoopLoadElim may end up expanding an AddRec from a loop
which is not the current loop. This loop may not be in simplify
form. We figure it out after the no-return point, so cannot bail
in this case.

AddRec requires simplify form to expand. The only way to ensure
this does not crash is to simplify all loops beforehand.

The issue only exists in new PM. Old PM requests LoopSimplify
required pass and it simplifies all loops before the opt begins.

Differential Revision: https://reviews.llvm.org/D91525
Reviewed By: asbirlea, aeubanks
llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
llvm/test/Transforms/LoopLoadElim/pr-48150.ll