File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
tests/mir-opt/dataflow-const-prop Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// unit-test: DataflowConstProp
3
2
4
3
// EMIT_MIR if.main.DataflowConstProp.diff
4
+ // CHECK-LABEL: fn main(
5
5
fn main ( ) {
6
+ // CHECK: debug b => [[b:_.*]];
7
+ // CHECK: debug c => [[c:_.*]];
8
+ // CHECK: debug d => [[d:_.*]];
9
+ // CHECK: debug e => [[e:_.*]];
10
+
6
11
let a = 1 ;
12
+
13
+ // CHECK: switchInt(const true) -> [0: {{bb[0-9]+}}, otherwise: [[bb_first_true:bb[0-9]+]]];
14
+ // CHECK: [[bb_first_true]]: {
15
+ // CHECK: [[b]] = const 2_i32;
7
16
let b = if a == 1 { 2 } else { 3 } ;
17
+
18
+ // CHECK: [[c]] = const 3_i32;
8
19
let c = b + 1 ;
9
20
21
+ // CHECK: switchInt(const true) -> [0: {{bb[0-9]+}}, otherwise: [[bb_second_true:bb[0-9]+]]];
22
+ // CHECK: [[bb_second_true]]: {
23
+ // CHECK: [[d]] = const 1_i32;
10
24
let d = if a == 1 { a } else { a + 1 } ;
25
+
26
+ // CHECK: [[e]] = const 2_i32;
11
27
let e = d + 1 ;
12
28
}
Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
3
2
// unit-test: DataflowConstProp
4
3
// compile-flags: -Zmir-enable-passes=+Inline
5
4
6
5
// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff
6
+ // CHECK-LABEL: fn main(
7
7
fn main ( ) {
8
8
// After inlining, this will contain a `CheckedBinaryOp`.
9
9
// Propagating the overflow is ok as codegen will just skip emitting the panic.
10
+
11
+ // CHECK: {{_.*}} = const (0_u8, true);
12
+ // CHECK-LABEL: assert(!const true,
10
13
let _ = <u8 as std:: ops:: Add >:: add ( 255 , 1 ) ;
11
14
}
Original file line number Diff line number Diff line change 1
- // skip-filecheck
2
1
// unit-test: DataflowConstProp
3
2
4
3
// EMIT_MIR issue_81605.f.DataflowConstProp.diff
4
+
5
+ // CHECK-LABEL: fn f
5
6
fn f ( ) -> usize {
7
+ // CHECK: switchInt(const true) -> [0: {{bb[0-9]+}}, otherwise: {{bb[0-9]+}}];
6
8
1 + if true { 1 } else { 2 }
9
+ // CHECK: _0 = const 2_usize;
7
10
}
8
11
9
12
fn main ( ) {
You can’t perform that action at this time.
0 commit comments