aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2022-10-07 20:15:44 +0100
committerFlorian Hahn <flo@fhahn.com>2022-10-07 20:15:44 +0100
commit19ad1cd5cea129056255e1193daa9107ef374e00 (patch)
treecc182ab84f9c4c6683f8ff309d4f7c12eca72231 /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parentfe50eac85c06b1f97fba4c0540cea84f4b9bac8d (diff)
downloadllvm-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.cpp16
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