[llvm-branch-commits] [cfe-branch] r143270 - /cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp

Bill Wendling isanbard at gmail.com
Fri Oct 28 18:19:11 PDT 2011


Author: void
Date: Fri Oct 28 20:19:11 2011
New Revision: 143270

URL: http://llvm.org/viewvc/llvm-project?rev=143270&view=rev
Log:
Fixes an intermittent bug that I finally got a good test case for in GNU ObjC.
Patch by David Chisnall.

Modified:
    cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp

Modified: cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp?rev=143270&r1=143269&r2=143270&view=diff
==============================================================================
--- cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/branches/release_30/lib/CodeGen/CGObjCGNU.cpp Fri Oct 28 20:19:11 2011
@@ -538,11 +538,12 @@
                                  llvm::Value *cmd,
                                  llvm::MDNode *node) {
     CGBuilderTy &Builder = CGF.Builder;
-    llvm::Value *imp = Builder.CreateCall2(MsgLookupFn, 
-            EnforceType(Builder, Receiver, IdTy),
-            EnforceType(Builder, cmd, SelectorTy));
-    cast<llvm::CallInst>(imp)->setMetadata(msgSendMDKind, node);
-    return imp;
+    llvm::Value *args[] = {
+      EnforceType(Builder, Receiver, IdTy),
+      EnforceType(Builder, cmd, SelectorTy) };
+    llvm::CallSite imp = CGF.EmitCallOrInvoke(MsgLookupFn, args);
+    imp->setMetadata(msgSendMDKind, node);
+    return imp.getInstruction();
   }
   virtual llvm::Value *LookupIMPSuper(CodeGenFunction &CGF,
                                       llvm::Value *ObjCSuper,
@@ -597,16 +598,17 @@
       // The lookup function is guaranteed not to capture the receiver pointer.
       LookupFn->setDoesNotCapture(1);
 
-      llvm::CallInst *slot =
-          Builder.CreateCall3(LookupFn,
-              EnforceType(Builder, ReceiverPtr, PtrToIdTy),
-              EnforceType(Builder, cmd, SelectorTy),
-              EnforceType(Builder, self, IdTy));
-      slot->setOnlyReadsMemory();
+      llvm::Value *args[] = {
+        EnforceType(Builder, ReceiverPtr, PtrToIdTy),
+        EnforceType(Builder, cmd, SelectorTy),
+        EnforceType(Builder, self, IdTy) };
+      llvm::CallSite slot = CGF.EmitCallOrInvoke(LookupFn, args);
+      slot.setOnlyReadsMemory();
       slot->setMetadata(msgSendMDKind, node);
 
       // Load the imp from the slot
-      llvm::Value *imp = Builder.CreateLoad(Builder.CreateStructGEP(slot, 4));
+      llvm::Value *imp =
+        Builder.CreateLoad(Builder.CreateStructGEP(slot.getInstruction(), 4));
 
       // The lookup function may have changed the receiver, so make sure we use
       // the new one.





More information about the llvm-branch-commits mailing list