[llvm] [MLInliner] Simplify NodeCount bookkeeping (PR #96576)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 14:46:19 PDT 2024
mtrofin wrote:
> so thinking about this a bit more, it's harder to keep track of the number of live functions after #94815. you can look at `CGSCCUpdateResult::DeadFunctions` (which we don't currently pass to the InlineAdvisor, but we probably could).
>
> pre-#94815, with this patch, we can't detect if another CGSCC pass will come and delete a function. currently that doesn't matter since the inliner is the only CGSCC pass that deletes functions, but I believe the current logic does allow the inline advisor to detect if another CGSCC pass deletes a function.
>
> is there any reason we don't just use `Module.getFunctions().size()` for `NodeCount`?
Hmmm... good question! Can't think of a reason, and looking at the history, it seems we always did manual accounting. One possibility may be that at a point we needed to delay `delete`-ing `Function`s to the very end of inlining over the whole Module, but we're past that now.
We'd just need to remove the # of declared ones, because NodeCount is defined only - would that (the # declared) be a constant that can be determined upfront at advisor construction time?
https://github.com/llvm/llvm-project/pull/96576
More information about the llvm-commits
mailing list