aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/IR/Verifier.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/IR/Verifier.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/llvm-project/llvm/lib/IR/Verifier.cpp b/contrib/llvm-project/llvm/lib/IR/Verifier.cpp
index 8aba28026306..aeaca21a99cc 100644
--- a/contrib/llvm-project/llvm/lib/IR/Verifier.cpp
+++ b/contrib/llvm-project/llvm/lib/IR/Verifier.cpp
@@ -2296,10 +2296,9 @@ void Verifier::verifyFunctionMetadata(
Check(isa<ConstantAsMetadata>(MD->getOperand(0)),
"expected a constant operand for !kcfi_type", MD);
Constant *C = cast<ConstantAsMetadata>(MD->getOperand(0))->getValue();
- Check(isa<ConstantInt>(C),
+ Check(isa<ConstantInt>(C) && isa<IntegerType>(C->getType()),
"expected a constant integer operand for !kcfi_type", MD);
- IntegerType *Type = cast<ConstantInt>(C)->getType();
- Check(Type->getBitWidth() == 32,
+ Check(cast<ConstantInt>(C)->getBitWidth() == 32,
"expected a 32-bit integer constant operand for !kcfi_type", MD);
}
}
@@ -5690,8 +5689,10 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
"vector of ints");
auto *Op3 = cast<ConstantInt>(Call.getArgOperand(2));
- Check(Op3->getType()->getBitWidth() <= 32,
- "third argument of [us][mul|div]_fix[_sat] must fit within 32 bits");
+ Check(Op3->getType()->isIntegerTy(),
+ "third operand of [us][mul|div]_fix[_sat] must be an int type");
+ Check(Op3->getBitWidth() <= 32,
+ "third operand of [us][mul|div]_fix[_sat] must fit within 32 bits");
if (ID == Intrinsic::smul_fix || ID == Intrinsic::smul_fix_sat ||
ID == Intrinsic::sdiv_fix || ID == Intrinsic::sdiv_fix_sat) {