[cfe-commits] r69232 - /cfe/trunk/lib/CodeGen/CGBlocks.cpp

Mike Stump mrs at apple.com
Wed Apr 15 15:11:36 PDT 2009


Author: mrs
Date: Wed Apr 15 17:11:36 2009
New Revision: 69232

URL: http://llvm.org/viewvc/llvm-project?rev=69232&view=rev
Log:
Fixup codegen for copy/dispose for block literals.  Radar 6791245

Modified:
    cfe/trunk/lib/CodeGen/CGBlocks.cpp

Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=69232&r1=69231&r2=69232&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Wed Apr 15 17:11:36 2009
@@ -775,7 +775,10 @@
     SrcObj = Builder.CreateLoad(SrcObj);
 
     llvm::Value *DstObj = CGF.GetAddrOfLocalVar(Dst);
-    DstObj = Builder.CreateBitCast(DstObj, llvm::PointerType::get(T, 0));
+    llvm::Type *PtrPtrT;
+    PtrPtrT = llvm::PointerType::get(llvm::PointerType::get(T, 0), 0);
+    DstObj = Builder.CreateBitCast(DstObj, PtrPtrT);
+    DstObj = Builder.CreateLoad(DstObj);
 
     for (unsigned i=0; i < NoteForHelper.size(); ++i) {
       int flag = NoteForHelper[i].flag;
@@ -924,7 +927,8 @@
 
   // dst->x
   llvm::Value *V = CGF.GetAddrOfLocalVar(Dst);
-  V = Builder.CreateBitCast(V, T);
+  V = Builder.CreateBitCast(V, llvm::PointerType::get(T, 0));
+  V = Builder.CreateLoad(V);
   V = Builder.CreateStructGEP(V, 6, "x");
   llvm::Value *DstObj = Builder.CreateBitCast(V, PtrToInt8Ty);
 
@@ -983,9 +987,11 @@
   CGF.StartFunction(FD, R, Fn, Args, SourceLocation());
 
   llvm::Value *V = CGF.GetAddrOfLocalVar(Src);
-  V = Builder.CreateBitCast(V, T);
+  V = Builder.CreateBitCast(V, llvm::PointerType::get(T, 0));
+  V = Builder.CreateLoad(V);
   V = Builder.CreateStructGEP(V, 6, "x");
-  V = Builder.CreateBitCast(V, PtrToInt8Ty);
+  V = Builder.CreateBitCast(V, llvm::PointerType::get(PtrToInt8Ty, 0));
+  V = Builder.CreateLoad(V);
 
   flag |= BLOCK_BYREF_CALLER;
   BuildBlockRelease(V, flag);





More information about the cfe-commits mailing list