This is simply a grab bag of unrelated checks:
- A statepoint call can't be marked readonly or readnone
- We don't currently support inline asm or varadic target functions. Both could be supported, but don't currently work.
- I forgot to check that the number of call arguments actually matched the wrapped callee in my previous change. Included here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223322
91177308-0d34-0410-b5e6-
96231b3b80d8
break;
case Intrinsic::experimental_gc_statepoint: {
break;
case Intrinsic::experimental_gc_statepoint: {
+ Assert1(!CI.doesNotAccessMemory() &&
+ !CI.onlyReadsMemory(),
+ "gc.statepoint must read and write memory to preserve "
+ "reordering restrictions required by safepoint semantics", &CI);
+ Assert1(!CI.isInlineAsm(),
+ "gc.statepoint support for inline assembly unimplemented", &CI);
+
const Value *Target = CI.getArgOperand(0);
const PointerType *PT = dyn_cast<PointerType>(Target->getType());
Assert2(PT && PT->getElementType()->isFunctionTy(),
"gc.statepoint callee must be of function pointer type",
&CI, Target);
FunctionType *TargetFuncType = cast<FunctionType>(PT->getElementType());
const Value *Target = CI.getArgOperand(0);
const PointerType *PT = dyn_cast<PointerType>(Target->getType());
Assert2(PT && PT->getElementType()->isFunctionTy(),
"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),
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 >= 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 Value *Unused = CI.getArgOperand(2);
Assert1(isa<ConstantInt>(Unused) &&
const Value *Unused = CI.getArgOperand(2);
Assert1(isa<ConstantInt>(Unused) &&