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 45
45
| test.cpp:122:9:122:9 | b |
46
46
| test.cpp:125:13:125:20 | ! ... |
47
47
| 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 166
166
| 126 | call to test3_condition == 0 when call to test3_condition is false |
167
167
| 131 | b != 0 when b is true |
168
168
| 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 |
169
173
| 137 | 0 != 0 when 0 is true |
170
174
| 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 |
171
179
| 146 | ! ... != 0 when ! ... is true |
172
180
| 146 | ! ... == 0 when ! ... is false |
173
181
| 146 | x != 0 when ! ... is false |
Original file line number Diff line number Diff line change 104
104
| test.cpp:122:9:122:9 | b | true | 125 | 125 |
105
105
| test.cpp:125:13:125:20 | ! ... | true | 125 | 125 |
106
106
| 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
270
270
| test.cpp:122:9:122:9 | b | test.cpp:122:9:122:9 | b | != | 0 | 125 | 125 |
271
271
| test.cpp:125:13:125:20 | ! ... | test.cpp:125:13:125:20 | ! ... | != | 0 | 125 | 125 |
272
272
| 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)
125
125
if (!safe (x)) return ;
126
126
}
127
127
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
+ }
128
148
}
You can’t perform that action at this time.
0 commit comments