]> granicus.if.org Git - clang/commitdiff
Enable the use of the new llvm objectsize intrinsic.
authorMike Stump <mrs@apple.com>
Mon, 9 Nov 2009 22:40:09 +0000 (22:40 +0000)
committerMike Stump <mrs@apple.com>
Mon, 9 Nov 2009 22:40:09 +0000 (22:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86607 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGBuiltin.cpp
test/CodeGen/object-size.c

index c26921969a88601cf0894ed98c935127619a5e1e..ab4b3bf86859d8f1b318e72b860e5effadfa079c 100644 (file)
@@ -199,8 +199,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
     return RValue::get(Builder.CreateCall(F, ArgValue, "tmp"));
   }
   case Builtin::BI__builtin_object_size: {
-    // FIXME: We're awaiting the llvm intrincis.
-#if 0
+#if 1
     // We pass this builtin onto the optimizer so that it can
     // figure out the object size in more complex cases.
     const llvm::Type *ResType[] = {
@@ -211,8 +210,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
                                            EmitScalarExpr(E->getArg(0)),
                                            EmitScalarExpr(E->getArg(1))));
 #else
-    // FIXME: Implement. For now we just always fail and pretend we
-    // don't know the object size.
+    // FIXME: Remove after testing.
     llvm::APSInt TypeArg = E->getArg(1)->EvaluateAsInt(CGM.getContext());
     const llvm::Type *ResType = ConvertType(E->getType());
     //    bool UseSubObject = TypeArg.getZExtValue() & 1;
index 61d85419fc6962cc1c9a10687c70e8529e8ca214..ec9e50d29638062dcf03b45709ae771ed33e9f74 100644 (file)
@@ -46,8 +46,8 @@ void test4() {
 }
 
 void test5() {
-  // CHECK:       movb    $0, %al
-  // CHECK-NEXT:  testb   %al, %al
+  // CHECK:       movq    $-1, %rax
+  // CHECK-NEXT:  cmpq    $-1, %rax
   // CHECK:       call    ___inline_strcpy_chk
   strcpy(gp, "Hi there");
 }