diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopSimplify.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp index 16085f4..f247a7e 100644 --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -647,20 +647,22 @@ ReprocessLoop: Instruction *Inst = &*I++; if (Inst == CI) continue; + bool InstInvariant = false; if (!L->makeLoopInvariant( - Inst, AnyInvariant, + Inst, InstInvariant, Preheader ? Preheader->getTerminator() : nullptr, MSSAU)) { AllInvariant = false; break; } + if (InstInvariant && SE) { + // The loop disposition of all SCEV expressions that depend on any + // hoisted values have also changed. + SE->forgetBlockAndLoopDispositions(Inst); + } + AnyInvariant |= InstInvariant; } - if (AnyInvariant) { + if (AnyInvariant) Changed = true; - // The loop disposition of all SCEV expressions that depend on any - // hoisted values have also changed. - if (SE) - SE->forgetLoopDispositions(); - } if (!AllInvariant) continue; // The block has now been cleared of all instructions except for |