Skip to content

Commit af928dd

Browse files
aeubanksanton-bannykh
authored andcommitted
[MLInliner] Keep track of deleted functions (llvm#97348)
As opposed to using Node::isDead(), which is no longer accurate after This is only used in diagnostics. (cherry picked from commit ebdb6f4)
1 parent ca77a5b commit af928dd

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

llvm/include/llvm/Analysis/MLInlineAdvisor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class MLInlineAdvisor : public InlineAdvisor {
8686
int32_t CurrentIRSize = 0;
8787
llvm::SmallPtrSet<const LazyCallGraph::Node *, 1> NodesInLastSCC;
8888
DenseSet<const LazyCallGraph::Node *> AllNodes;
89+
DenseSet<Function *> DeadFunctions;
8990
bool ForceStop = false;
9091
};
9192

llvm/lib/Analysis/MLInlineAdvisor.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,13 @@ void MLInlineAdvisor::onSuccessfulInlining(const MLInlineAdvice &Advice,
254254
int64_t NewCallerAndCalleeEdges =
255255
getCachedFPI(*Caller).DirectCallsToDefinedFunctions;
256256

257-
if (CalleeWasDeleted)
257+
if (CalleeWasDeleted) {
258258
--NodeCount;
259-
else
259+
DeadFunctions.insert(Callee);
260+
} else {
260261
NewCallerAndCalleeEdges +=
261262
getCachedFPI(*Callee).DirectCallsToDefinedFunctions;
263+
}
262264
EdgeCount += (NewCallerAndCalleeEdges - Advice.CallerAndCalleeEdges);
263265
assert(CurrentIRSize >= 0 && EdgeCount >= 0 && NodeCount >= 0);
264266
}

0 commit comments

Comments
 (0)