diff --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp index 948bc2435ab27..ab3a721d874a5 100644 --- a/llvm/lib/Analysis/CGSCCPassManager.cpp +++ b/llvm/lib/Analysis/CGSCCPassManager.cpp @@ -13,6 +13,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Statistic.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Analysis/LazyCallGraph.h" #include "llvm/IR/Constant.h" @@ -33,6 +34,8 @@ using namespace llvm; +STATISTIC(LargestCGSCC, "Number of functions in the largest SCC"); + // Explicit template instantiations and specialization definitions for core // template typedefs. namespace llvm { @@ -82,6 +85,8 @@ PassManagersize()); + PreservedAnalyses PassPA = Pass->run(*C, AM, G, UR); // Update the SCC if necessary. diff --git a/llvm/test/Other/largest-scc-stat.ll b/llvm/test/Other/largest-scc-stat.ll new file mode 100644 index 0000000000000..a24e426c31a00 --- /dev/null +++ b/llvm/test/Other/largest-scc-stat.ll @@ -0,0 +1,18 @@ +; REQUIRES: asserts +; RUN: opt -passes='no-op-cgscc' -disable-output -stats < %s 2>&1 | FileCheck %s --check-prefix=ONE +; RUN: opt -passes='cgscc(instcombine)' -disable-output -stats < %s 2>&1 | FileCheck %s --check-prefix=TWO + +; ONE: 1 cgscc - Number of functions in the largest SCC +; TWO: 2 cgscc - Number of functions in the largest SCC + +define void @f1() { + %f = bitcast ptr @f2 to ptr + call void %f() + ret void +} + +define void @f2() { + %f = bitcast ptr @f1 to ptr + call void %f() + ret void +}