[llvm] 0609704 - [SVE] Remove getNumElements() calls in visitGetElementPtrInst

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 07:27:03 PDT 2020


Author: David Sherwood
Date: 2020-05-29T15:26:44+01:00
New Revision: 0609704760d0a94cccdbd243d0d750d74ee6c459

URL: https://github.com/llvm/llvm-project/commit/0609704760d0a94cccdbd243d0d750d74ee6c459
DIFF: https://github.com/llvm/llvm-project/commit/0609704760d0a94cccdbd243d0d750d74ee6c459.diff

LOG: [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

Added: 
    

Modified: 
    llvm/lib/IR/Verifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index cb96c7ae515a..677dc0210256 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -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(),


        


More information about the llvm-commits mailing list