[cfe-commits] r64674 - in /cfe/trunk: lib/CodeGen/CGBuiltin.cpp test/CodeGen/builtin-memfns.c

Daniel Dunbar daniel at zuster.org
Mon Feb 16 13:52:06 PST 2009


Author: ddunbar
Date: Mon Feb 16 15:52:05 2009
New Revision: 64674

URL: http://llvm.org/viewvc/llvm-project?rev=64674&view=rev
Log:
Fix IRgen of __builtin_memset.
 - Fix test case to not only have negative tests.

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp
    cfe/trunk/test/CodeGen/builtin-memfns.c

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Feb 16 15:52:05 2009
@@ -280,7 +280,8 @@
   case Builtin::BI__builtin_memset: {
     Value *Address = EmitScalarExpr(E->getArg(0));
     Builder.CreateCall4(CGM.getMemSetFn(), Address,
-                        EmitScalarExpr(E->getArg(1)),
+                        Builder.CreateTrunc(EmitScalarExpr(E->getArg(1)),
+                                            llvm::Type::Int8Ty),
                         EmitScalarExpr(E->getArg(2)),
                         llvm::ConstantInt::get(llvm::Type::Int32Ty, 1));
     return RValue::get(Address);

Modified: cfe/trunk/test/CodeGen/builtin-memfns.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-memfns.c?rev=64674&r1=64673&r2=64674&view=diff

==============================================================================
--- cfe/trunk/test/CodeGen/builtin-memfns.c (original)
+++ cfe/trunk/test/CodeGen/builtin-memfns.c Mon Feb 16 15:52:05 2009
@@ -1,4 +1,8 @@
-// RUN: clang -emit-llvm -o - %s | not grep __builtin
+// RUN: clang -arch i386 -emit-llvm -o %t %s &&
+// RUN: grep '@llvm.memset.i32' %t &&
+// RUN: grep '@llvm.memcpy.i32' %t &&
+// RUN: grep '@llvm.memmove.i32' %t &&
+// RUN: grep __builtin %t | count 0
 
 int main(int argc, char **argv) {
   unsigned char a = 0x11223344;





More information about the cfe-commits mailing list