Extend the verifier to check usage of 'nonnull' metadata.
The recently added !nonnull metadata is only valid on loads of pointer type. llvm-svn: 220323
This commit is contained in:
parent
622be238eb
commit
0ca58b33cf
|
@ -2287,6 +2287,14 @@ void Verifier::visitInstruction(Instruction &I) {
|
||||||
visitRangeMetadata(I, Range, I.getType());
|
visitRangeMetadata(I, Range, I.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (I.getMetadata(LLVMContext::MD_nonnull)) {
|
||||||
|
Assert1(I.getType()->isPointerTy(),
|
||||||
|
"nonnull applies only to pointer types", &I);
|
||||||
|
Assert1(isa<LoadInst>(I),
|
||||||
|
"nonnull applies only to load instructions, use attributes"
|
||||||
|
" for calls or invokes", &I);
|
||||||
|
}
|
||||||
|
|
||||||
InstsInThisBlock.insert(&I);
|
InstsInThisBlock.insert(&I);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue