[llvm] 93e8cd2 - [IR] Remove NumElements tracking from GEP type iterator

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 19 02:50:26 PST 2022


Author: Nikita Popov
Date: 2022-01-19T11:50:15+01:00
New Revision: 93e8cd26857aa22c815ad553cbb631e06f2e662f

URL: https://github.com/llvm/llvm-project/commit/93e8cd26857aa22c815ad553cbb631e06f2e662f
DIFF: https://github.com/llvm/llvm-project/commit/93e8cd26857aa22c815ad553cbb631e06f2e662f.diff

LOG: [IR] Remove NumElements tracking from GEP type iterator

After ed0cdb29397ecd7d03579b846360906081d80aea, this is no longer
used by anything, and shouldn't be used by anything.

Added: 
    

Modified: 
    llvm/include/llvm/IR/GetElementPtrTypeIterator.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/GetElementPtrTypeIterator.h b/llvm/include/llvm/IR/GetElementPtrTypeIterator.h
index ed854e458da2..1fa996229749 100644
--- a/llvm/include/llvm/IR/GetElementPtrTypeIterator.h
+++ b/llvm/include/llvm/IR/GetElementPtrTypeIterator.h
@@ -32,8 +32,6 @@ class generic_gep_type_iterator {
 
   ItTy OpIt;
   PointerUnion<StructType *, Type *> CurTy;
-  enum : uint64_t { Unbounded = -1ull };
-  uint64_t NumElements = Unbounded;
 
   generic_gep_type_iterator() = default;
 
@@ -79,16 +77,11 @@ class generic_gep_type_iterator {
 
   generic_gep_type_iterator &operator++() { // Preincrement
     Type *Ty = getIndexedType();
-    if (auto *ATy = dyn_cast<ArrayType>(Ty)) {
+    if (auto *ATy = dyn_cast<ArrayType>(Ty))
       CurTy = ATy->getElementType();
-      NumElements = ATy->getNumElements();
-    } else if (auto *VTy = dyn_cast<VectorType>(Ty)) {
+    else if (auto *VTy = dyn_cast<VectorType>(Ty))
       CurTy = VTy->getElementType();
-      if (isa<ScalableVectorType>(VTy))
-        NumElements = Unbounded;
-      else
-        NumElements = cast<FixedVectorType>(VTy)->getNumElements();
-    } else
+    else
       CurTy = dyn_cast<StructType>(Ty);
     ++OpIt;
     return *this;
@@ -123,15 +116,6 @@ class generic_gep_type_iterator {
   StructType *getStructTypeOrNull() const {
     return CurTy.dyn_cast<StructType *>();
   }
-
-  bool isBoundedSequential() const {
-    return isSequential() && NumElements != Unbounded;
-  }
-
-  uint64_t getSequentialNumElements() const {
-    assert(isBoundedSequential());
-    return NumElements;
-  }
 };
 
   using gep_type_iterator = generic_gep_type_iterator<>;


        


More information about the llvm-commits mailing list