aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorSumanth Gundapaneni <sumanth.gundapaneni@amd.com>2024-08-20 13:24:15 -0500
committerGitHub <noreply@github.com>2024-08-20 13:24:15 -0500
commitb941ba1e126d44f94ff317c9a996143c3165774b (patch)
tree30fef8b5c396363e7a45a2084ad2d6d651e7872b /llvm/lib/IR/Verifier.cpp
parentc44202574ff9a8c0632aba30c2765b134557435f (diff)
downloadllvm-b941ba1e126d44f94ff317c9a996143c3165774b.zip
llvm-b941ba1e126d44f94ff317c9a996143c3165774b.tar.gz
llvm-b941ba1e126d44f94ff317c9a996143c3165774b.tar.bz2
llvm.lround: Update verifier to validate support of vector types. (#98950)
Both IRVerifier and Machine Verifier are updated
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 4e097b7..c095e47 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -5975,8 +5975,22 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
case Intrinsic::llround: {
Type *ValTy = Call.getArgOperand(0)->getType();
Type *ResultTy = Call.getType();
- Check(!ValTy->isVectorTy() && !ResultTy->isVectorTy(),
- "Intrinsic does not support vectors", &Call);
+ 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);
+ if (VTy) {
+ Check(VTy->getElementCount() == RTy->getElementCount(),
+ "llvm.lround, llvm.llround: argument must be same length as result",
+ &Call);
+ }
break;
}
case Intrinsic::bswap: {