[llvm] 06ca52e - [InlineOrder] Fix InlineOrder erase_if implementation (#78684)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 20 14:22:35 PST 2024
Author: Vincent Lee
Date: 2024-01-20T14:22:31-08:00
New Revision: 06ca52e25226d406a3e384953abd12955f42ac84
URL: https://github.com/llvm/llvm-project/commit/06ca52e25226d406a3e384953abd12955f42ac84
DIFF: https://github.com/llvm/llvm-project/commit/06ca52e25226d406a3e384953abd12955f42ac84.diff
LOG: [InlineOrder] Fix InlineOrder erase_if implementation (#78684)
The InlineOrder Heap stores a CallBase ptr and InlineHistoryID pair.
When running the `erase_if` method, InlineHistoryID is always returned
with 0. Instead, we should be retrieving it from the `InlineHistoryMap`
(similar to what is done in the `pop` implementation).
This change is completely harmless because no one is using
InlineHistoryID right now as part of the `erase_if` implementation which
is currently only used in the ModuleInliner.
Added:
Modified:
llvm/lib/Analysis/InlineOrder.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineOrder.cpp b/llvm/lib/Analysis/InlineOrder.cpp
index d6acafdc6ab8bc..09fc4f9a00f49c 100644
--- a/llvm/lib/Analysis/InlineOrder.cpp
+++ b/llvm/lib/Analysis/InlineOrder.cpp
@@ -262,7 +262,7 @@ class PriorityInlineOrder : public InlineOrder<std::pair<CallBase *, int>> {
void erase_if(function_ref<bool(T)> Pred) override {
auto PredWrapper = [=](CallBase *CB) -> bool {
- return Pred(std::make_pair(CB, 0));
+ return Pred(std::make_pair(CB, InlineHistoryMap[CB]));
};
llvm::erase_if(Heap, PredWrapper);
std::make_heap(Heap.begin(), Heap.end(), isLess);
More information about the llvm-commits
mailing list