[NFC][LLVM] Remove redundant verifier type checks for some intrinsics (#200658)
Remove the following redundant type checks:
* `[s|u]div_fix*` intrinsics, existing checks in `isSignatureValid` will
verify that arg0 and arg1 are int or int vectors (since they use
`llvm_anyint_ty`) and arg2 is declared as i32, so checks related to it
are also redundant.
* For `lrint` family, the result is `llvm_anyfloat_ty` and the argument
is `llvm_anyint_ty`, so one of the checks is redundant.
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 89a0bf6..e58209a 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -6774,19 +6774,7 @@
case Intrinsic::udiv_fix:
case Intrinsic::udiv_fix_sat: {
Value *Op1 = Call.getArgOperand(0);
- Value *Op2 = Call.getArgOperand(1);
- Check(Op1->getType()->isIntOrIntVectorTy(),
- "first operand of [us][mul|div]_fix[_sat] must be an int type or "
- "vector of ints");
- Check(Op2->getType()->isIntOrIntVectorTy(),
- "second operand of [us][mul|div]_fix[_sat] must be an int type or "
- "vector of ints");
-
auto *Op3 = cast<ConstantInt>(Call.getArgOperand(2));
- 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) {
@@ -6806,16 +6794,10 @@
case Intrinsic::llround: {
Type *ValTy = Call.getArgOperand(0)->getType();
Type *ResultTy = Call.getType();
- auto *VTy = dyn_cast<VectorType>(ValTy);
- auto *RTy = dyn_cast<VectorType>(ResultTy);
- Check(ValTy->isFPOrFPVectorTy() && ResultTy->isIntOrIntVectorTy(),
- ExpectedName + ": argument must be floating-point or vector "
- "of floating-points, and result must be integer or "
- "vector of integers",
- &Call);
Check(ValTy->isVectorTy() == ResultTy->isVectorTy(),
ExpectedName + ": argument and result disagree on vector use", &Call);
- if (VTy) {
+ if (auto *VTy = dyn_cast<VectorType>(ValTy)) {
+ auto *RTy = dyn_cast<VectorType>(ResultTy);
Check(VTy->getElementCount() == RTy->getElementCount(),
ExpectedName + ": argument must be same length as result", &Call);
}