[cfe-commits] r107322 - /cfe/trunk/lib/CodeGen/CGCall.cpp
Daniel Dunbar
daniel at zuster.org
Wed Jun 30 14:27:59 PDT 2010
Author: ddunbar
Date: Wed Jun 30 16:27:58 2010
New Revision: 107322
URL: http://llvm.org/viewvc/llvm-project?rev=107322&view=rev
Log:
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.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=107322&r1=107321&r2=107322&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Jun 30 16:27:58 2010
@@ -975,7 +975,8 @@
Builder.CreateRetVoid();
return;
}
-
+
+ llvm::MDNode *RetDbgInfo = 0;
llvm::Value *RV = 0;
QualType RetTy = FI.getReturnType();
const ABIArgInfo &RetAI = FI.getReturnInfo();
@@ -1009,6 +1010,7 @@
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 @@
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) {
More information about the cfe-commits
mailing list