[PATCH] D145015: [PassBuilder] Always enable CountVisitsPass when stats are enabled

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 15:41:59 PST 2023


aeubanks created this revision.
aeubanks added a reviewer: asbirlea.
Herald added a subscriber: hiraditya.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Rather than having a separate flag.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145015

Files:
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/count-visits.ll


Index: llvm/test/Other/count-visits.ll
===================================================================
--- llvm/test/Other/count-visits.ll
+++ llvm/test/Other/count-visits.ll
@@ -2,8 +2,8 @@
 ; RUN: opt -passes=count-visits -stats 2>&1 -disable-output < %s | FileCheck %s --check-prefix=ONE
 ; RUN: opt -passes='cgscc(count-visits)' -stats 2>&1 -disable-output < %s | FileCheck %s --check-prefix=ONE
 ; RUN: opt -passes='cgscc(count-visits,instcombine)' -stats 2>&1 -disable-output < %s | FileCheck %s --check-prefix=TWO
-; RUN: opt -passes='default<O1>' -count-cgscc-max-visits -stats 2>&1 -disable-output < %s | FileCheck %s --check-prefix=PIPELINE
-; RUN: opt -passes='default<O3>' -count-cgscc-max-visits -stats 2>&1 -disable-output < %s | FileCheck %s --check-prefix=PIPELINE
+; RUN: opt -passes='default<O1>' -stats 2>&1 -disable-output < %s | FileCheck %s --check-prefix=PIPELINE
+; RUN: opt -passes='default<O3>' -stats 2>&1 -disable-output < %s | FileCheck %s --check-prefix=PIPELINE
 
 ; ONE: 1 count-visits - Max number of times we visited a function
 ; TWO: 2 count-visits - Max number of times we visited a function
Index: llvm/lib/Passes/PassBuilderPipelines.cpp
===================================================================
--- llvm/lib/Passes/PassBuilderPipelines.cpp
+++ llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -14,6 +14,7 @@
 ///
 //===----------------------------------------------------------------------===//
 
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/BasicAliasAnalysis.h"
 #include "llvm/Analysis/CGSCCPassManager.h"
@@ -253,11 +254,6 @@
     EnableMatrix("enable-matrix", cl::init(false), cl::Hidden,
                  cl::desc("Enable lowering of the matrix intrinsics"));
 
-static cl::opt<bool> CountCGSCCVisits(
-    "count-cgscc-max-visits", cl::init(false), cl::Hidden,
-    cl::desc("Keep track of the max number of times we visit a function in the "
-             "CGSCC pipeline as a statistic"));
-
 static cl::opt<bool> EnableConstraintElimination(
     "enable-constraint-elimination", cl::init(true), cl::Hidden,
     cl::desc(
@@ -318,7 +314,7 @@
 
   FunctionPassManager FPM;
 
-  if (CountCGSCCVisits)
+  if (AreStatisticsEnabled())
     FPM.addPass(CountVisitsPass());
 
   // Form SSA out of local memory accesses after breaking apart aggregates into
@@ -471,7 +467,7 @@
 
   FunctionPassManager FPM;
 
-  if (CountCGSCCVisits)
+  if (AreStatisticsEnabled())
     FPM.addPass(CountVisitsPass());
 
   // Form SSA out of local memory accesses after breaking apart aggregates into


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145015.501318.patch
Type: text/x-patch
Size: 2594 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230228/995cc1b0/attachment.bin>


More information about the llvm-commits mailing list