[llvm] [InlineOrder] Fix InlineOrder erase_if implementation (PR #78684)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 01:00:50 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Vincent Lee (thevinster)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/78684.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/InlineOrder.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/Analysis/InlineOrder.cpp b/llvm/lib/Analysis/InlineOrder.cpp
index d6acafdc6ab8bc6..09fc4f9a00f49cd 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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/78684
More information about the llvm-commits
mailing list