summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2009-12-23 03:49:37 +0000
committerEric Christopher <echristo@apple.com>2009-12-23 03:49:37 +0000
commitfee667f35e64751baa7fefe70b4e7bab06c8cd86 (patch)
tree8437ff4ab4f5d72a7aa1d16f02ef76153183928e /lib/CodeGen
parentc8be365b65912ebba182c39ccee4fc5c2fc7572c (diff)
downloadclang-fee667f35e64751baa7fefe70b4e7bab06c8cd86.tar.gz
clang-fee667f35e64751baa7fefe70b4e7bab06c8cd86.tar.bz2
clang-fee667f35e64751baa7fefe70b4e7bab06c8cd86.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGBuiltin.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index a791fd04f4..98dd9ec991 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/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<ConstantInt>(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));