diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-09 13:28:42 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-12-09 13:28:42 +0000 |
| commit | b1c73532ee8997fe5dfbeb7d223027bdf99758a0 (patch) | |
| tree | 7d6e51c294ab6719475d660217aa0c0ad0526292 /llvm/lib/Analysis/InlineOrder.cpp | |
| parent | 7fa27ce4a07f19b07799a767fc29416f3b625afb (diff) | |
Diffstat (limited to 'llvm/lib/Analysis/InlineOrder.cpp')
| -rw-r--r-- | llvm/lib/Analysis/InlineOrder.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/llvm/lib/Analysis/InlineOrder.cpp b/llvm/lib/Analysis/InlineOrder.cpp index 3b85820d7b8f..d6acafdc6ab8 100644 --- a/llvm/lib/Analysis/InlineOrder.cpp +++ b/llvm/lib/Analysis/InlineOrder.cpp @@ -36,7 +36,7 @@ static cl::opt<InlinePriorityMode> UseInlinePriority( clEnumValN(InlinePriorityMode::ML, "ml", "Use ML."))); static cl::opt<int> ModuleInlinerTopPriorityThreshold( - "moudle-inliner-top-priority-threshold", cl::Hidden, cl::init(0), + "module-inliner-top-priority-threshold", cl::Hidden, cl::init(0), cl::desc("The cost threshold for call sites that get inlined without the " "cost-benefit analysis")); @@ -218,14 +218,15 @@ class PriorityInlineOrder : public InlineOrder<std::pair<CallBase *, int>> { // A call site could become less desirable for inlining because of the size // growth from prior inlining into the callee. This method is used to lazily // update the desirability of a call site if it's decreasing. It is only - // called on pop() or front(), not every time the desirability changes. When - // the desirability of the front call site decreases, an updated one would be - // pushed right back into the heap. For simplicity, those cases where - // the desirability of a call site increases are ignored here. - void adjust() { - while (updateAndCheckDecreased(Heap.front())) { - std::pop_heap(Heap.begin(), Heap.end(), isLess); + // called on pop(), not every time the desirability changes. When the + // desirability of the front call site decreases, an updated one would be + // pushed right back into the heap. For simplicity, those cases where the + // desirability of a call site increases are ignored here. + void pop_heap_adjust() { + std::pop_heap(Heap.begin(), Heap.end(), isLess); + while (updateAndCheckDecreased(Heap.back())) { std::push_heap(Heap.begin(), Heap.end(), isLess); + std::pop_heap(Heap.begin(), Heap.end(), isLess); } } @@ -251,13 +252,11 @@ public: T pop() override { assert(size() > 0); - adjust(); + pop_heap_adjust(); - CallBase *CB = Heap.front(); + 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; } @@ -317,4 +316,4 @@ llvm::getInlineOrder(FunctionAnalysisManager &FAM, const InlineParams &Params, M); } return getDefaultInlineOrder(FAM, Params, MAM, M); -}
\ No newline at end of file +} |
