[ScopDetect / ScopInfo] Get statistics for scops without any loop correctly

Make sure we also counts scops not containing any loops.

llvm-svn: 330285
This commit is contained in:
Tobias Grosser 2018-04-18 20:03:36 +00:00
parent 16fe49a951
commit fcc3ad5d3c
3 changed files with 37 additions and 5 deletions

View File

@ -251,6 +251,7 @@ StringRef polly::PollySkipFnAttr = "polly.skip.fn";
STATISTIC(NumScopRegions, "Number of scops"); STATISTIC(NumScopRegions, "Number of scops");
STATISTIC(NumLoopsInScop, "Number of loops in scops"); STATISTIC(NumLoopsInScop, "Number of loops in scops");
STATISTIC(NumScopsDepthZero, "Number of scops with maximal loop depth 0");
STATISTIC(NumScopsDepthOne, "Number of scops with maximal loop depth 1"); STATISTIC(NumScopsDepthOne, "Number of scops with maximal loop depth 1");
STATISTIC(NumScopsDepthTwo, "Number of scops with maximal loop depth 2"); STATISTIC(NumScopsDepthTwo, "Number of scops with maximal loop depth 2");
STATISTIC(NumScopsDepthThree, "Number of scops with maximal loop depth 3"); STATISTIC(NumScopsDepthThree, "Number of scops with maximal loop depth 3");
@ -262,6 +263,8 @@ STATISTIC(NumProfScopRegions, "Number of scops (profitable scops only)");
STATISTIC(NumLoopsInProfScop, STATISTIC(NumLoopsInProfScop,
"Number of loops in scops (profitable scops only)"); "Number of loops in scops (profitable scops only)");
STATISTIC(NumLoopsOverall, "Number of total loops"); STATISTIC(NumLoopsOverall, "Number of total loops");
STATISTIC(NumProfScopsDepthZero,
"Number of scops with maximal loop depth 0 (profitable scops only)");
STATISTIC(NumProfScopsDepthOne, STATISTIC(NumProfScopsDepthOne,
"Number of scops with maximal loop depth 1 (profitable scops only)"); "Number of scops with maximal loop depth 1 (profitable scops only)");
STATISTIC(NumProfScopsDepthTwo, STATISTIC(NumProfScopsDepthTwo,
@ -1757,7 +1760,9 @@ static void updateLoopCountStatistic(ScopDetection::LoopStats Stats,
NumLoopsInScop += Stats.NumLoops; NumLoopsInScop += Stats.NumLoops;
MaxNumLoopsInScop = MaxNumLoopsInScop =
std::max(MaxNumLoopsInScop.getValue(), (unsigned)Stats.NumLoops); std::max(MaxNumLoopsInScop.getValue(), (unsigned)Stats.NumLoops);
if (Stats.MaxDepth == 1) if (Stats.MaxDepth == 0)
NumScopsDepthZero++;
else if (Stats.MaxDepth == 1)
NumScopsDepthOne++; NumScopsDepthOne++;
else if (Stats.MaxDepth == 2) else if (Stats.MaxDepth == 2)
NumScopsDepthTwo++; NumScopsDepthTwo++;
@ -1773,7 +1778,9 @@ static void updateLoopCountStatistic(ScopDetection::LoopStats Stats,
NumLoopsInProfScop += Stats.NumLoops; NumLoopsInProfScop += Stats.NumLoops;
MaxNumLoopsInProfScop = MaxNumLoopsInProfScop =
std::max(MaxNumLoopsInProfScop.getValue(), (unsigned)Stats.NumLoops); std::max(MaxNumLoopsInProfScop.getValue(), (unsigned)Stats.NumLoops);
if (Stats.MaxDepth == 1) if (Stats.MaxDepth == 0)
NumProfScopsDepthZero++;
else if (Stats.MaxDepth == 1)
NumProfScopsDepthOne++; NumProfScopsDepthOne++;
else if (Stats.MaxDepth == 2) else if (Stats.MaxDepth == 2)
NumProfScopsDepthTwo++; NumProfScopsDepthTwo++;

View File

@ -126,6 +126,7 @@ STATISTIC(NumLoopsInScop, "Number of loops in scops");
STATISTIC(NumBoxedLoops, "Number of boxed loops in SCoPs after ScopInfo"); STATISTIC(NumBoxedLoops, "Number of boxed loops in SCoPs after ScopInfo");
STATISTIC(NumAffineLoops, "Number of affine loops in SCoPs after ScopInfo"); STATISTIC(NumAffineLoops, "Number of affine loops in SCoPs after ScopInfo");
STATISTIC(NumScopsDepthZero, "Number of scops with maximal loop depth 0");
STATISTIC(NumScopsDepthOne, "Number of scops with maximal loop depth 1"); STATISTIC(NumScopsDepthOne, "Number of scops with maximal loop depth 1");
STATISTIC(NumScopsDepthTwo, "Number of scops with maximal loop depth 2"); STATISTIC(NumScopsDepthTwo, "Number of scops with maximal loop depth 2");
STATISTIC(NumScopsDepthThree, "Number of scops with maximal loop depth 3"); STATISTIC(NumScopsDepthThree, "Number of scops with maximal loop depth 3");
@ -5001,7 +5002,9 @@ void updateLoopCountStatistic(ScopDetection::LoopStats Stats,
MaxNumLoopsInScop = MaxNumLoopsInScop =
std::max(MaxNumLoopsInScop.getValue(), (unsigned)Stats.NumLoops); std::max(MaxNumLoopsInScop.getValue(), (unsigned)Stats.NumLoops);
if (Stats.MaxDepth == 1) if (Stats.MaxDepth == 0)
NumScopsDepthZero++;
else if (Stats.MaxDepth == 1)
NumScopsDepthOne++; NumScopsDepthOne++;
else if (Stats.MaxDepth == 2) else if (Stats.MaxDepth == 2)
NumScopsDepthTwo++; NumScopsDepthTwo++;

View File

@ -7,17 +7,24 @@
; CHECK-DAG: 11 polly-detect - Number of loops in scops (profitable scops only) ; CHECK-DAG: 11 polly-detect - Number of loops in scops (profitable scops only)
; CHECK-DAG: 11 polly-detect - Number of loops in scops ; CHECK-DAG: 11 polly-detect - Number of loops in scops
; CHECK-DAG: 11 polly-detect - Number of total loops ; CHECK-DAG: 11 polly-detect - Number of total loops
; CHECK-DAG: 5 polly-detect - Number of scops (profitable scops only) ; CHECK-DAG: 6 polly-detect - Number of scops (profitable scops only)
; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 4 (profitable scops only) ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 4 (profitable scops only)
; CHECK-DAG: 2 polly-detect - Number of scops with maximal loop depth 1 (profitable scops only) ; CHECK-DAG: 2 polly-detect - Number of scops with maximal loop depth 1 (profitable scops only)
; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 3 (profitable scops only) ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 3 (profitable scops only)
; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 2 (profitable scops only) ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 2 (profitable scops only)
; CHECK-DAG: 5 polly-detect - Number of scops ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 0 (profitable scops only)
; CHECK-DAG: 6 polly-detect - Number of scops
; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 4 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 4
; CHECK-DAG: 2 polly-detect - Number of scops with maximal loop depth 1 ; CHECK-DAG: 2 polly-detect - Number of scops with maximal loop depth 1
; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 3 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 3
; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 2 ; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 2
; CHECK-DAG: 1 polly-detect - Number of scops with maximal loop depth 0
; void foo_0d(float *A) {
; if (true)
; A[0] += i;
; }
;
; void foo_1d(float *A) { ; void foo_1d(float *A) {
; for (long i = 0; i < 1024; i++) ; for (long i = 0; i < 1024; i++)
; A[i] += i; ; A[i] += i;
@ -50,6 +57,21 @@
; } ; }
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @foo_0d(float* %A) {
bb:
br label %bb1
bb1:
br i1 true, label %exit, label %block
block:
store float 42.0, float* %A
br label %exit
exit:
ret void
}
define void @foo_1d(float* %A) { define void @foo_1d(float* %A) {
bb: bb:
br label %bb1 br label %bb1