[Profile] Add new test

To test that online merging is enabled by default.

llvm-svn: 276493
This commit is contained in:
Xinliang David Li 2016-07-22 23:38:58 +00:00
parent bdb84f374c
commit 5a6dc4c9b8
1 changed files with 26 additions and 0 deletions

View File

@ -17,6 +17,30 @@
// RUN: %run %t.merge
// 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]+]]
@ -46,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}