summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Function.cpp
diff options
context:
space:
mode:
authorSteven Wu <stevenwu@apple.com>2014-10-20 15:47:24 +0000
committerSteven Wu <stevenwu@apple.com>2014-10-20 15:47:24 +0000
commitd05affcc8167627314a5ac6395aac7746927992f (patch)
treefb2deff6dbc7b0e499b58566b8e121664e2beb15 /llvm/lib/IR/Function.cpp
parent6672f37ed2b3b1ab1bfc4f85619e454578481f39 (diff)
downloadbcm5719-llvm-d05affcc8167627314a5ac6395aac7746927992f.tar.gz
bcm5719-llvm-d05affcc8167627314a5ac6395aac7746927992f.zip
Fix Intrinsic::getType not working with vararg
VarArg Intrinsic functions are encoded with "void" type as the last argument. Now Intrinsic::getType can correctly return all the intrinsic function type. llvm-svn: 220205
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r--llvm/lib/IR/Function.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp
index 83f71a89162..13747cafec9 100644
--- a/llvm/lib/IR/Function.cpp
+++ b/llvm/lib/IR/Function.cpp
@@ -739,6 +739,12 @@ FunctionType *Intrinsic::getType(LLVMContext &Context,
while (!TableRef.empty())
ArgTys.push_back(DecodeFixedType(TableRef, Tys, Context));
+ // DecodeFixedType returns Void for IITDescriptor::Void and IITDescriptor::VarArg
+ // If we see void type as the type of the last argument, it is vararg intrinsic
+ if (!ArgTys.empty() && ArgTys.back()->isVoidTy()) {
+ ArgTys.pop_back();
+ return FunctionType::get(ResultTy, ArgTys, true);
+ }
return FunctionType::get(ResultTy, ArgTys, false);
}
OpenPOWER on IntegriCloud