Skip to content

[Verifier] Make lrint and lround intrinsic cases concise. NFC #105676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 9 additions & 30 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5952,44 +5952,23 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
break;
}
case Intrinsic::lrint:
case Intrinsic::llrint: {
Type *ValTy = Call.getArgOperand(0)->getType();
Type *ResultTy = Call.getType();
Check(
ValTy->isFPOrFPVectorTy() && ResultTy->isIntOrIntVectorTy(),
"llvm.lrint, llvm.llrint: 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(),
"llvm.lrint, llvm.llrint: argument and result disagree on vector use",
&Call);
if (ValTy->isVectorTy()) {
Check(cast<VectorType>(ValTy)->getElementCount() ==
cast<VectorType>(ResultTy)->getElementCount(),
"llvm.lrint, llvm.llrint: argument must be same length as result",
&Call);
}
break;
}
case Intrinsic::llrint:
case Intrinsic::lround:
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(),
"llvm.lround, llvm.llround: 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(),
"llvm.lround, llvm.llround: argument and result disagree on vector use",
&Call);
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) {
Check(VTy->getElementCount() == RTy->getElementCount(),
"llvm.lround, llvm.llround: argument must be same length as result",
&Call);
ExpectedName + ": argument must be same length as result", &Call);
}
break;
}
Expand Down
Loading