Skip to content

Commit 13749de

Browse files
author
git apple-llvm automerger
committed
Merge commit '7eafa5bdb78f' from llvm.org/main into next
2 parents a5b0b3d + 7eafa5b commit 13749de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

llvm/lib/IR/BasicBlock.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,10 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName,
620620
this->getNextNode());
621621

622622
// Save DebugLoc of split point before invalidating iterator.
623-
DebugLoc Loc = I->getStableDebugLoc()->getWithoutAtom();
623+
DebugLoc Loc = I->getStableDebugLoc();
624+
if (Loc)
625+
Loc = Loc->getWithoutAtom();
626+
624627
// Move all of the specified instructions from the original basic block into
625628
// the new basic block.
626629
New->splice(New->end(), this, I, end());
@@ -649,7 +652,10 @@ BasicBlock *BasicBlock::splitBasicBlockBefore(iterator I, const Twine &BBName) {
649652

650653
BasicBlock *New = BasicBlock::Create(getContext(), BBName, getParent(), this);
651654
// Save DebugLoc of split point before invalidating iterator.
652-
DebugLoc Loc = I->getDebugLoc()->getWithoutAtom();
655+
DebugLoc Loc = I->getDebugLoc();
656+
if (Loc)
657+
Loc = Loc->getWithoutAtom();
658+
653659
// Move all of the specified instructions from the original basic block into
654660
// the new basic block.
655661
New->splice(New->end(), this, begin(), I);

0 commit comments

Comments
 (0)