From c87915629b965cfd6d8db08ebe990de5fcb2b077 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Wed, 23 Dec 2009 03:49:37 +0000 Subject: Update for the intrinsic changes in llvm: the object size intrinsic only takes a boolean second argument now. Update tests accordingly. Currently the builtin still accepts the full range for compatibility. llvm-svn: 91983 --- clang/lib/CodeGen/CGBuiltin.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CGBuiltin.cpp') diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index a791fd04f4f..98dd9ec9910 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -209,10 +209,19 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD, const llvm::Type *ResType[] = { ConvertType(E->getType()) }; + + // LLVM only supports 0 and 2, make sure that we pass along that + // as a boolean. + Value *Ty = EmitScalarExpr(E->getArg(1)); + ConstantInt *CI = dyn_cast(Ty); + assert(CI); + uint64_t val = CI->getZExtValue(); + CI = ConstantInt::get(llvm::Type::getInt1Ty(VMContext), (val & 0x2) >> 1); + Value *F = CGM.getIntrinsic(Intrinsic::objectsize, ResType, 1); return RValue::get(Builder.CreateCall2(F, EmitScalarExpr(E->getArg(0)), - EmitScalarExpr(E->getArg(1)))); + CI)); } case Builtin::BI__builtin_prefetch: { Value *Locality, *RW, *Address = EmitScalarExpr(E->getArg(0)); -- cgit v1.2.3