Skip to content

Commit 69b9ddc

Browse files
[Analysis] Restore the call to reserve (#136215)
commit 47d8fec Author: Kazu Hirata <kazu@google.com> Date: Wed Apr 16 19:30:01 2025 -0700 has removed the call to reserve here. This patch restores it as std::vector::insert, called by llvm::append_range, may not be able to deduce the size of the range. For example, std::vector in libc++ distinguishes has two versions of std::vector::insert depending on whether the iterator is an input iterator or a foward iterator.
1 parent 209d8c8 commit 69b9ddc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,6 +1159,7 @@ void BlockFrequencyInfoImpl<BT>::setBlockFreq(const BlockT *BB,
11591159

11601160
template <class BT> void BlockFrequencyInfoImpl<BT>::initializeRPOT() {
11611161
const BlockT *Entry = &F->front();
1162+
RPOT.reserve(F->size());
11621163
llvm::append_range(RPOT, post_order(Entry));
11631164
std::reverse(RPOT.begin(), RPOT.end());
11641165

0 commit comments

Comments
 (0)