[SVE] Generalize size checks in Verifier to use getElementCount
Summary: Attempts to call getNumElements on scalable vectors identified by test LLVM.Other::scalable-vectors-core-ir.ll. Since these checks are all attempting to find if two vectors are the same size, calling getElementCount will only increase safety. Reviewers: efriedma, aprantl, reames, kmclaughlin, sdesmalen Reviewed By: efriedma Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81895
This commit is contained in:
parent
73312976ad
commit
8e204f807b
|
@ -2743,8 +2743,8 @@ void Verifier::visitUIToFPInst(UIToFPInst &I) {
|
|||
&I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
Assert(cast<VectorType>(SrcTy)->getNumElements() ==
|
||||
cast<VectorType>(DestTy)->getNumElements(),
|
||||
Assert(cast<VectorType>(SrcTy)->getElementCount() ==
|
||||
cast<VectorType>(DestTy)->getElementCount(),
|
||||
"UIToFP source and dest vector length mismatch", &I);
|
||||
|
||||
visitInstruction(I);
|
||||
|
@ -2766,8 +2766,8 @@ void Verifier::visitSIToFPInst(SIToFPInst &I) {
|
|||
&I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
Assert(cast<VectorType>(SrcTy)->getNumElements() ==
|
||||
cast<VectorType>(DestTy)->getNumElements(),
|
||||
Assert(cast<VectorType>(SrcTy)->getElementCount() ==
|
||||
cast<VectorType>(DestTy)->getElementCount(),
|
||||
"SIToFP source and dest vector length mismatch", &I);
|
||||
|
||||
visitInstruction(I);
|
||||
|
@ -2789,8 +2789,8 @@ void Verifier::visitFPToUIInst(FPToUIInst &I) {
|
|||
"FPToUI result must be integer or integer vector", &I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
Assert(cast<VectorType>(SrcTy)->getNumElements() ==
|
||||
cast<VectorType>(DestTy)->getNumElements(),
|
||||
Assert(cast<VectorType>(SrcTy)->getElementCount() ==
|
||||
cast<VectorType>(DestTy)->getElementCount(),
|
||||
"FPToUI source and dest vector length mismatch", &I);
|
||||
|
||||
visitInstruction(I);
|
||||
|
@ -2812,8 +2812,8 @@ void Verifier::visitFPToSIInst(FPToSIInst &I) {
|
|||
"FPToSI result must be integer or integer vector", &I);
|
||||
|
||||
if (SrcVec && DstVec)
|
||||
Assert(cast<VectorType>(SrcTy)->getNumElements() ==
|
||||
cast<VectorType>(DestTy)->getNumElements(),
|
||||
Assert(cast<VectorType>(SrcTy)->getElementCount() ==
|
||||
cast<VectorType>(DestTy)->getElementCount(),
|
||||
"FPToSI source and dest vector length mismatch", &I);
|
||||
|
||||
visitInstruction(I);
|
||||
|
@ -2835,9 +2835,9 @@ void Verifier::visitPtrToIntInst(PtrToIntInst &I) {
|
|||
&I);
|
||||
|
||||
if (SrcTy->isVectorTy()) {
|
||||
VectorType *VSrc = cast<VectorType>(SrcTy);
|
||||
VectorType *VDest = cast<VectorType>(DestTy);
|
||||
Assert(VSrc->getNumElements() == VDest->getNumElements(),
|
||||
auto *VSrc = cast<VectorType>(SrcTy);
|
||||
auto *VDest = cast<VectorType>(DestTy);
|
||||
Assert(VSrc->getElementCount() == VDest->getElementCount(),
|
||||
"PtrToInt Vector width mismatch", &I);
|
||||
}
|
||||
|
||||
|
@ -2860,9 +2860,9 @@ void Verifier::visitIntToPtrInst(IntToPtrInst &I) {
|
|||
Assert(SrcTy->isVectorTy() == DestTy->isVectorTy(), "IntToPtr type mismatch",
|
||||
&I);
|
||||
if (SrcTy->isVectorTy()) {
|
||||
VectorType *VSrc = cast<VectorType>(SrcTy);
|
||||
VectorType *VDest = cast<VectorType>(DestTy);
|
||||
Assert(VSrc->getNumElements() == VDest->getNumElements(),
|
||||
auto *VSrc = cast<VectorType>(SrcTy);
|
||||
auto *VDest = cast<VectorType>(DestTy);
|
||||
Assert(VSrc->getElementCount() == VDest->getElementCount(),
|
||||
"IntToPtr Vector width mismatch", &I);
|
||||
}
|
||||
visitInstruction(I);
|
||||
|
|
Loading…
Reference in New Issue