aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2022-10-14 21:58:14 +0100
committerFlorian Hahn <flo@fhahn.com>2022-10-14 21:58:14 +0100
commit16cf666bb7f574bc56cc0a5caf859de7c1c22704 (patch)
tree6d4a2ba5791bf163876ba6dfe1f87aa8fe732156 /llvm/lib/Transforms/Utils/LoopSimplify.cpp
parentadf29726108a965d2a278e1418ba5f8aa5a03eff (diff)
downloadllvm-16cf666bb7f574bc56cc0a5caf859de7c1c22704.zip
llvm-16cf666bb7f574bc56cc0a5caf859de7c1c22704.tar.gz
llvm-16cf666bb7f574bc56cc0a5caf859de7c1c22704.tar.bz2
[Loop] Move block and loop dispo invalidation to makeLoopInvariant.
makeLoopInvariant may recursively move its operands to make them invariant, before moving the passed in instruction. Those recursively moved instructions are currently missed when invalidating block and loop dispositions. To address this, move the invalidation code to Loop::makeLoopInvariant. Fixes #58314. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D135909
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopSimplify.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index f247a7e..8943b4b 100644
--- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -647,19 +647,12 @@ ReprocessLoop:
Instruction *Inst = &*I++;
if (Inst == CI)
continue;
- bool InstInvariant = false;
if (!L->makeLoopInvariant(
- Inst, InstInvariant,
- Preheader ? Preheader->getTerminator() : nullptr, MSSAU)) {
+ Inst, AnyInvariant,
+ Preheader ? Preheader->getTerminator() : nullptr, MSSAU, SE)) {
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)
Changed = true;