Carry the debug information from single exit unified return block

along with the new insert point.

Fixes PR10829

llvm-svn: 139416
This commit is contained in:
Eric Christopher
2011-09-09 21:53:04 +00:00
parent 29cfe6c368
commit 65c5c9132f
2 changed files with 18 additions and 1 deletions

View File

@@ -116,7 +116,8 @@ void CodeGenFunction::EmitReturnBlock() {
dyn_cast<llvm::BranchInst>(*ReturnBlock.getBlock()->use_begin());
if (BI && BI->isUnconditional() &&
BI->getSuccessor(0) == ReturnBlock.getBlock()) {
// Reset insertion point and delete the branch.
// Reset insertion point, including debug location, and delete the branch.
Builder.SetCurrentDebugLocation(BI->getDebugLoc());
Builder.SetInsertPoint(BI->getParent());
BI->eraseFromParent();
delete ReturnBlock.getBlock();