| 1 |
// RUN: rm -rf %t && split-file %s %t |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm %t/main.c -o - | FileCheck %s |
| 4 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fprofile-list=%t/func.list -emit-llvm %t/main.c -o - | FileCheck %s --check-prefix=FUNC |
| 5 |
|
| 6 |
// RUN: echo "src:%t/main.c" | 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 %t/main.c -o - | FileCheck %s --check-prefix=FILE |
| 8 |
// RUN: %clang_cc1 -fprofile-instrument=llvm -fprofile-list=%t/section.list -emit-llvm %t/main.c -o - | FileCheck %s --check-prefix=SECTION |
| 9 |
// RUN: %clang_cc1 -fprofile-instrument=sample-coldcov -fprofile-list=%t/cold-func.list -emit-llvm %t/main.c -o - | FileCheck %s --check-prefix=COLDCOV |
| 10 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fprofile-list=%t/exclude.list -emit-llvm %t/main.c -o - | FileCheck %s --check-prefix=EXCLUDE |
| 11 |
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -fprofile-list=%t/exclude-only.list -emit-llvm %t/main.c -o - | FileCheck %s --check-prefix=EXCLUDE |
| 12 |
|
| 13 |
//--- func.list |
| 14 |
fun:test1 |
| 15 |
|
| 16 |
//--- section.list |
| 17 |
[clang] |
| 18 |
fun:test1 |
| 19 |
[llvm] |
| 20 |
fun:test2 |
| 21 |
|
| 22 |
//--- cold-func.list |
| 23 |
[sample-coldcov] |
| 24 |
fun:test* |
| 25 |
!fun:test2 |
| 26 |
|
| 27 |
//--- exclude.list |
| 28 |
fun:test* |
| 29 |
!fun:test1 |
| 30 |
|
| 31 |
//--- exclude-only.list |
| 32 |
!fun:test1 |
| 33 |
|
| 34 |
//--- main.c |
| 35 |
unsigned i; |
| 36 |
|
| 37 |
// CHECK: test1 |
| 38 |
// CHECK: test2 |
| 39 |
// FUNC: test1 |
| 40 |
// FUNC-NOT: test2 |
| 41 |
// FILE: test1 |
| 42 |
// FILE: test2 |
| 43 |
// EXCLUDE-NOT: test1 |
| 44 |
// EXCLUDE: test2 |
| 45 |
|
| 46 |
// CHECK-NOT: noprofile |
| 47 |
// CHECK: @test1 |
| 48 |
// FUNC-NOT: noprofile |
| 49 |
// FUNC: @test1 |
| 50 |
// FILE-NOT: noprofile |
| 51 |
// FILE: @test1 |
| 52 |
// SECTION: noprofile |
| 53 |
// SECTION: @test1 |
| 54 |
// EXCLUDE: noprofile |
| 55 |
// EXCLUDE: @test1 |
| 56 |
// COLDCOV-NOT: noprofile |
| 57 |
// COLDCOV: @test1 |
| 58 |
unsigned test1(void) { |
| 59 |
// CHECK: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 60 |
// FUNC: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 61 |
// FILE: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 62 |
// SECTION-NOT: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 63 |
// EXCLUDE-NOT: %pgocount = load i64, ptr @__profc_{{_?}}test1 |
| 64 |
return i + 1; |
| 65 |
} |
| 66 |
|
| 67 |
// CHECK-NOT: noprofile |
| 68 |
// CHECK: @test2 |
| 69 |
// FUNC: noprofile |
| 70 |
// FUNC: @test2 |
| 71 |
// FILE-NOT: noprofile |
| 72 |
// FILE: @test2 |
| 73 |
// SECTION-NOT: noprofile |
| 74 |
// SECTION: @test2 |
| 75 |
// EXCLUDE-NOT: noprofile |
| 76 |
// EXCLUDE: @test2 |
| 77 |
// COLDCOV: noprofile |
| 78 |
// COLDCOV: @test2 |
| 79 |
unsigned test2(void) { |
| 80 |
// CHECK: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 81 |
// FUNC-NOT: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 82 |
// FILE: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 83 |
// SECTION: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 84 |
// EXCLUDE: %pgocount = load i64, ptr @__profc_{{_?}}test2 |
| 85 |
return i - 1; |
| 86 |
} |