From 3ada2df42673b41ac173c0c9a3a2cb482837a424 Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Mon, 9 Nov 2009 22:40:09 +0000 Subject: [PATCH] Enable the use of the new llvm objectsize intrinsic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86607 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGBuiltin.cpp | 6 ++---- test/CodeGen/object-size.c | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp index c26921969a..ab4b3bf868 100644 --- a/lib/CodeGen/CGBuiltin.cpp +++ b/lib/CodeGen/CGBuiltin.cpp @@ -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; diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c index 61d85419fc..ec9e50d296 100644 --- a/test/CodeGen/object-size.c +++ b/test/CodeGen/object-size.c @@ -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"); } -- 2.40.0