FileCheck boolean_identities. · rust-lang/rust@3fc0394 (original) (raw)

2 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
1 -// skip-filecheck
2 1 // unit-test: ConstProp
3 -// compile-flags: -O -Zmir-opt-level=4
4 2
5 3 // EMIT_MIR boolean_identities.test.ConstProp.diff
6 4 pub 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
8 14 }
9 15
10 16 fn main() {
Original file line number Diff line number Diff line change
@@ -5,20 +5,42 @@
5 5 debug x => _1;
6 6 debug y => _2;
7 7 let mut _0: bool;
8 - let mut _3: bool;
8 + let _3: bool;
9 9 let mut _4: bool;
10 - let mut _5: bool;
11 10 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 + }
12 20
13 21 bb0: {
14 22 StorageLive(_3);
15 -- _3 = BitOr(_2, const true);
23 + StorageLive(_4);
24 + _4 = _2;
25 +- _3 = BitOr(move _4, const true);
16 26 + _3 = const true;
27 + StorageDead(_4);
17 28 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);
20 32 + _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;
21 41 + _0 = const false;
42 + StorageDead(_8);
43 + StorageDead(_7);
22 44 StorageDead(_5);
23 45 StorageDead(_3);
24 46 return;