[llvm] [llvm] Use llvm::append_range (NFC) (PR #136066)

Jakub Kuderski via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 12:42:45 PDT 2025


================
@@ -1159,8 +1159,7 @@ void BlockFrequencyInfoImpl<BT>::setBlockFreq(const BlockT *BB,
 
 template <class BT> void BlockFrequencyInfoImpl<BT>::initializeRPOT() {
   const BlockT *Entry = &F->front();
-  RPOT.reserve(F->size());
-  std::copy(po_begin(Entry), po_end(Entry), std::back_inserter(RPOT));
+  llvm::append_range(RPOT, post_order(Entry));
----------------
kuhar wrote:

We could detect if the container type has `.reserve` and call it when available in `append_range`

https://github.com/llvm/llvm-project/pull/136066


More information about the llvm-commits mailing list