[llvm-commits] [dragonegg] r88664 - /dragonegg/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Fri Nov 13 09:58:12 PST 2009


Author: baldrick
Date: Fri Nov 13 11:58:09 2009
New Revision: 88664

URL: http://llvm.org/viewvc/llvm-project?rev=88664&view=rev
Log:
Port revisions 85265, 85466, 85477, 86371 and 86487 from llvm-gcc:
implementing BUILT_IN_OBJECT_SIZE.

Modified:
    dragonegg/trunk/llvm-convert.cpp

Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=88664&r1=88663&r2=88664&view=diff

==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Fri Nov 13 11:58:09 2009
@@ -4448,17 +4448,18 @@
       Emit(gimple_call_arg(stmt, 1), 0)
     };
 
-    const Type* Ty[3] = {
-      ConvertType(gimple_call_return_type(stmt)),
-      Type::getInt8PtrTy(Context),
-      Type::getInt32Ty(Context)
-    };
+    // Grab the current return type.
+    const Type* Ty = ConvertType(gimple_call_return_type(stmt));
+
+    // Manually coerce the arg to the correct pointer type.
+    Args[0] = Builder.CreateBitCast(Args[0], Type::getInt8PtrTy(Context));
+    Args[1] = Builder.CreateIntCast(Args[1], Type::getInt32Ty(Context), false);
 
     Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
-							  Intrinsic::objectsize,
-							  Ty,
-							  1),
-				Args, Args + 2);
+                                                          Intrinsic::objectsize,
+                                                          &Ty,
+                                                          1),
+                                Args, Args + 2);
     return true;
   }
   // Unary bit counting intrinsics.





More information about the llvm-commits mailing list