&AI);
Assert1(PTy->getElementType()->isSized(), "Cannot allocate unsized type",
&AI);
+ Assert1(AI.getArraySize()->getType()->isInteger(32),
+ "Alloca array size must be i32", &AI);
visitInstruction(AI);
}
// If the intrinsic takes MDNode arguments, verify that they are either global
// or are local to *this* function.
- for (unsigned i = 0, e = CI.getNumOperands(); i != e; ++i)
+ for (unsigned i = 1, e = CI.getNumOperands(); i != e; ++i)
if (MDNode *MD = dyn_cast<MDNode>(CI.getOperand(i))) {
if (!MD->isFunctionLocal()) continue;
SmallPtrSet<MDNode *, 32> Visited;
switch (ID) {
default:
break;
- case Intrinsic::dbg_declare: // llvm.dbg.declare
- if (Constant *C = dyn_cast<Constant>(CI.getOperand(1)))
- Assert1(C && !isa<ConstantPointerNull>(C),
- "invalid llvm.dbg.declare intrinsic call", &CI);
- break;
+ case Intrinsic::dbg_declare: { // llvm.dbg.declare
+ Assert1(CI.getOperand(1) && isa<MDNode>(CI.getOperand(1)),
+ "invalid llvm.dbg.declare intrinsic call 1", &CI);
+ MDNode *MD = cast<MDNode>(CI.getOperand(1));
+ Assert1(MD->getNumOperands() == 1,
+ "invalid llvm.dbg.declare intrinsic call 2", &CI);
+ if (MD->getOperand(0))
+ if (Constant *C = dyn_cast<Constant>(MD->getOperand(0)))
+ Assert1(C && !isa<ConstantPointerNull>(C),
+ "invalid llvm.dbg.declare intrinsic call 3", &CI);
+ } break;
case Intrinsic::memcpy:
case Intrinsic::memmove:
case Intrinsic::memset: