summaryrefslogtreecommitdiff
path: root/test/esan
diff options
context:
space:
mode:
authorQin Zhao <zhaoqin@google.com>2016-06-03 20:48:17 +0000
committerQin Zhao <zhaoqin@google.com>2016-06-03 20:48:17 +0000
commit1a0b98664125d401d49db90ded4a64dd44a633fb (patch)
tree1f5fb1ca33708560e4f2e776ca54b474b20d05a3 /test/esan
parent5910fcc58ab4ab0f1d4bfc8b1fca759a08a7b3e1 (diff)
[esan|cfrag] Compute the struct field access difference ratio
Summary: Computes the struct field access variation based on each field access count. Adds a flag to control the report thresholds. Updates struct-simple.cpp with variance report output. Reviewers: aizatsky Subscribers: kubabrecka, zhaoqin, llvm-commits, eugenis, vitalybuka, kcc, bruening Differential Revision: http://reviews.llvm.org/D20914 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@271734 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/esan')
-rw-r--r--test/esan/TestCases/struct-simple.cpp32
-rw-r--r--test/esan/TestCases/verbose-simple.c2
2 files changed, 32 insertions, 2 deletions
diff --git a/test/esan/TestCases/struct-simple.cpp b/test/esan/TestCases/struct-simple.cpp
index 560f79cb6..0e6dbab5c 100644
--- a/test/esan/TestCases/struct-simple.cpp
+++ b/test/esan/TestCases/struct-simple.cpp
@@ -138,22 +138,52 @@ int main(int argc, char **argv) {
return 0;
// CHECK: in esan::finalizeLibrary
// CHECK-NEXT: in esan::finalizeCacheFrag
- // CHECK-NEXT: {{.*}}EfficiencySanitizer is not finished: nothing yet to report
// CHECK-NEXT: in esan::processCompilationUnitExit
// CHECK-NEXT: in esan::processCacheFragCompilationUnitExit: {{.*}}struct-simple.cpp with 5 class(es)/struct(s)
// CHECK-NEXT: Unregister class.C#3#14#13#13: 3 fields
+ // CHECK-NEXT: {{.*}} class C
+ // CHECK-NEXT: {{.*}} count = 5, ratio = 3
+ // CHECK-NEXT: {{.*}} # 0: count = 2, type = %struct.anon = type { i32, i32 }
+ // CHECK-NEXT: {{.*}} # 1: count = 2, type = %union.anon = type { double }
+ // CHECK-NEXT: {{.*}} # 2: count = 1, type = [10 x i8]
// CHECK-NEXT: Unregister struct.anon#2#11#11: 2 fields
+ // CHECK-NEXT: {{.*}} struct anon
+ // CHECK-NEXT: {{.*}} count = 2, ratio = 1
+ // CHECK-NEXT: {{.*}} # 0: count = 1, type = i32
+ // CHECK-NEXT: {{.*}} # 1: count = 1, type = i32
// CHECK-NEXT: Unregister union.anon#1#3: 1 fields
// CHECK-NEXT: Unregister struct.S#2#11#11: 2 fields
+ // CHECK-NEXT: {{.*}} struct S
+ // CHECK-NEXT: {{.*}} count = 2, ratio = 2
+ // CHECK-NEXT: {{.*}} # 0: count = 2, type = i32
+ // CHECK-NEXT: {{.*}} # 1: count = 0, type = i32
// CHECK-NEXT: Unregister struct.D#3#11#11#11: 3 fields
+ // CHECK-NEXT: {{.*}} struct D
+ // CHECK-NEXT: {{.*}} count = 2, ratio = 2
+ // CHECK-NEXT: {{.*}} # 0: count = 1, type = i32
+ // CHECK-NEXT: {{.*}} # 1: count = 1, type = i32
+ // CHECK-NEXT: {{.*}} # 2: count = 0, type = i32
// CHECK-NEXT: in esan::processCompilationUnitExit
// CHECK-NEXT: in esan::processCacheFragCompilationUnitExit: {{.*}}struct-simple.cpp with 0 class(es)/struct(s)
// CHECK-NEXT: in esan::processCompilationUnitExit
// CHECK-NEXT: in esan::processCacheFragCompilationUnitExit: {{.*}}struct-simple.cpp with 5 class(es)/struct(s)
// CHECK-NEXT: Unregister struct.A#2#11#11: 2 fields
+ // CHECK-NEXT: {{.*}} struct A
+ // CHECK-NEXT: {{.*}} count = 2049, ratio = 2048
+ // CHECK-NEXT: {{.*}} # 0: count = 2048, type = i32
+ // CHECK-NEXT: {{.*}} # 1: count = 1, type = i32
// CHECK-NEXT: Unregister struct.B#2#3#2: 2 fields
+ // CHECK-NEXT: {{.*}} struct B
+ // CHECK-NEXT: {{.*}} count = 2097153, ratio = 2097152
+ // CHECK-NEXT: {{.*}} # 0: count = 1, type = float
+ // CHECK-NEXT: {{.*}} # 1: count = 2097152, type = double
// CHECK-NEXT: Unregister union.U#1#3: 1 fields
// CHECK-NEXT: Duplicated struct.S#2#11#11: 2 fields
// CHECK-NEXT: Unregister struct.D#2#11#11: 2 fields
+ // CHECK-NEXT: {{.*}} struct D
+ // CHECK-NEXT: {{.*}} count = 1, ratio = 1
+ // CHECK-NEXT: {{.*}} # 0: count = 1, type = i32
+ // CHECK-NEXT: {{.*}} # 1: count = 0, type = i32
+ // CHECK-NEXT: {{.*}}EfficiencySanitizer: total struct field access count = 2099214
}
#endif // MAIN
diff --git a/test/esan/TestCases/verbose-simple.c b/test/esan/TestCases/verbose-simple.c
index 263fa36a1..0d867bf55 100644
--- a/test/esan/TestCases/verbose-simple.c
+++ b/test/esan/TestCases/verbose-simple.c
@@ -9,6 +9,6 @@ int main(int argc, char **argv) {
// CHECK-NEXT: Shadow #1: [124000000000-12c000000000) (512GB)
// CHECK-NEXT: Shadow #2: [148000000000-150000000000) (512GB)
// CHECK-NEXT: in esan::finalizeLibrary
- // CHECK-NEXT: ==verbose-simple{{.*}}EfficiencySanitizer is not finished: nothing yet to report
+ // CHECK-NEXT: ==verbose-simple{{.*}}EfficiencySanitizer: total struct field access count = 0
return 0;
}