diff options
Diffstat (limited to 'test/profile/instrprof-basic.c')
-rw-r--r-- | test/profile/instrprof-basic.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/test/profile/instrprof-basic.c b/test/profile/instrprof-basic.c index 02549e1506ba..dd8f3fca3f9c 100644 --- a/test/profile/instrprof-basic.c +++ b/test/profile/instrprof-basic.c @@ -1,21 +1,46 @@ -// REQUIRES: shell // RUN: %clang_profgen -o %t -O3 %s // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t // RUN: llvm-profdata merge -o %t.profdata %t.profraw // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=ORIG // -// RUN: rm -f %t.profraw_e_* -// RUN: env LLVM_PROFILE_FILE=%t.profraw_e_%1m %run %t -// RUN: env LLVM_PROFILE_FILE=%t.profraw_e_%1m %run %t -// RUN: llvm-profdata merge -o %t.em.profdata %t.profraw_e_* +// RUN: rm -fr %t.dir1 +// RUN: mkdir -p %t.dir1 +// RUN: env LLVM_PROFILE_FILE=%t.dir1/profraw_e_%1m %run %t +// RUN: env LLVM_PROFILE_FILE=%t.dir1/profraw_e_%1m %run %t +// RUN: llvm-profdata merge -o %t.em.profdata %t.dir1 // RUN: %clang_profuse=%t.em.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=MERGE // -// RUN: %clang_profgen=%t.%m.profraw -o %t.merge -O3 %s -// RUN: rm -f %t.*.profraw* +// RUN: rm -fr %t.dir2 +// RUN: mkdir -p %t.dir2 +// RUN: %clang_profgen=%t.dir2/%m.profraw -o %t.merge -O3 %s // RUN: %run %t.merge // RUN: %run %t.merge -// RUN: llvm-profdata merge -o %t.m.profdata %t.*.profraw +// RUN: llvm-profdata merge -o %t.m.profdata %t.dir2/ // RUN: %clang_profuse=%t.m.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=MERGE +// +// Test that merging is enabled by default with -fprofile-generate= +// RUN: rm -fr %t.dir3 +// RUN: mkdir -p %t.dir3 +// RUN: %clang_pgogen=%t.dir3/ -o %t.merge3 -O0 %s +// RUN: %run %t.merge3 +// RUN: %run %t.merge3 +// RUN: %run %t.merge3 +// RUN: %run %t.merge3 +// RUN: llvm-profdata merge -o %t.m3.profdata %t.dir3/ +// RUN: %clang_profuse=%t.m3.profdata -O0 -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=PGOMERGE +// +// Test that merging is enabled by default with -fprofile-generate +// RUN: rm -fr %t.dir4 +// RUN: mkdir -p %t.dir4 +// RUN: %clang_pgogen -o %t.dir4/merge4 -O0 %s +// RUN: cd %t.dir4 +// RUN: %run %t.dir4/merge4 +// RUN: %run %t.dir4/merge4 +// RUN: %run %t.dir4/merge4 +// RUN: %run %t.dir4/merge4 +// RUN: rm -f %t.dir4/merge4 +// RUN: llvm-profdata merge -o %t.m4.profdata ./ +// RUN: %clang_profuse=%t.m4.profdata -O0 -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=PGOMERGE int begin(int i) { // COMMON: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]] @@ -45,3 +70,5 @@ int main(int argc, const char *argv[]) { // ORIG: ![[PD2]] = !{!"branch_weights", i32 2, i32 1} // MERGE: ![[PD1]] = !{!"branch_weights", i32 1, i32 3} // MERGE: ![[PD2]] = !{!"branch_weights", i32 3, i32 1} +// PGOMERGE: ![[PD1]] = !{!"branch_weights", i32 0, i32 4} +// PGOMERGE: ![[PD2]] = !{!"branch_weights", i32 4, i32 0} |