File tree Expand file tree Collapse file tree 2 files changed +36
-8
lines changed Expand file tree Collapse file tree 2 files changed +36
-8
lines changed Original file line number Diff line number Diff line change 1- // skip-filecheck
21// unit-test: ConstProp
3- // compile-flags: -O -Zmir-opt-level=4
42
53// EMIT_MIR boolean_identities.test.ConstProp.diff
64pub fn test ( x : bool , y : bool ) -> bool {
7- ( y | true ) & ( x & false )
5+ // CHECK-LABEL: fn test(
6+ // CHECK: debug a => [[a:_.*]];
7+ // CHECK: debug b => [[b:_.*]];
8+ // CHECK: [[a]] = const true;
9+ // CHECK: [[b]] = const false;
10+ // CHECK: _0 = const false;
11+ let a = ( y | true ) ;
12+ let b = ( x & false ) ;
13+ a & b
814}
915
1016fn main ( ) {
Original file line number Diff line number Diff line change 55 debug x => _1;
66 debug y => _2;
77 let mut _0: bool;
8- let mut _3: bool;
8+ let _3: bool;
99 let mut _4: bool;
10- let mut _5: bool;
1110 let mut _6: bool;
11+ let mut _7: bool;
12+ let mut _8: bool;
13+ scope 1 {
14+ debug a => _3;
15+ let _5: bool;
16+ scope 2 {
17+ debug b => _5;
18+ }
19+ }
1220
1321 bb0: {
1422 StorageLive(_3);
15- - _3 = BitOr(_2, const true);
23+ StorageLive(_4);
24+ _4 = _2;
25+ - _3 = BitOr(move _4, const true);
1626+ _3 = const true;
27+ StorageDead(_4);
1728 StorageLive(_5);
18- - _5 = BitAnd(_1, const false);
19- - _0 = BitAnd(move _3, move _5);
29+ StorageLive(_6);
30+ _6 = _1;
31+ - _5 = BitAnd(move _6, const false);
2032+ _5 = const false;
33+ StorageDead(_6);
34+ StorageLive(_7);
35+ - _7 = _3;
36+ + _7 = const true;
37+ StorageLive(_8);
38+ - _8 = _5;
39+ - _0 = BitAnd(move _7, move _8);
40+ + _8 = const false;
2141+ _0 = const false;
42+ StorageDead(_8);
43+ StorageDead(_7);
2244 StorageDead(_5);
2345 StorageDead(_3);
2446 return;
You can’t perform that action at this time.
0 commit comments