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() { 40 // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) 41 // FUNC: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) 42 // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) 43 // SECTION-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) 44 // EXCLUDE-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test1, i64 0, i64 0) 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() { 59 // CHECK: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) 60 // FUNC-NOT: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) 61 // FILE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) 62 // SECTION: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) 63 // EXCLUDE: %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test2, i64 0, i64 0) 64 return i - 1; 65 } 66