diff options
author | Florian Hahn <flo@fhahn.com> | 2022-10-07 20:15:44 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2022-10-07 20:15:44 +0100 |
commit | 19ad1cd5cea129056255e1193daa9107ef374e00 (patch) | |
tree | cc182ab84f9c4c6683f8ff309d4f7c12eca72231 /llvm/lib/Transforms/Utils/LoopSimplify.cpp | |
parent | fe50eac85c06b1f97fba4c0540cea84f4b9bac8d (diff) | |
download | llvm-19ad1cd5cea129056255e1193daa9107ef374e00.zip llvm-19ad1cd5cea129056255e1193daa9107ef374e00.tar.gz llvm-19ad1cd5cea129056255e1193daa9107ef374e00.tar.bz2 |
Recommit "[SCEV] Support clearing Block/LoopDispositions for a single value."
This reverts commit 92f698f01fa0bb8967233a6391ada2d51849fa68.
The updated version of the patch includes handling for non-SCEVable
types. A test case has been added in ec86e9a99bca802.
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 |