aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
authorAlexey Samsonov <vonosmas@gmail.com>2015-06-11 18:25:54 +0000
committerAlexey Samsonov <vonosmas@gmail.com>2015-06-11 18:25:54 +0000
commit770f65ca6aa4d6a6a81b6129fcd48ef12d20f1f0 (patch)
treebecf1f3930a6a933e8d6ca1838169f8a2042f8b2 /llvm/lib/IR/BasicBlock.cpp
parentea20199b486b6a1a2e18ef305ead480b13e4c067 (diff)
downloadllvm-770f65ca6aa4d6a6a81b6129fcd48ef12d20f1f0.zip
llvm-770f65ca6aa4d6a6a81b6129fcd48ef12d20f1f0.tar.gz
llvm-770f65ca6aa4d6a6a81b6129fcd48ef12d20f1f0.tar.bz2
Set proper debug location for branch added in BasicBlock::splitBasicBlock().
This improves debug locations in passes that do a lot of basic block transformations. Important case is LoopUnroll pass, the test for correct debug locations accompanies this change. Test Plan: regression test suite Reviewers: dblaikie, sanjoy Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10367 llvm-svn: 239551
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 70ae3c3..77cb10d 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/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