summaryrefslogtreecommitdiff
path: root/test/profile/Linux
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:18:27 +0000
commit316d58822dada9440bd06ecfc758dcc2364d617c (patch)
treefe72ec2e6ce9a360dda74d9d57f7acdb0e3c39d6 /test/profile/Linux
parent0230fcf22fe7d19f03d981c9c2c59a3db0b72ea5 (diff)
Notes
Diffstat (limited to 'test/profile/Linux')
-rw-r--r--test/profile/Linux/comdat_rename.test6
-rw-r--r--test/profile/Linux/coverage_ctors.cpp8
-rw-r--r--test/profile/Linux/coverage_dtor.cpp4
-rw-r--r--test/profile/Linux/coverage_test.cpp26
-rw-r--r--test/profile/Linux/extern_template.test4
-rw-r--r--test/profile/Linux/instrprof-comdat.test2
-rw-r--r--test/profile/Linux/instrprof-cs.c35
-rw-r--r--test/profile/Linux/instrprof-set-filename-shared.test8
-rw-r--r--test/profile/Linux/lit.local.cfg1
9 files changed, 64 insertions, 30 deletions
diff --git a/test/profile/Linux/comdat_rename.test b/test/profile/Linux/comdat_rename.test
new file mode 100644
index 0000000000000..cd5c672de4f25
--- /dev/null
+++ b/test/profile/Linux/comdat_rename.test
@@ -0,0 +1,6 @@
+// RUN: rm -fr %t.prof
+// RUN: %clangxx_pgogen=%t.prof/ -o %t.gen -O2 %S/../Inputs/comdat_rename_1.cc %S/../Inputs/comdat_rename_2.cc
+// RUN: %run %t.gen
+// RUN: llvm-profdata merge -o %t.profdata %t.prof/
+// RUN: %clangxx_profuse=%t.profdata -O2 -emit-llvm -S %S/../Inputs/comdat_rename_1.cc -o - | FileCheck %S/../Inputs/comdat_rename_1.cc
+// RUN: %clangxx_profuse=%t.profdata -O2 -emit-llvm -S %S/../Inputs/comdat_rename_2.cc -o - | FileCheck %S/../Inputs/comdat_rename_2.cc
diff --git a/test/profile/Linux/coverage_ctors.cpp b/test/profile/Linux/coverage_ctors.cpp
index 317dcfe18b501..021d9df5e7347 100644
--- a/test/profile/Linux/coverage_ctors.cpp
+++ b/test/profile/Linux/coverage_ctors.cpp
@@ -15,9 +15,9 @@ struct Base {
};
struct Derived : public Base {
- Derived(const Derived &) = default; // CHECK: 2| [[@LINE]]| Derived(const Derived &) = default;
- Derived(Derived &&) = default; // CHECK: 1| [[@LINE]]| Derived(Derived &&) = default;
- Derived() = default; // CHECK: 1| [[@LINE]]| Derived() = default
+ Derived(const Derived &) = default; // CHECK: [[@LINE]]| 2| Derived(const Derived &) = default;
+ Derived(Derived &&) = default; // CHECK: [[@LINE]]| 1| Derived(Derived &&) = default;
+ Derived() = default; // CHECK: [[@LINE]]| 1| Derived() = default
};
Derived dd;
@@ -27,6 +27,6 @@ int main() {
Derived dd4(static_cast<Derived &&>(dd3));
if (dd.B != 0 || dd2.B != 5 || dd3.B != 10 || dd4.B != 20)
- return 1; // CHECK: 0| [[@LINE]]| return 1;
+ return 1; // CHECK: [[@LINE]]| 0| return 1;
return 0;
}
diff --git a/test/profile/Linux/coverage_dtor.cpp b/test/profile/Linux/coverage_dtor.cpp
index f35eb100fa12c..16415122040c9 100644
--- a/test/profile/Linux/coverage_dtor.cpp
+++ b/test/profile/Linux/coverage_dtor.cpp
@@ -12,7 +12,7 @@ struct Base {
struct Derived : public Base {
Derived(int K) : Base(K) {}
- ~Derived() = default; // CHECK: 2| [[@LINE]]| ~Derived() = default;
+ ~Derived() = default; // CHECK: [[@LINE]]| 2| ~Derived() = default;
};
int main() {
@@ -21,6 +21,6 @@ int main() {
Derived dd2(90);
}
if (g != 0)
- return 1; // CHECK: 0| [[@LINE]]| return 1;
+ return 1; // CHECK: [[@LINE]]| 0| return 1;
return 0;
}
diff --git a/test/profile/Linux/coverage_test.cpp b/test/profile/Linux/coverage_test.cpp
index 9b4ba073cf0a6..db9a14e26e3c8 100644
--- a/test/profile/Linux/coverage_test.cpp
+++ b/test/profile/Linux/coverage_test.cpp
@@ -17,19 +17,19 @@
// RUN: llvm-profdata merge -o %t.pie.profdata %t.pie.profraw
// RUN: llvm-cov show %t.pie -instr-profile %t.pie.profdata -filename-equivalence 2>&1 | FileCheck %s
-void foo(bool cond) { // CHECK: 1| [[@LINE]]|void foo(
- if (cond) { // CHECK: 1| [[@LINE]]| if (cond) {
- } // CHECK: 0| [[@LINE]]| }
-} // CHECK: 1| [[@LINE]]|}
-void bar() { // CHECK: 1| [[@LINE]]|void bar() {
-} // CHECK: 1| [[@LINE]]|}
-void func() { // CHECK: 0| [[@LINE]]|void func(
-} // CHECK: 0| [[@LINE]]|}
-int main() { // CHECK: 1| [[@LINE]]|int main(
- foo(false); // CHECK: 1| [[@LINE]]| foo(
- bar(); // CHECK: 1| [[@LINE]]| bar(
- return 0; // CHECK: 1| [[@LINE]]| return
-} // CHECK: 1| [[@LINE]]|}
+void foo(bool cond) { // CHECK: [[@LINE]]| 1|void foo(
+ if (cond) { // CHECK: [[@LINE]]| 1| if (cond) {
+ } // CHECK: [[@LINE]]| 0| }
+} // CHECK: [[@LINE]]| 1|}
+void bar() { // CHECK: [[@LINE]]| 1|void bar() {
+} // CHECK: [[@LINE]]| 1|}
+void func() { // CHECK: [[@LINE]]| 0|void func(
+} // CHECK: [[@LINE]]| 0|}
+int main() { // CHECK: [[@LINE]]| 1|int main(
+ foo(false); // CHECK: [[@LINE]]| 1| foo(
+ bar(); // CHECK: [[@LINE]]| 1| bar(
+ return 0; // CHECK: [[@LINE]]| 1| return
+} // CHECK: [[@LINE]]| 1|}
// COVMAP: __llvm_covmap {{.*}}
diff --git a/test/profile/Linux/extern_template.test b/test/profile/Linux/extern_template.test
index ada4d230e9bc4..3ce362783199b 100644
--- a/test/profile/Linux/extern_template.test
+++ b/test/profile/Linux/extern_template.test
@@ -1,12 +1,12 @@
// RUN: %clang -O2 -c -o %t.0.o %S/../Inputs/extern_template.cpp
// RUN: %clang_profgen -O2 -c -o %t.o %S/../Inputs/extern_template.cpp
// RUN: %clang_profgen -O2 -fcoverage-mapping %S/../Inputs/extern_template1.cpp %S/../Inputs/extern_template2.cpp %t.o -o %t
-// RUN: env LLVM_PROFILE_FILE=%t.profraw %t
+// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata show --all-functions %t.profraw | FileCheck %s
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show -instr-profile=%t.profdata %t | FileCheck %S/../Inputs/extern_template.h
// RUN: %clang_profgen -O2 -fcoverage-mapping %S/../Inputs/extern_template1.cpp %S/../Inputs/extern_template2.cpp %t.0.o -o %t.0
-// RUN: env LLVM_PROFILE_FILE=%t.0.profraw %t.0
+// RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t.0
// RUN: llvm-profdata show --all-functions %t.0.profraw | FileCheck %s
// RUN: llvm-profdata merge -o %t.0.profdata %t.0.profraw
// RUN: llvm-cov show -instr-profile=%t.0.profdata %t.0 | FileCheck %S/../Inputs/extern_template.h
diff --git a/test/profile/Linux/instrprof-comdat.test b/test/profile/Linux/instrprof-comdat.test
index b933e96b45042..5a11a241ae6f8 100644
--- a/test/profile/Linux/instrprof-comdat.test
+++ b/test/profile/Linux/instrprof-comdat.test
@@ -1,6 +1,6 @@
RUN: mkdir -p %t.d
RUN: %clangxx_profgen -o %t.d/comdat -fcoverage-mapping -fuse-ld=gold %S/../Inputs/instrprof-comdat-1.cpp %S/../Inputs/instrprof-comdat-2.cpp
-RUN: LLVM_PROFILE_FILE=%t-comdat.profraw %t.d/comdat
+RUN: LLVM_PROFILE_FILE=%t-comdat.profraw %run %t.d/comdat
RUN: llvm-profdata merge -o %t.d/comdat.prof %t-comdat.profraw
RUN: llvm-cov show --filename-equivalence --instr-profile=%t.d/comdat.prof %t.d/comdat | FileCheck --check-prefix=HEADER %S/../Inputs/instrprof-comdat.h
diff --git a/test/profile/Linux/instrprof-cs.c b/test/profile/Linux/instrprof-cs.c
new file mode 100644
index 0000000000000..d825525a532db
--- /dev/null
+++ b/test/profile/Linux/instrprof-cs.c
@@ -0,0 +1,35 @@
+// RUN: rm -fr %t.prof
+// RUN: %clang_pgogen=%t.prof/ -o %t.gen.cs -O2 %s
+// RUN: %run %t.gen.cs
+// RUN: llvm-profdata merge -o %t.cs.profdata %t.prof/
+// Check context sensitive profile
+// RUN: %clang_profuse=%t.cs.profdata -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CS
+//
+// RUN: %clang_profgen=%t.profraw -o %t.gen.cis -O2 %s
+// RUN: %run %t.gen.cis
+// RUN: llvm-profdata merge -o %t.cis.profdata %t.profraw
+// Check context insenstive profile
+// RUN: %clang_profuse=%t.cis.profdata -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CIS
+int g1 = 1;
+int volatile g2 = 2;
+static void toggle(int t) {
+ if (t & 1)
+ g1 *= t;
+ else
+ g2 *= t;
+}
+
+int main() {
+ int i;
+ // CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
+ // CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]
+ toggle(g1);
+ // CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
+ // CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]
+ toggle(g2);
+ return 0;
+}
+
+// CS: ![[PD1]] = !{!"branch_weights", i32 0, i32 1}
+// CS: ![[PD2]] = !{!"branch_weights", i32 1, i32 0}
+// CIS: ![[PD]] = !{!"branch_weights", i32 2, i32 2}
diff --git a/test/profile/Linux/instrprof-set-filename-shared.test b/test/profile/Linux/instrprof-set-filename-shared.test
deleted file mode 100644
index 29e6713289d96..0000000000000
--- a/test/profile/Linux/instrprof-set-filename-shared.test
+++ /dev/null
@@ -1,8 +0,0 @@
-# Test that __llvm_profile_set_filename is honored by shared libary too.
-RUN: mkdir -p %t.d
-RUN: %clang_profgen=%t.shared.profraw -fPIC -shared -o %t.d/t.shared %S/../Inputs/instrprof-dlopen-func.c
-RUN: %clang_profgen -DCALL_SHARED -o %t.m -O3 -rpath %t.d %t.d/t.shared %S/../instrprof-set-filename.c
-RUN: %run %t.m %t.main.profraw
-RUN: llvm-profdata show %t.main.profraw | FileCheck --check-prefix=SHARED %s
-
-# SHARED: Total functions: 2
diff --git a/test/profile/Linux/lit.local.cfg b/test/profile/Linux/lit.local.cfg
index c8c79fc7d8a77..410ffd8c5b056 100644
--- a/test/profile/Linux/lit.local.cfg
+++ b/test/profile/Linux/lit.local.cfg
@@ -21,6 +21,7 @@ def is_gold_linker_available():
return False
clang_cmd = subprocess.Popen([config.clang, '-fuse-ld=gold', '-xc', '-'],
+ universal_newlines = True,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)