[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Profile / branch-logical-mixed.cpp
blobcdcee76c3d0cf15a1955dd5d478006294eeff23c
1 // Test to ensure instrumentation of logical operator RHS True/False counters
2 // are being instrumented for branch coverage
4 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -main-file-name branch-logical-mixed.cpp %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck -allow-deprecated-dag-overlap %s
7 // CHECK: @[[FUNC:__profc__Z4funcv]] = {{.*}} global [61 x i64] zeroinitializer
10 // CHECK-LABEL: @_Z4funcv()
11 bool func() {
12 bool bt0 = true;
13 bool bt1 = true;
14 bool bt2 = true;
15 bool bt3 = true;
16 bool bt4 = true;
17 bool bt5 = true;
18 bool bf0 = false;
19 bool bf1 = false;
20 bool bf2 = false;
21 bool bf3 = false;
22 bool bf4 = false;
23 bool bf5 = false;
25 bool a = bt0 &&
26 bf0 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 10
27 bt1 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 8
28 bf1 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 6
29 bt2 && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 4
30 bf2; // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 2
32 bool b = bt0 ||
33 bf0 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 20
34 bt1 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 18
35 bf1 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 16
36 bt2 || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 14
37 bf2; // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 12
39 bool c = (bt0 &&
40 bf0) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 27
41 (bt1 &&
42 bf1) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 29
43 (bt2 &&
44 bf2) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 31
45 (bt3 &&
46 bf3) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 33
47 (bt4 &&
48 bf4) || // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 35
49 (bf5 &&
50 bf5); // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 37
52 bool d = (bt0 ||
53 bf0) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 44
54 (bt1 ||
55 bf1) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 46
56 (bt2 ||
57 bf2) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 48
58 (bt3 ||
59 bf3) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 50
60 (bt4 ||
61 bf4) && // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 52
62 (bt5 ||
63 bf5); // CHECK: store {{.*}} @[[FUNC]], i32 0, i32 54
65 return a && b && c && d;