[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Profile / branch-profdup.cpp
blobdfb3f5738fb72b980ea5c630f18983230956911a
1 // Test to ensure RHS condition of logical operators isn't evaluated more than
2 // one time when instrumenting RHS counter blocks for branch coverage.
4 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -main-file-name branch-profdup.cpp %s -o - -emit-llvm -fprofile-instrument=clang | FileCheck -allow-deprecated-dag-overlap %s
6 // CHECK-LABEL: define {{.*}}@_Z5test1b
7 // CHECK-COUNT-1: = call {{.*}}@_Z5fval1v()
8 // CHECK-NOT: = call {{.*}}@_Z5fval1v()
9 extern bool fval1();
10 bool test1(bool a) {
11 return (a && fval1());
14 // CHECK-LABEL: define {{.*}}@_Z5test2b
15 // CHECK-COUNT-1: call {{.*}}_Z5fval2v()
16 // CHECK-NOT: call {{.*}}_Z5fval2v()
17 extern bool fval2();
18 bool test2(bool a) {
19 return (a || fval2());
22 // CHECK-LABEL: define {{.*}}@_Z5test3v
23 // CHECK-COUNT-1: call {{.*}}_Z5fval3v()
24 // CHECK-NOT: call {{.*}}_Z5fval3v()
25 extern bool fval3();
26 bool test3() {
27 return (1 && fval3());
30 // CHECK-LABEL: define {{.*}}@_Z5test4v
31 // CHECK-COUNT-1: call {{.*}}_Z5fval4v()
32 // CHECK-NOT: call {{.*}}_Z5fval4v()
33 extern bool fval4();
34 bool test4() {
35 return (0 || fval4());
38 // CHECK-LABEL: define {{.*}}@_Z5test5b
39 // CHECK-COUNT-1: call {{.*}}_Z5fval5v()
40 // CHECK-NOT: call {{.*}}_Z5fval5v()
41 extern bool fval5();
42 bool test5(bool a) {
43 if (a && fval5())
44 return true;
45 return false;
48 // CHECK-LABEL: define {{.*}}@_Z5test6b
49 // CHECK-COUNT-1: call {{.*}}_Z5fval6v()
50 // CHECK-NOT: call {{.*}}_Z5fval6v()
51 extern bool fval6();
52 bool test6(bool a) {
53 if (a || fval6())
54 return true;
55 return false;
58 // CHECK-LABEL: define {{.*}}@_Z5test7v
59 // CHECK-COUNT-1: call {{.*}}_Z5fval7v()
60 // CHECK-NOT: call {{.*}}_Z5fval7v()
61 extern bool fval7();
62 bool test7() {
63 if (1 && fval7())
64 return true;
65 return false;
68 // CHECK-LABEL: define {{.*}}@_Z5test8v
69 // CHECK-COUNT-1: call {{.*}}_Z5fval8v()
70 // CHECK-NOT: call {{.*}}_Z5fval8v()
71 extern bool fval8();
72 bool test8() {
73 if (0 || fval8())
74 return true;
75 return false;