[llvm] a3a7826 - [mlgo] Disable accounting upon ForceStop

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 14:26:30 PDT 2022


Author: Jin Xin Ng
Date: 2022-06-08T14:26:06-07:00
New Revision: a3a7826d823a4c5c01357b79b5c179aeb78fb3c1

URL: https://github.com/llvm/llvm-project/commit/a3a7826d823a4c5c01357b79b5c179aeb78fb3c1
DIFF: https://github.com/llvm/llvm-project/commit/a3a7826d823a4c5c01357b79b5c179aeb78fb3c1.diff

LOG: [mlgo] Disable accounting upon ForceStop

Once ForceStop is set to true, we only return positive inlining advice when it is mandatory; There is no need for further node/edge accounting.

Reviewed By: mtrofin

Differential Revision: https://reviews.llvm.org/D127245

Added: 
    

Modified: 
    llvm/lib/Analysis/MLInlineAdvisor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/MLInlineAdvisor.cpp b/llvm/lib/Analysis/MLInlineAdvisor.cpp
index b3bfe5efb401..2c660f3eccdd 100644
--- a/llvm/lib/Analysis/MLInlineAdvisor.cpp
+++ b/llvm/lib/Analysis/MLInlineAdvisor.cpp
@@ -133,6 +133,8 @@ unsigned MLInlineAdvisor::getInitialFunctionLevel(const Function &F) const {
 }
 
 void MLInlineAdvisor::onPassEntry() {
+  if (ForceStop)
+    return;
   FPICache.clear();
   // Function passes executed between InlinerPass runs may have changed the
   // module-wide features.
@@ -174,7 +176,7 @@ void MLInlineAdvisor::onPassEntry() {
 void MLInlineAdvisor::onPassExit(LazyCallGraph::SCC *LastSCC) {
   // No need to keep this around - function passes will invalidate it.
   FPICache.clear();
-  if (!LastSCC)
+  if (!LastSCC || ForceStop)
     return;
   // Keep track of the nodes and edges we last saw. Then, in onPassEntry,
   // we update the node count and edge count from the subset of these nodes that


        


More information about the llvm-commits mailing list