]> git.lizzy.rs Git - rust.git/blob - tests/run-make-fulldeps/pgo-branch-weights/interesting.rs
Rollup merge of #106715 - BoxyUwU:new_solver_triagebot, r=lcnr
[rust.git] / tests / run-make-fulldeps / pgo-branch-weights / interesting.rs
1 #![crate_name="interesting"]
2 #![crate_type="rlib"]
3
4 extern crate opaque;
5
6 #[no_mangle]
7 #[inline(never)]
8 pub fn function_called_twice(c: char) {
9     if c == '2' {
10         // This branch is taken twice
11         opaque::f1();
12     } else {
13         // This branch is never taken
14         opaque::f2();
15     }
16 }
17
18 #[no_mangle]
19 #[inline(never)]
20 pub fn function_called_42_times(c: char) {
21     if c == 'a' {
22         // This branch is taken 12 times
23         opaque::f1();
24     } else {
25
26         if c == 'b' {
27             // This branch is taken 28 times
28             opaque::f2();
29         } else {
30             // This branch is taken 2 times
31             opaque::f3();
32         }
33     }
34 }
35
36 #[no_mangle]
37 #[inline(never)]
38 pub fn function_called_never(_: char) {
39     opaque::f1();
40 }