[all-commits] [llvm/llvm-project] f65cd0: [ModuleInliner] Remove an extraneous pair of std::...
Kazu Hirata via All-commits
all-commits at lists.llvm.org
Tue Oct 24 09:25:46 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f65cd04ac1c99dcecede19061dbc78352a1bca47
https://github.com/llvm/llvm-project/commit/f65cd04ac1c99dcecede19061dbc78352a1bca47
Author: Kazu Hirata <kazu at google.com>
Date: 2023-10-24 (Tue, 24 Oct 2023)
Changed paths:
M llvm/lib/Analysis/InlineOrder.cpp
Log Message:
-----------
[ModuleInliner] Remove an extraneous pair of std::push_heap and std::pop_heap (NFC) (#69672)
Immediately after the "while" loop in adjust, Heap.back() is
guaranteed to be the highest priority item for the current values of
Priorities. std::push_back() at the end of adjust moves the highest
priority item to Heap.front(), but std::pop_heap() in pop moves it
right back to Heap.back().
This roundtrip is wasteful. This patch removes the extraneous pair of
std::push_heap and std::pop_heap. This patch cuts down about 45% of
calls to std::push_heap and std::pop_heap in InlineOrder.cpp while
building clang with FDO+ThinLTO.
Strictly speaking, removing the pair of calls may change the order in
which call sites with identical priorities are removed from the
priority queue, but we do not need to worry about that.
Since the functionality of adjust becomes more like a smart version of
pop_heap, this patch renames adjust to pop_heap_adjust.
More information about the All-commits
mailing list