[llvm] [llvm] Use llvm::append_range (NFC) (PR #136066)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 18 07:59:13 PDT 2025
kuhar wrote:
> I just looked at what SmallVector::insert() on iterators does, and I found this gem:
>
> https://github.com/llvm/llvm-project/blob/a99c978d1b35e30d9a0fe9db68b91e9f2815c8e9/llvm/include/llvm/ADT/SmallVector.h#L889
>
> So we're calling `std::distance()`, but only requiring an input iterator. If it's not a random access iterator, insert() is going to walk the whole iterator twice, which is very expensive for iterators like PostOrderIterator.
Gah, this is bad, let me see if this is fixable based on iterator categories -- we don't have to reserve for all of them.
Until then, should we revert this?
https://github.com/llvm/llvm-project/pull/136066
More information about the llvm-commits
mailing list