aboutsummaryrefslogtreecommitdiff
path: root/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/IR/BasicBlock.cpp')
-rw-r--r--lib/IR/BasicBlock.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/IR/BasicBlock.cpp b/lib/IR/BasicBlock.cpp
index 70ae3c398423..77cb10d5b6ba 100644
--- a/lib/IR/BasicBlock.cpp
+++ b/lib/IR/BasicBlock.cpp
@@ -362,12 +362,15 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName) {
BasicBlock *New = BasicBlock::Create(getContext(), BBName,
getParent(), InsertBefore);
+ // Save DebugLoc of split point before invalidating iterator.
+ DebugLoc Loc = I->getDebugLoc();
// Move all of the specified instructions from the original basic block into
// the new basic block.
New->getInstList().splice(New->end(), this->getInstList(), I, end());
// Add a branch instruction to the newly formed basic block.
- BranchInst::Create(New, this);
+ BranchInst *BI = BranchInst::Create(New, this);
+ BI->setDebugLoc(Loc);
// Now we must loop through all of the successors of the New block (which
// _were_ the successors of the 'this' block), and update any PHI nodes in