diff --git a/lib/IR/Verifier.cpp b/lib/IR/Verifier.cpp
index 4bf2d1a6dc6be17619d512bc9b83d746d75a9cc2..8a523c280162fa3b2f2a33fb2e9d8b940372534b 100644 (file)
--- a/lib/IR/Verifier.cpp
+++ b/lib/IR/Verifier.cpp
}
// Check these last, so we diagnose problems in operands first.
- Assert1(!isa<MDNodeFwdDecl>(MD), "Expected no forward declarations!", &MD);
+ Assert1(!MD.isTemporary(), "Expected no forward declarations!", &MD);
Assert1(MD.isResolved(), "All nodes should be resolved!", &MD);
}
"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),
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) &&
// 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,
if (Function *F = CI.getCalledFunction())
if (Intrinsic::ID ID = (Intrinsic::ID)F->getIntrinsicID())
switch (ID) {
- case Intrinsic::dbg_declare:
- Finder.processDeclare(*M, cast<DbgDeclareInst>(&CI));
+ case Intrinsic::dbg_declare: {
+ auto *DDI = cast<DbgDeclareInst>(&CI);
+ Finder.processDeclare(*M, DDI);
+ if (auto E = DDI->getExpression())
+ Assert1(DIExpression(E).Verify(), "DIExpression does not Verify!", E);
break;
- case Intrinsic::dbg_value:
- Finder.processValue(*M, cast<DbgValueInst>(&CI));
+ }
+ case Intrinsic::dbg_value: {
+ auto *DVI = cast<DbgValueInst>(&CI);
+ Finder.processValue(*M, DVI);
+ if (auto E = DVI->getExpression())
+ Assert1(DIExpression(E).Verify(), "DIExpression does not Verify!", E);
break;
+ }
default:
break;
}