Skip to content

Commit d2181f5

Browse files
committed
Verifier: perform length checks for lrint, llrint
1 parent 0a1e8a6 commit d2181f5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5669,6 +5669,26 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
56695669
}
56705670
break;
56715671
}
5672+
case Intrinsic::lrint:
5673+
case Intrinsic::llrint: {
5674+
Type *ValTy = Call.getArgOperand(0)->getType();
5675+
Type *ResultTy = Call.getType();
5676+
Check(
5677+
ValTy->isFPOrFPVectorTy() && ResultTy->isIntOrIntVectorTy(),
5678+
"llvm.lrint, llvm.llrint: argument must be floating-point or vector "
5679+
"of floating-points, and result must be integer or vector of integers",
5680+
&Call);
5681+
Check(ValTy->isVectorTy() == ResultTy->isVectorTy(),
5682+
"llvm.lrint, llvm.llrint: argument and result disagree on vector use",
5683+
&Call);
5684+
if (ValTy->isVectorTy()) {
5685+
Check(cast<VectorType>(ValTy)->getElementCount() ==
5686+
cast<VectorType>(ResultTy)->getElementCount(),
5687+
"llvm.lrint, llvm.llrint: argument must be same length as result",
5688+
&Call);
5689+
}
5690+
break;
5691+
}
56725692
case Intrinsic::lround:
56735693
case Intrinsic::llround: {
56745694
Type *ValTy = Call.getArgOperand(0)->getType();

0 commit comments

Comments
 (0)