r178053 - Fix uninitialized read of CalleeWithThisReturn.

Manman Ren mren at apple.com
Tue Mar 26 11:29:15 PDT 2013


Author: mren
Date: Tue Mar 26 13:29:15 2013
New Revision: 178053

URL: http://llvm.org/viewvc/llvm-project?rev=178053&view=rev
Log:
Fix uninitialized read of CalleeWithThisReturn.

Initialize CalleeWithThisReturn to 0 in the constructor.
Also revert r170815 since checking CalleeWithThisReturn is faster.

PR15598

Modified:
    cfe/trunk/lib/CodeGen/CGCall.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=178053&r1=178052&r2=178053&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Mar 26 13:29:15 2013
@@ -1722,7 +1722,7 @@ void CodeGenFunction::EmitFunctionEpilog
   // the same object as CXXThisValue, use the return value from the CallInst.
   // We will not need to keep 'this' alive through the callsite. It also enables
   // optimizations in the backend, such as tail call optimization.
-  if (CGM.getCXXABI().HasThisReturn(CurGD) && CalleeWithThisReturn) {
+  if (CalleeWithThisReturn && CGM.getCXXABI().HasThisReturn(CurGD)) {
     llvm::BasicBlock *IP = Builder.GetInsertBlock();
     llvm::CallInst *Callsite;
     if (!IP->empty() && (Callsite = dyn_cast<llvm::CallInst>(&IP->back())) &&

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=178053&r1=178052&r2=178053&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Mar 26 13:29:15 2013
@@ -42,7 +42,8 @@ CodeGenFunction::CodeGenFunction(CodeGen
     AutoreleaseResult(false), BlockInfo(0), BlockPointer(0),
     LambdaThisCaptureField(0), NormalCleanupDest(0), NextCleanupDestIndex(1),
     FirstBlockInfo(0), EHResumeBlock(0), ExceptionSlot(0), EHSelectorSlot(0),
-    DebugInfo(0), DisableDebugInfo(false), DidCallStackSave(false),
+    DebugInfo(0), DisableDebugInfo(false), CalleeWithThisReturn(0),
+    DidCallStackSave(false),
     IndirectBranch(0), SwitchInsn(0), CaseRangeBlock(0), UnreachableBlock(0),
     CXXABIThisDecl(0), CXXABIThisValue(0), CXXThisValue(0),
     CXXStructorImplicitParamDecl(0), CXXStructorImplicitParamValue(0),





More information about the cfe-commits mailing list