| 1 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm %s -o - | FileCheck %s |
| 2 |
|
| 3 |
// RUN: echo "fun:test1" > %t-func.list |
| 4 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fprofile-list=%t-func.list -emit-llvm %s -o - | FileCheck %s --check-prefix=FUNC |
| 5 |
|
| 6 |
// RUN: echo "src:%s" | sed -e 's/\\/\\\\/g' > %t-file.list |
| 7 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fprofile-list=%t-file.list -emit-llvm %s -o - | FileCheck %s --check-prefix=FILE |
| 8 |
|
| 9 |
// RUN: echo -e "[clang]\nfun:test1\n[llvm]\nfun:test2" > %t-section.list |
| 10 |
// RUN: %clang_cc1 -fprofile-instrument=llvm -fprofile-list=%t-section.list -emit-llvm %s -o - | FileCheck %s --check-prefix=SECTION |
| 11 |
|
| 12 |
// RUN: echo -e "fun:test*\n!fun:test1" > %t-exclude.list |
| 13 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fprofile-list=%t-exclude.list -emit-llvm %s -o - | FileCheck %s --check-prefix=EXCLUDE |
| 14 |
|
| 15 |
// RUN: echo "!fun:test1" > %t-exclude-only.list |
| 16 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fprofile-list=%t-exclude-only.list -emit-llvm %s -o - | FileCheck %s --check-prefix=EXCLUDE |
| 17 |
|
| 18 |
unsigned i; |
| 19 |
|
| 20 |
// CHECK: test1 |
| 21 |
// CHECK: test2 |
| 22 |
// FUNC: test1 |
| 23 |
// FUNC-NOT: test2 |
| 24 |
// FILE: test1 |
| 25 |
// FILE: test2 |
| 26 |
// EXCLUDE-NOT: test1 |
| 27 |
// EXCLUDE: test2 |
| 28 |
|
| 29 |
// CHECK-NOT: noprofile |
| 30 |
// CHECK: @test1 |
| 31 |
// FUNC-NOT: noprofile |
| 32 |
// FUNC: @test1 |
| 33 |
// FILE-NOT: noprofile |
| 34 |
// FILE: @test1 |
| 35 |
// SECTION: noprofile |
| 36 |
// SECTION: @test1 |
| 37 |
// EXCLUDE: noprofile |
| 38 |
// EXCLUDE: @test1 |
| 39 |
unsigned test1(void) { |
| 40 |
// CHECK: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 41 |
// FUNC: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 42 |
// FILE: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 43 |
// SECTION-NOT: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 44 |
// EXCLUDE-NOT: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 45 |
return i + 1; |
| 46 |
} |
| 47 |
|
| 48 |
// CHECK-NOT: noprofile |
| 49 |
// CHECK: @test2 |
| 50 |
// FUNC: noprofile |
| 51 |
// FUNC: @test2 |
| 52 |
// FILE-NOT: noprofile |
| 53 |
// FILE: @test2 |
| 54 |
// SECTION-NOT: noprofile |
| 55 |
// SECTION: @test2 |
| 56 |
// EXCLUDE-NOT: noprofile |
| 57 |
// EXCLUDE: @test2 |
| 58 |
unsigned test2(void) { |
| 59 |
// CHECK: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 60 |
// FUNC-NOT: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 61 |
// FILE: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 62 |
// SECTION: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 63 |
// EXCLUDE: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 64 |
return i - 1; |
| 65 |
} |