diff options
author | Florian Hahn <flo@fhahn.com> | 2022-10-14 21:58:14 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2022-10-14 21:58:14 +0100 |
commit | 16cf666bb7f574bc56cc0a5caf859de7c1c22704 (patch) | |
tree | 6d4a2ba5791bf163876ba6dfe1f87aa8fe732156 /llvm/lib/Transforms/Utils/LoopSimplify.cpp | |
parent | adf29726108a965d2a278e1418ba5f8aa5a03eff (diff) | |
download | llvm-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.cpp | 11 |
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; |