[llvm] 3fb3df3 - [ModuleInliner] Use SmallVector::pop_back_val (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 18 13:04:51 PDT 2023
Author: Kazu Hirata
Date: 2023-10-18T13:04:46-07:00
New Revision: 3fb3df36eaeecaea59de42e3d3f4eec79c3aac4e
URL: https://github.com/llvm/llvm-project/commit/3fb3df36eaeecaea59de42e3d3f4eec79c3aac4e
DIFF: https://github.com/llvm/llvm-project/commit/3fb3df36eaeecaea59de42e3d3f4eec79c3aac4e.diff
LOG: [ModuleInliner] Use SmallVector::pop_back_val (NFC)
We can use std::pop_heap first and then retrieve the top priority item
with pop_back_val, saving one line of code.
Added:
Modified:
llvm/lib/Analysis/InlineOrder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineOrder.cpp b/llvm/lib/Analysis/InlineOrder.cpp
index b086ac15a207ed3..1bdb3b98bc8706c 100644
--- a/llvm/lib/Analysis/InlineOrder.cpp
+++ b/llvm/lib/Analysis/InlineOrder.cpp
@@ -255,11 +255,10 @@ class PriorityInlineOrder : public InlineOrder<std::pair<CallBase *, int>> {
assert(size() > 0);
adjust();
- CallBase *CB = Heap.front();
+ std::pop_heap(Heap.begin(), Heap.end(), isLess);
+ CallBase *CB = Heap.pop_back_val();
T Result = std::make_pair(CB, InlineHistoryMap[CB]);
InlineHistoryMap.erase(CB);
- std::pop_heap(Heap.begin(), Heap.end(), isLess);
- Heap.pop_back();
return Result;
}
More information about the llvm-commits
mailing list