-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[MLInliner] Keep track of deleted functions #97348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
As opposed to using Node::isDead(), which is no longer accurate after llvm#94815. This is only used in diagnostics.
@llvm/pr-subscribers-mlgo @llvm/pr-subscribers-llvm-analysis Author: Arthur Eubanks (aeubanks) ChangesAs opposed to using Node::isDead(), which is no longer accurate after #94815. This is only used in diagnostics. Full diff: https://github.com/llvm/llvm-project/pull/97348.diff 2 Files Affected:
diff --git a/llvm/include/llvm/Analysis/MLInlineAdvisor.h b/llvm/include/llvm/Analysis/MLInlineAdvisor.h
index 2aa077fe0e035..0333f457c1a2d 100644
--- a/llvm/include/llvm/Analysis/MLInlineAdvisor.h
+++ b/llvm/include/llvm/Analysis/MLInlineAdvisor.h
@@ -89,6 +89,7 @@ class MLInlineAdvisor : public InlineAdvisor {
int32_t CurrentIRSize = 0;
llvm::SmallPtrSet<const LazyCallGraph::Node *, 1> NodesInLastSCC;
DenseSet<const LazyCallGraph::Node *> AllNodes;
+ DenseSet<Function *> DeadFunctions;
bool ForceStop = false;
ProfileSummaryInfo &PSI;
};
diff --git a/llvm/lib/Analysis/MLInlineAdvisor.cpp b/llvm/lib/Analysis/MLInlineAdvisor.cpp
index 652f0d994b29c..8131acb3f0df3 100644
--- a/llvm/lib/Analysis/MLInlineAdvisor.cpp
+++ b/llvm/lib/Analysis/MLInlineAdvisor.cpp
@@ -311,11 +311,13 @@ void MLInlineAdvisor::onSuccessfulInlining(const MLInlineAdvice &Advice,
int64_t NewCallerAndCalleeEdges =
getCachedFPI(*Caller).DirectCallsToDefinedFunctions;
- if (CalleeWasDeleted)
+ if (CalleeWasDeleted) {
--NodeCount;
- else
+ DeadFunctions.insert(Callee);
+ } else {
NewCallerAndCalleeEdges +=
getCachedFPI(*Callee).DirectCallsToDefinedFunctions;
+ }
EdgeCount += (NewCallerAndCalleeEdges - Advice.CallerAndCalleeEdges);
assert(CurrentIRSize >= 0 && EdgeCount >= 0 && NodeCount >= 0);
}
@@ -493,7 +495,9 @@ void MLInlineAdvisor::print(raw_ostream &OS) const {
OS << "\n";
OS << "[MLInlineAdvisor] FuncLevels:\n";
for (auto I : FunctionLevels)
- OS << (I.first->isDead() ? "<deleted>" : I.first->getFunction().getName())
+ OS << (DeadFunctions.contains(&I.first->getFunction())
+ ? "<deleted>"
+ : I.first->getFunction().getName())
<< " : " << I.second << "\n";
OS << "\n";
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/51/builds/773 Here is the relevant piece of the build log for the reference:
|
As opposed to using Node::isDead(), which is no longer accurate after llvm#94815. This is only used in diagnostics.
As opposed to using Node::isDead(), which is no longer accurate after llvm#94815. This is only used in diagnostics.
As opposed to using Node::isDead(), which is no longer accurate after This is only used in diagnostics. (cherry picked from commit ebdb6f4)
As opposed to using Node::isDead(), which is no longer accurate after This is only used in diagnostics. (cherry picked from commit ebdb6f4)
As opposed to using Node::isDead(), which is no longer accurate after This is only used in diagnostics. (cherry picked from commit ebdb6f4)
As opposed to using Node::isDead(), which is no longer accurate after This is only used in diagnostics. (cherry picked from commit ebdb6f4)
As opposed to using Node::isDead(), which is no longer accurate after #94815.
This is only used in diagnostics.