aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index 7eb0ba1..3d14608 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -2347,8 +2347,7 @@ static void unswitchNontrivialInvariants(
BI->setSuccessor(1 - ClonedSucc, LoopPH);
Value *Cond = skipTrivialSelect(BI->getCondition());
if (InsertFreeze)
- Cond = new FreezeInst(
- Cond, Cond->getName() + ".fr", BI);
+ Cond = new FreezeInst(Cond, Cond->getName() + ".fr", BI->getIterator());
BI->setCondition(Cond);
DTUpdates.push_back({DominatorTree::Insert, SplitBB, ClonedPH});
} else {
@@ -2365,8 +2364,9 @@ static void unswitchNontrivialInvariants(
Case.setSuccessor(ClonedPHs.find(Case.getCaseSuccessor())->second);
if (InsertFreeze)
- SI->setCondition(new FreezeInst(
- SI->getCondition(), SI->getCondition()->getName() + ".fr", SI));
+ SI->setCondition(new FreezeInst(SI->getCondition(),
+ SI->getCondition()->getName() + ".fr",
+ SI->getIterator()));
// We need to use the set to populate domtree updates as even when there
// are multiple cases pointing at the same successor we only want to
@@ -2704,7 +2704,8 @@ static BranchInst *turnSelectIntoBranch(SelectInst *SI, DominatorTree &DT,
if (MSSAU)
MSSAU->moveAllAfterSpliceBlocks(HeadBB, TailBB, SI);
- PHINode *Phi = PHINode::Create(SI->getType(), 2, "unswitched.select", SI);
+ PHINode *Phi =
+ PHINode::Create(SI->getType(), 2, "unswitched.select", SI->getIterator());
Phi->addIncoming(SI->getTrueValue(), ThenBB);
Phi->addIncoming(SI->getFalseValue(), HeadBB);
SI->replaceAllUsesWith(Phi);
@@ -3092,7 +3093,7 @@ injectPendingInvariantConditions(NonTrivialUnswitchCandidate Candidate, Loop &L,
// unswitching will break. Better optimize it away later.
auto *InjectedCond =
ICmpInst::Create(Instruction::ICmp, Pred, LHS, RHS, "injected.cond",
- Preheader->getTerminator());
+ Preheader->getTerminator()->getIterator());
BasicBlock *CheckBlock = BasicBlock::Create(Ctx, BB->getName() + ".check",
BB->getParent(), InLoopSucc);