summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-30 21:27:58 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-30 21:27:58 +0000
commit6696e22cc9cabefb906104cb1674467d64a9be1b (patch)
treeede3442695ac26c626bb6b2c6781d5254a35517e /clang/lib/CodeGen/CGCall.cpp
parentcaf9b3ab7de5c7137641de6d213ced44ed41b609 (diff)
downloadbcm5719-llvm-6696e22cc9cabefb906104cb1674467d64a9be1b.tar.gz
bcm5719-llvm-6696e22cc9cabefb906104cb1674467d64a9be1b.zip
IRgen: Fix debug info regression in r106970; when we eliminate the return value
store make sure to move the debug metadata from the store (which is actual 'return' statement location) to the return instruction (which otherwise would have the function end location as its debug info). - Tested by gdb test suite. llvm-svn: 107322
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 24a64cfa443..29104424acb 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -975,7 +975,8 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
Builder.CreateRetVoid();
return;
}
-
+
+ llvm::MDNode *RetDbgInfo = 0;
llvm::Value *RV = 0;
QualType RetTy = FI.getReturnType();
const ABIArgInfo &RetAI = FI.getReturnInfo();
@@ -1009,6 +1010,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
RV = Builder.CreateLoad(ReturnValue);
} else {
// Get the stored value and nuke the now-dead store.
+ RetDbgInfo = SI->getDbgMetadata();
RV = SI->getValueOperand();
SI->eraseFromParent();
@@ -1031,10 +1033,9 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
assert(0 && "Invalid ABI kind for return argument");
}
- if (RV)
- Builder.CreateRet(RV);
- else
- Builder.CreateRetVoid();
+ llvm::Instruction *Ret = RV ? Builder.CreateRet(RV) : Builder.CreateRetVoid();
+ if (RetDbgInfo)
+ Ret->setDbgMetadata(RetDbgInfo);
}
RValue CodeGenFunction::EmitDelegateCallArg(const VarDecl *Param) {
OpenPOWER on IntegriCloud