aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-04-14 21:41:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-06-22 18:20:56 +0000
commitbdd1243df58e60e85101c09001d9812a789b6bc4 (patch)
treea1ce621c7301dd47ba2ddc3b8eaa63b441389481 /contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp
parent781624ca2d054430052c828ba8d2c2eaf2d733e7 (diff)
parente3b557809604d036af6e00c60f012c2025b59a5e (diff)
downloadsrc-bdd1243df58e60e85101c09001d9812a789b6bc4.tar.gz
src-bdd1243df58e60e85101c09001d9812a789b6bc4.zip
Merge llvm-project main llvmorg-16-init-18548-gb0daacf58f41
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-16-init-18548-gb0daacf58f41. PR: 271047 MFC after: 1 month
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp
index 2ff8a3f7b228..87a0e54e2704 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/LoopSimplify.cpp
@@ -231,7 +231,7 @@ static Loop *separateNestedLoop(Loop *L, BasicBlock *Preheader,
// a function call is present until a better alternative becomes
// available. This is similar to the conservative treatment of
// convergent function calls in GVNHoist and JumpThreading.
- for (auto BB : L->blocks()) {
+ for (auto *BB : L->blocks()) {
for (auto &II : *BB) {
if (auto CI = dyn_cast<CallBase>(&II)) {
if (CI->isConvergent()) {
@@ -392,7 +392,7 @@ static BasicBlock *insertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader,
// Move the new backedge block to right after the last backedge block.
Function::iterator InsertPos = ++BackedgeBlocks.back()->getIterator();
- F->getBasicBlockList().splice(InsertPos, F->getBasicBlockList(), BEBlock);
+ F->splice(InsertPos, F, BEBlock->getIterator());
// Now that the block has been inserted into the function, create PHI nodes in
// the backedge block which correspond to any PHI nodes in the header block.
@@ -440,7 +440,7 @@ static BasicBlock *insertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader,
// eliminate the PHI Node.
if (HasUniqueIncomingValue) {
NewPN->replaceAllUsesWith(UniqueValue);
- BEBlock->getInstList().erase(NewPN);
+ NewPN->eraseFromParent();
}
}
@@ -450,8 +450,8 @@ static BasicBlock *insertUniqueBackedgeBlock(Loop *L, BasicBlock *Preheader,
// it from the backedge and add it to BEBlock.
unsigned LoopMDKind = BEBlock->getContext().getMDKindID("llvm.loop");
MDNode *LoopMD = nullptr;
- for (unsigned i = 0, e = BackedgeBlocks.size(); i != e; ++i) {
- Instruction *TI = BackedgeBlocks[i]->getTerminator();
+ for (BasicBlock *BB : BackedgeBlocks) {
+ Instruction *TI = BB->getTerminator();
if (!LoopMD)
LoopMD = TI->getMetadata(LoopMDKind);
TI->setMetadata(LoopMDKind, nullptr);
@@ -649,18 +649,13 @@ ReprocessLoop:
continue;
if (!L->makeLoopInvariant(
Inst, AnyInvariant,
- Preheader ? Preheader->getTerminator() : nullptr, MSSAU)) {
+ Preheader ? Preheader->getTerminator() : nullptr, MSSAU, SE)) {
AllInvariant = false;
break;
}
}
- 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(L);
- }
if (!AllInvariant) continue;
// The block has now been cleared of all instructions except for