aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2025-01-27 16:44:14 +0000
committerGitHub <noreply@github.com>2025-01-27 16:44:14 +0000
commit34b139594aa20fe712bc2ad68544632b3e4d8512 (patch)
tree18cbd3bb7b614d704f4b1552ebffd9a3b2a619c0 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
parent038b42ba5b47b1aa2d47ef5706a713f6bfbbc37c (diff)
downloadllvm-34b139594aa20fe712bc2ad68544632b3e4d8512.zip
llvm-34b139594aa20fe712bc2ad68544632b3e4d8512.tar.gz
llvm-34b139594aa20fe712bc2ad68544632b3e4d8512.tar.bz2
[NFC][DebugInfo] Switch more call-sites to using iterator-insertion (#124283)
To finalise the "RemoveDIs" work removing debug intrinsics, we're updating call sites that insert instructions to use iterators instead. This set of changes are those where it's not immediately obvious that just calling getIterator to fetch an iterator is correct, and one or two places where more than one line needs to change. Overall the same rule holds though: iterators generated for the start of a block such as getFirstNonPHIIt need to be passed into insert/move methods without being unwrapped/rewrapped, everything else can use getIterator.
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BasicBlockUtils.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 5d191c2..f814204 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -836,7 +836,7 @@ BasicBlock *llvm::ehAwareSplitEdge(BasicBlock *BB, BasicBlock *Succ,
const CriticalEdgeSplittingOptions &Options,
const Twine &BBName) {
- auto *PadInst = Succ->getFirstNonPHI();
+ auto PadInst = Succ->getFirstNonPHIIt();
if (!LandingPadReplacement && !PadInst->isEHPad())
return SplitEdge(BB, Succ, Options.DT, Options.LI, Options.MSSAU, BBName);
@@ -981,7 +981,7 @@ BasicBlock *llvm::ehAwareSplitEdge(BasicBlock *BB, BasicBlock *Succ,
void llvm::createPHIsForSplitLoopExit(ArrayRef<BasicBlock *> Preds,
BasicBlock *SplitBB, BasicBlock *DestBB) {
// SplitBB shouldn't have anything non-trivial in it yet.
- assert((SplitBB->getFirstNonPHI() == SplitBB->getTerminator() ||
+ assert((&*SplitBB->getFirstNonPHIIt() == SplitBB->getTerminator() ||
SplitBB->isLandingPad()) &&
"SplitBB has non-PHI nodes!");
@@ -1450,7 +1450,7 @@ static void SplitLandingPadPredecessorsImpl(
// The new block unconditionally branches to the old block.
BranchInst *BI1 = BranchInst::Create(OrigBB, NewBB1);
- BI1->setDebugLoc(OrigBB->getFirstNonPHI()->getDebugLoc());
+ BI1->setDebugLoc(OrigBB->getFirstNonPHIIt()->getDebugLoc());
// Move the edges from Preds to point to NewBB1 instead of OrigBB.
for (BasicBlock *Pred : Preds) {
@@ -1491,7 +1491,7 @@ static void SplitLandingPadPredecessorsImpl(
// The new block unconditionally branches to the old block.
BranchInst *BI2 = BranchInst::Create(OrigBB, NewBB2);
- BI2->setDebugLoc(OrigBB->getFirstNonPHI()->getDebugLoc());
+ BI2->setDebugLoc(OrigBB->getFirstNonPHIIt()->getDebugLoc());
// Move the remaining edges from OrigBB to point to NewBB2.
for (BasicBlock *NewBB2Pred : NewBB2Preds)