summaryrefslogtreecommitdiffstats
path: root/polly/lib/Analysis/ScopDetection.cpp
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2017-08-22 17:09:51 +0000
committerMichael Kruse <llvm@meinersbur.de>2017-08-22 17:09:51 +0000
commit5b228bbb1241f7e0c62b54236c5299a7207d5125 (patch)
tree08b3236d0cdd2f81f76a0e4aacb86751460aa945 /polly/lib/Analysis/ScopDetection.cpp
parent9cbbacb910312f86fef2d17e4d79bfd93a42a51b (diff)
downloadbcm5719-llvm-5b228bbb1241f7e0c62b54236c5299a7207d5125.tar.gz
bcm5719-llvm-5b228bbb1241f7e0c62b54236c5299a7207d5125.zip
[ScopDetection] Add stat for total number of loops.
The total number of loops is useful as a baseline comparing how many loops have been optimized in different configurations. llvm-svn: 311469
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 6b5ed8408e0..d6c9849b90e 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -212,6 +212,8 @@ StringRef polly::PollySkipFnAttr = "polly.skip.fn";
//===----------------------------------------------------------------------===//
// Statistics.
+STATISTIC(NumTotalLoops, "Number of loops (in- or out of scops, in any "
+ "function processed by Polly)");
STATISTIC(NumScopRegions, "Number of scops");
STATISTIC(NumLoopsInScop, "Number of loops in scops");
STATISTIC(NumScopsDepthOne, "Number of scops with maximal loop depth 1");
@@ -303,6 +305,17 @@ static bool doesStringMatchAnyRegex(StringRef Str,
//===----------------------------------------------------------------------===//
// ScopDetection.
+static void countTotalLoops(Loop *L) {
+ NumTotalLoops++;
+ for (Loop *SubLoop : L->getSubLoops())
+ countTotalLoops(SubLoop);
+}
+
+static void countTotalLoops(LoopInfo &LI) {
+ for (Loop *L : LI)
+ countTotalLoops(L);
+}
+
ScopDetection::ScopDetection(Function &F, const DominatorTree &DT,
ScalarEvolution &SE, LoopInfo &LI, RegionInfo &RI,
AliasAnalysis &AA, OptimizationRemarkEmitter &ORE)
@@ -325,6 +338,7 @@ ScopDetection::ScopDetection(Function &F, const DominatorTree &DT,
findScops(*TopRegion);
+ countTotalLoops(LI);
NumScopRegions += ValidRegions.size();
// Prune non-profitable regions.
OpenPOWER on IntegriCloud