File tree Expand file tree Collapse file tree 5 files changed +40
-0
lines changed
cpp/ql/test/library-tests/controlflow/guards Expand file tree Collapse file tree 5 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 4545| test.cpp:122:9:122:9 | b |
4646| test.cpp:125:13:125:20 | ! ... |
4747| test.cpp:125:14:125:17 | call to safe |
48+ | test.cpp:131:6:131:21 | call to __builtin_expect |
49+ | test.cpp:135:6:135:21 | call to __builtin_expect |
50+ | test.cpp:141:6:141:21 | call to __builtin_expect |
51+ | test.cpp:145:6:145:21 | call to __builtin_expect |
Original file line number Diff line number Diff line change 166166| 126 | call to test3_condition == 0 when call to test3_condition is false |
167167| 131 | b != 0 when b is true |
168168| 131 | b == 0 when b is false |
169+ | 131 | call to __builtin_expect != 0 when call to __builtin_expect is true |
170+ | 131 | call to __builtin_expect == 0 when call to __builtin_expect is false |
171+ | 135 | call to __builtin_expect != 0 when call to __builtin_expect is true |
172+ | 135 | call to __builtin_expect == 0 when call to __builtin_expect is false |
169173| 137 | 0 != 0 when 0 is true |
170174| 137 | 0 == 0 when 0 is false |
175+ | 141 | call to __builtin_expect != 0 when call to __builtin_expect is true |
176+ | 141 | call to __builtin_expect == 0 when call to __builtin_expect is false |
177+ | 145 | call to __builtin_expect != 0 when call to __builtin_expect is true |
178+ | 145 | call to __builtin_expect == 0 when call to __builtin_expect is false |
171179| 146 | ! ... != 0 when ! ... is true |
172180| 146 | ! ... == 0 when ! ... is false |
173181| 146 | x != 0 when ! ... is false |
Original file line number Diff line number Diff line change 104104| test.cpp:122:9:122:9 | b | true | 125 | 125 |
105105| test.cpp:125:13:125:20 | ! ... | true | 125 | 125 |
106106| test.cpp:125:14:125:17 | call to safe | false | 125 | 125 |
107+ | test.cpp:131:6:131:21 | call to __builtin_expect | true | 131 | 132 |
108+ | test.cpp:135:6:135:21 | call to __builtin_expect | true | 135 | 136 |
109+ | test.cpp:141:6:141:21 | call to __builtin_expect | true | 141 | 142 |
110+ | test.cpp:145:6:145:21 | call to __builtin_expect | true | 145 | 146 |
Original file line number Diff line number Diff line change @@ -270,3 +270,7 @@ unary
270270| test.cpp:122:9:122:9 | b | test.cpp:122:9:122:9 | b | != | 0 | 125 | 125 |
271271| test.cpp:125:13:125:20 | ! ... | test.cpp:125:13:125:20 | ! ... | != | 0 | 125 | 125 |
272272| test.cpp:125:14:125:17 | call to safe | test.cpp:125:14:125:17 | call to safe | == | 0 | 125 | 125 |
273+ | test.cpp:131:6:131:21 | call to __builtin_expect | test.cpp:131:6:131:21 | call to __builtin_expect | != | 0 | 131 | 132 |
274+ | test.cpp:135:6:135:21 | call to __builtin_expect | test.cpp:135:6:135:21 | call to __builtin_expect | != | 0 | 135 | 136 |
275+ | test.cpp:141:6:141:21 | call to __builtin_expect | test.cpp:141:6:141:21 | call to __builtin_expect | != | 0 | 141 | 142 |
276+ | test.cpp:145:6:145:21 | call to __builtin_expect | test.cpp:145:6:145:21 | call to __builtin_expect | != | 0 | 145 | 146 |
Original file line number Diff line number Diff line change @@ -125,4 +125,24 @@ void test(bool b)
125125 if (!safe (x)) return ;
126126 }
127127 use (x);
128+ }
129+
130+ void binary_test_builtin_expected (int a, int b) {
131+ if (__builtin_expect (a == b + 42 , 0 )) {
132+ use (a);
133+ }
134+
135+ if (__builtin_expect (a != b + 42 , 0 )) {
136+ use (a);
137+ }
138+ }
139+
140+ void unary_test_builtin_expected (int a) {
141+ if (__builtin_expect (a == 42 , 0 )) {
142+ use (a);
143+ }
144+
145+ if (__builtin_expect (a != 42 , 0 )) {
146+ use (a);
147+ }
128148}
You can’t perform that action at this time.
0 commit comments