This repository was archived by the owner on May 28, 2025. It is now read-only.
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
21// unit-test: DataflowConstProp
32
43// EMIT_MIR if.main.DataflowConstProp.diff
4+ // CHECK-LABEL: fn main(
55fn main ( ) {
6+ // CHECK: debug b => [[b:_.*]];
7+ // CHECK: debug c => [[c:_.*]];
8+ // CHECK: debug d => [[d:_.*]];
9+ // CHECK: debug e => [[e:_.*]];
10+
611 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;
716 let b = if a == 1 { 2 } else { 3 } ;
17+
18+ // CHECK: [[c]] = const 3_i32;
819 let c = b + 1 ;
920
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;
1024 let d = if a == 1 { a } else { a + 1 } ;
25+
26+ // CHECK: [[e]] = const 2_i32;
1127 let e = d + 1 ;
1228}
Original file line number Diff line number Diff line change 1- // skip-filecheck
21// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
32// unit-test: DataflowConstProp
43// compile-flags: -Zmir-enable-passes=+Inline
54
65// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff
6+ // CHECK-LABEL: fn main(
77fn main ( ) {
88 // After inlining, this will contain a `CheckedBinaryOp`.
99 // 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,
1013 let _ = <u8 as std:: ops:: Add >:: add ( 255 , 1 ) ;
1114}
Original file line number Diff line number Diff line change 1- // skip-filecheck
21// unit-test: DataflowConstProp
32
43// EMIT_MIR issue_81605.f.DataflowConstProp.diff
4+
5+ // CHECK-LABEL: fn f
56fn f ( ) -> usize {
7+ // CHECK: switchInt(const true) -> [0: {{bb[0-9]+}}, otherwise: {{bb[0-9]+}}];
68 1 + if true { 1 } else { 2 }
9+ // CHECK: _0 = const 2_usize;
710}
811
912fn main ( ) {
You can’t perform that action at this time.
0 commit comments