[PATCH] D80782: [SVE] Remove getNumElements() calls in visitGetElementPtrInst

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 29 02:08:38 PDT 2020


david-arm created this revision.
david-arm added reviewers: sdesmalen, c-rhodes, ctetreau.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80782

Files:
  llvm/lib/IR/Verifier.cpp


Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -3429,16 +3429,16 @@
 
   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(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80782.267145.patch
Type: text/x-patch
Size: 1104 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200529/6947ecc4/attachment-0001.bin>


More information about the llvm-commits mailing list