diff options
author | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-01-20 19:42:46 +0000 |
---|---|---|
committer | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-01-20 19:42:46 +0000 |
commit | be10ece5ed0eaad063cfef5d4669dea952fb1fa1 (patch) | |
tree | b4e0cd9bca4bd6a125a4a868325b240b5a05e391 /llvm/lib/IR/Verifier.cpp | |
parent | 565cc18d8fdf8d340752f5fd9a21797295d52b5d (diff) | |
download | bcm5719-llvm-be10ece5ed0eaad063cfef5d4669dea952fb1fa1.tar.gz bcm5719-llvm-be10ece5ed0eaad063cfef5d4669dea952fb1fa1.zip |
[GC] Verify-pass void vararg functions in gc.statepoint
With the appropriate Verifier changes, exactracting the result out of a
statepoint wrapping a vararg function crashes. However, a void vararg
function works fine: commit this first step.
Differential Revision: http://reviews.llvm.org/D7071
llvm-svn: 226599
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index f0a149354ae..c95018d1772 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -2639,8 +2639,6 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { "gc.statepoint callee must be of function pointer type", &CI, Target); FunctionType *TargetFuncType = cast<FunctionType>(PT->getElementType()); - Assert1(!TargetFuncType->isVarArg(), - "gc.statepoint support for var arg functions not implemented", &CI); const Value *NumCallArgsV = CI.getArgOperand(1); Assert1(isa<ConstantInt>(NumCallArgsV), @@ -2650,8 +2648,18 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { Assert1(NumCallArgs >= 0, "gc.statepoint number of arguments to underlying call " "must be positive", &CI); - Assert1(NumCallArgs == (int)TargetFuncType->getNumParams(), - "gc.statepoint mismatch in number of call args", &CI); + const int NumParams = (int)TargetFuncType->getNumParams(); + if (TargetFuncType->isVarArg()) { + Assert1(NumCallArgs >= NumParams, + "gc.statepoint mismatch in number of vararg call args", &CI); + + // TODO: Remove this limitation + Assert1(TargetFuncType->getReturnType()->isVoidTy(), + "gc.statepoint doesn't support wrapping non-void " + "vararg functions yet", &CI); + } else + Assert1(NumCallArgs == NumParams, + "gc.statepoint mismatch in number of call args", &CI); const Value *Unused = CI.getArgOperand(2); Assert1(isa<ConstantInt>(Unused) && @@ -2660,7 +2668,7 @@ void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { // Verify that the types of the call parameter arguments match // the type of the wrapped callee. - for (int i = 0; i < NumCallArgs; i++) { + for (int i = 0; i < NumParams; i++) { Type *ParamType = TargetFuncType->getParamType(i); Type *ArgType = CI.getArgOperand(3+i)->getType(); Assert1(ArgType == ParamType, |