[SVE] Remove getNumElements() calls in visitGetElementPtrInst

Replace calls to getNumElements() with getElementCount() in order
to avoid warnings for scalable vectors. The warnings were discovered
by this existing test:

  test/CodeGen/AArch64/sve-gep.ll

Differential revision: https://reviews.llvm.org/D80782
This commit is contained in:
David Sherwood 2020-05-28 16:33:44 +01:00
parent 41928c97b6
commit 0609704760
1 changed files with 3 additions and 3 deletions

View File

@ -3429,16 +3429,16 @@ void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
if (auto *GEPVTy = dyn_cast<VectorType>(GEP.getType())) {
// Additional checks for vector GEPs.
unsigned GEPWidth = GEPVTy->getNumElements();
ElementCount GEPWidth = GEPVTy->getElementCount();
if (GEP.getPointerOperandType()->isVectorTy())
Assert(
GEPWidth ==
cast<VectorType>(GEP.getPointerOperandType())->getNumElements(),
cast<VectorType>(GEP.getPointerOperandType())->getElementCount(),
"Vector GEP result width doesn't match operand's", &GEP);
for (Value *Idx : Idxs) {
Type *IndexTy = Idx->getType();
if (auto *IndexVTy = dyn_cast<VectorType>(IndexTy)) {
unsigned IndexWidth = IndexVTy->getNumElements();
ElementCount IndexWidth = IndexVTy->getElementCount();
Assert(IndexWidth == GEPWidth, "Invalid GEP index vector width", &GEP);
}
Assert(IndexTy->isIntOrIntVectorTy(),