Skip to content

MLIR: Block.getOperations().size() is O(N) #134703

@wsmoses

Description

@wsmoses
#5  llvm::simple_ilist<mlir::Operation>::size (this=0x555566edd530) at external/llvm-project/llvm/include/llvm/ADT/simple_ilist.h:142
142       [[nodiscard]] size_type size() const { return std::distance(begin(), end()); }
(gdb) down 
#4  0x0000555555fe3a96 in std::distance<llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, false, false, void, false, void>, false, true> > (__last=..., __first=...) at /usr/include/c++/13/bits/stl_iterator_base_funcs.h:151
151           return std::__distance(__first, __last,
(gdb) l
146         inline _GLIBCXX17_CONSTEXPR
147         typename iterator_traits<_InputIterator>::difference_type
148         distance(_InputIterator __first, _InputIterator __last)
149         {
150           // concept requirements -- taken care of in __distance
151           return std::__distance(__first, __last,
152                                  std::__iterator_category(__first));
153         }
154
155       template<typename _InputIterator, typename _Distance>
(gdb) down
#3  0x0000555555fe7f22 in std::__distance<llvm::ilist_iterator<llvm::ilist_detail::node_options<mlir::Operation, false, false, void, false, void>, false, true> > (__first=..., __last=...) at /usr/include/c++/13/bits/stl_iterator_base_funcs.h:90
90                ++__first;
(gdb) l
85            __glibcxx_function_requires(_InputIteratorConcept<_InputIterator>)
86
87            typename iterator_traits<_InputIterator>::difference_type __n = 0;
88            while (__first != __last)
89              {
90                ++__first;
91                ++__n;
92              }
93            return __n;
94          }
(gdb) 

cc @ftynse @chelini

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions