[PATCH] D134121: [ModuleInliner] Remove InlineOrder::front (NFC)
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 17 22:52:27 PDT 2022
kazu created this revision.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
InlineOrder::front is a remnant from the era when we had a nested
"while" loops in the module inliner, with the inner one grouping the
call sites with the same caller.
Now that we have a simple "while" loop draining the priority queue, we
can just use InlineOrder::pop.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D134121
Files:
llvm/include/llvm/Analysis/InlineOrder.h
llvm/lib/Analysis/InlineOrder.cpp
llvm/lib/Transforms/IPO/ModuleInliner.cpp
Index: llvm/lib/Transforms/IPO/ModuleInliner.cpp
===================================================================
--- llvm/lib/Transforms/IPO/ModuleInliner.cpp
+++ llvm/lib/Transforms/IPO/ModuleInliner.cpp
@@ -182,7 +182,11 @@
// Loop forward over all of the calls.
while (!Calls->empty()) {
- Function &F = *Calls->front().first->getCaller();
+ auto P = Calls->pop();
+ CallBase *CB = P.first;
+ const int InlineHistoryID = P.second;
+ Function &F = *CB->getCaller();
+ Function &Callee = *CB->getCalledFunction();
LLVM_DEBUG(dbgs() << "Inlining calls in: " << F.getName() << "\n"
<< " Function size: " << F.getInstructionCount()
@@ -192,11 +196,6 @@
return FAM.getResult<AssumptionAnalysis>(F);
};
- auto P = Calls->pop();
- CallBase *CB = P.first;
- const int InlineHistoryID = P.second;
- Function &Callee = *CB->getCalledFunction();
-
if (InlineHistoryID != -1 &&
inlineHistoryIncludes(&Callee, InlineHistoryID, InlineHistory)) {
setInlineRemark(*CB, "recursive");
Index: llvm/lib/Analysis/InlineOrder.cpp
===================================================================
--- llvm/lib/Analysis/InlineOrder.cpp
+++ llvm/lib/Analysis/InlineOrder.cpp
@@ -169,14 +169,6 @@
return Result;
}
- const_reference front() override {
- assert(size() > 0);
- adjust();
-
- CallBase *CB = Heap.front();
- return *InlineHistoryMap.find(CB);
- }
-
void erase_if(function_ref<bool(T)> Pred) override {
auto PredWrapper = [=](CallBase *CB) -> bool {
return Pred(std::make_pair(CB, 0));
Index: llvm/include/llvm/Analysis/InlineOrder.h
===================================================================
--- llvm/include/llvm/Analysis/InlineOrder.h
+++ llvm/include/llvm/Analysis/InlineOrder.h
@@ -29,8 +29,6 @@
virtual T pop() = 0;
- virtual const_reference front() = 0;
-
virtual void erase_if(function_ref<bool(T)> Pred) = 0;
bool empty() { return !size(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134121.461045.patch
Type: text/x-patch
Size: 2014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220918/7f02c23a/attachment.bin>
More information about the llvm-commits
mailing list