Add chained comparison e2e test.
This commit is contained in:
parent
434fa8c26d
commit
b0121799b3
@ -0,0 +1,84 @@
|
||||
// MIR for `bitand` after PreCodegen
|
||||
|
||||
fn bitand(_1: &Blueprint, _2: &Blueprint) -> bool {
|
||||
debug a => _1; // in scope 0 at $DIR/chained_comparison.rs:+0:15: +0:16
|
||||
debug b => _2; // in scope 0 at $DIR/chained_comparison.rs:+0:30: +0:31
|
||||
let mut _0: bool; // return place in scope 0 at $DIR/chained_comparison.rs:+0:48: +0:52
|
||||
let mut _3: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
|
||||
let mut _4: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
|
||||
let mut _5: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
|
||||
let mut _6: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21
|
||||
let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34
|
||||
let mut _8: bool; // in scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35
|
||||
let mut _9: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35
|
||||
let mut _10: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28
|
||||
let mut _11: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48
|
||||
let mut _12: bool; // in scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49
|
||||
let mut _13: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49
|
||||
let mut _14: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25
|
||||
let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42
|
||||
let mut _16: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43
|
||||
let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43
|
||||
let mut _18: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21
|
||||
let mut _19: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34
|
||||
let mut _20: bool; // in scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35
|
||||
|
||||
bb0: {
|
||||
StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43
|
||||
StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49
|
||||
StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35
|
||||
StorageLive(_5); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
|
||||
StorageLive(_3); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
|
||||
_3 = ((*_1).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
|
||||
StorageLive(_4); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
|
||||
_4 = ((*_2).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
|
||||
_5 = Eq(move _3, move _4); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
|
||||
StorageDead(_4); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
|
||||
StorageDead(_3); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
|
||||
StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35
|
||||
StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21
|
||||
_6 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:21
|
||||
StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34
|
||||
_7 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:25: +2:34
|
||||
_8 = Eq(move _6, move _7); // scope 0 at $DIR/chained_comparison.rs:+2:11: +2:35
|
||||
StorageDead(_7); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
|
||||
StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
|
||||
_9 = BitAnd(move _5, move _8); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:35
|
||||
StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
|
||||
StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+2:34: +2:35
|
||||
StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49
|
||||
StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28
|
||||
_10 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:28
|
||||
StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48
|
||||
_11 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:32: +3:48
|
||||
_12 = Eq(move _10, move _11); // scope 0 at $DIR/chained_comparison.rs:+3:11: +3:49
|
||||
StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
|
||||
StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
|
||||
_13 = BitAnd(move _9, move _12); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:49
|
||||
StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
|
||||
StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+3:48: +3:49
|
||||
StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43
|
||||
StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25
|
||||
_14 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:25
|
||||
StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42
|
||||
_15 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:42
|
||||
_16 = Eq(move _14, move _15); // scope 0 at $DIR/chained_comparison.rs:+4:11: +4:43
|
||||
StorageDead(_15); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
|
||||
StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
|
||||
_17 = BitAnd(move _13, move _16); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:43
|
||||
StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
|
||||
StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+4:42: +4:43
|
||||
StorageLive(_20); // scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35
|
||||
StorageLive(_18); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21
|
||||
_18 = ((*_1).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:21
|
||||
StorageLive(_19); // scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34
|
||||
_19 = ((*_2).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:25: +5:34
|
||||
_20 = Eq(move _18, move _19); // scope 0 at $DIR/chained_comparison.rs:+5:11: +5:35
|
||||
StorageDead(_19); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
|
||||
StorageDead(_18); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
|
||||
_0 = BitAnd(move _17, move _20); // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:35
|
||||
StorageDead(_20); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
|
||||
StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+5:34: +5:35
|
||||
return; // scope 0 at $DIR/chained_comparison.rs:+6:2: +6:2
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
// MIR for `naive` after PreCodegen
|
||||
|
||||
fn naive(_1: &Blueprint, _2: &Blueprint) -> bool {
|
||||
debug a => _1; // in scope 0 at $DIR/chained_comparison.rs:+0:14: +0:15
|
||||
debug b => _2; // in scope 0 at $DIR/chained_comparison.rs:+0:29: +0:30
|
||||
let mut _0: bool; // return place in scope 0 at $DIR/chained_comparison.rs:+0:47: +0:51
|
||||
let mut _3: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
|
||||
let mut _4: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
|
||||
let mut _5: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
|
||||
let mut _6: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
|
||||
let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22
|
||||
let mut _8: u32; // in scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35
|
||||
let mut _9: bool; // in scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36
|
||||
let mut _10: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
|
||||
let mut _11: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29
|
||||
let mut _12: u32; // in scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49
|
||||
let mut _13: bool; // in scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50
|
||||
let mut _14: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
|
||||
let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26
|
||||
let mut _16: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43
|
||||
let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44
|
||||
let mut _18: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22
|
||||
let mut _19: u32; // in scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35
|
||||
let mut _20: bool; // in scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36
|
||||
|
||||
bb0: {
|
||||
StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
|
||||
StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
|
||||
StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
|
||||
StorageLive(_5); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
|
||||
StorageLive(_3); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
|
||||
_3 = ((*_1).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:6: +1:22
|
||||
StorageLive(_4); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
|
||||
_4 = ((*_2).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:26: +1:42
|
||||
_5 = Eq(move _3, move _4); // scope 0 at $DIR/chained_comparison.rs:+1:5: +1:43
|
||||
StorageDead(_4); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
|
||||
StorageDead(_3); // scope 0 at $DIR/chained_comparison.rs:+1:42: +1:43
|
||||
switchInt(move _5) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_6 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
|
||||
goto -> bb3; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36
|
||||
StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22
|
||||
_7 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:13: +2:22
|
||||
StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35
|
||||
_8 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+2:26: +2:35
|
||||
_9 = Eq(move _7, move _8); // scope 0 at $DIR/chained_comparison.rs:+2:12: +2:36
|
||||
StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
|
||||
StorageDead(_7); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
|
||||
_6 = move _9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
|
||||
goto -> bb3; // scope 0 at $DIR/chained_comparison.rs:+1:5: +2:36
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
|
||||
StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+2:35: +2:36
|
||||
switchInt(move _6) -> [0: bb4, otherwise: bb5]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_10 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
|
||||
goto -> bb6; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50
|
||||
StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29
|
||||
_11 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:13: +3:29
|
||||
StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49
|
||||
_12 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+3:33: +3:49
|
||||
_13 = Eq(move _11, move _12); // scope 0 at $DIR/chained_comparison.rs:+3:12: +3:50
|
||||
StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
|
||||
StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
|
||||
_10 = move _13; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
|
||||
goto -> bb6; // scope 0 at $DIR/chained_comparison.rs:+1:5: +3:50
|
||||
}
|
||||
|
||||
bb6: {
|
||||
StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
|
||||
StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+3:49: +3:50
|
||||
switchInt(move _10) -> [0: bb7, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
|
||||
}
|
||||
|
||||
bb7: {
|
||||
_14 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
|
||||
goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
|
||||
}
|
||||
|
||||
bb8: {
|
||||
StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44
|
||||
StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26
|
||||
_15 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:13: +4:26
|
||||
StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43
|
||||
_16 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+4:30: +4:43
|
||||
_17 = Eq(move _15, move _16); // scope 0 at $DIR/chained_comparison.rs:+4:12: +4:44
|
||||
StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
|
||||
StorageDead(_15); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
|
||||
_14 = move _17; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
|
||||
goto -> bb9; // scope 0 at $DIR/chained_comparison.rs:+1:5: +4:44
|
||||
}
|
||||
|
||||
bb9: {
|
||||
StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
|
||||
StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+4:43: +4:44
|
||||
switchInt(move _14) -> [0: bb10, otherwise: bb11]; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
|
||||
}
|
||||
|
||||
bb10: {
|
||||
_0 = const false; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
|
||||
goto -> bb12; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
|
||||
}
|
||||
|
||||
bb11: {
|
||||
StorageLive(_20); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36
|
||||
StorageLive(_18); // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22
|
||||
_18 = ((*_1).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:13: +5:22
|
||||
StorageLive(_19); // scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35
|
||||
_19 = ((*_2).4: u32); // scope 0 at $DIR/chained_comparison.rs:+5:26: +5:35
|
||||
_20 = Eq(move _18, move _19); // scope 0 at $DIR/chained_comparison.rs:+5:12: +5:36
|
||||
StorageDead(_19); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
|
||||
StorageDead(_18); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
|
||||
_0 = move _20; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
|
||||
goto -> bb12; // scope 0 at $DIR/chained_comparison.rs:+1:5: +5:36
|
||||
}
|
||||
|
||||
bb12: {
|
||||
StorageDead(_20); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
|
||||
StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+5:35: +5:36
|
||||
return; // scope 0 at $DIR/chained_comparison.rs:+6:2: +6:2
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
// MIR for `returning` after PreCodegen
|
||||
|
||||
fn returning(_1: &Blueprint, _2: &Blueprint) -> bool {
|
||||
debug a => _1; // in scope 0 at $DIR/chained_comparison.rs:+0:18: +0:19
|
||||
debug b => _2; // in scope 0 at $DIR/chained_comparison.rs:+0:33: +0:34
|
||||
let mut _0: bool; // return place in scope 0 at $DIR/chained_comparison.rs:+0:51: +0:55
|
||||
let mut _3: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24
|
||||
let mut _4: u32; // in scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44
|
||||
let mut _5: bool; // in scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
|
||||
let mut _6: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17
|
||||
let mut _7: u32; // in scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30
|
||||
let mut _8: bool; // in scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
|
||||
let mut _9: u32; // in scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24
|
||||
let mut _10: u32; // in scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44
|
||||
let mut _11: bool; // in scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
|
||||
let mut _12: u32; // in scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21
|
||||
let mut _13: u32; // in scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38
|
||||
let mut _14: bool; // in scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
|
||||
let mut _15: u32; // in scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17
|
||||
let mut _16: u32; // in scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30
|
||||
let mut _17: bool; // in scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
|
||||
|
||||
bb0: {
|
||||
StorageLive(_5); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
|
||||
StorageLive(_3); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24
|
||||
_3 = ((*_1).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:24
|
||||
StorageLive(_4); // scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44
|
||||
_4 = ((*_2).0: u32); // scope 0 at $DIR/chained_comparison.rs:+1:28: +1:44
|
||||
_5 = Ne(move _3, move _4); // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
|
||||
StorageDead(_4); // scope 0 at $DIR/chained_comparison.rs:+1:43: +1:44
|
||||
StorageDead(_3); // scope 0 at $DIR/chained_comparison.rs:+1:43: +1:44
|
||||
switchInt(move _5) -> [0: bb1, otherwise: bb10]; // scope 0 at $DIR/chained_comparison.rs:+1:8: +1:44
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+3:5: +3:6
|
||||
StorageLive(_8); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
|
||||
StorageLive(_6); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17
|
||||
_6 = ((*_1).1: u32); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:17
|
||||
StorageLive(_7); // scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30
|
||||
_7 = ((*_2).1: u32); // scope 0 at $DIR/chained_comparison.rs:+4:21: +4:30
|
||||
_8 = Ne(move _6, move _7); // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
|
||||
StorageDead(_7); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:30
|
||||
StorageDead(_6); // scope 0 at $DIR/chained_comparison.rs:+4:29: +4:30
|
||||
switchInt(move _8) -> [0: bb2, otherwise: bb9]; // scope 0 at $DIR/chained_comparison.rs:+4:8: +4:30
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+6:5: +6:6
|
||||
StorageLive(_11); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
|
||||
StorageLive(_9); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24
|
||||
_9 = ((*_1).2: u32); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:24
|
||||
StorageLive(_10); // scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44
|
||||
_10 = ((*_2).2: u32); // scope 0 at $DIR/chained_comparison.rs:+7:28: +7:44
|
||||
_11 = Ne(move _9, move _10); // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
|
||||
StorageDead(_10); // scope 0 at $DIR/chained_comparison.rs:+7:43: +7:44
|
||||
StorageDead(_9); // scope 0 at $DIR/chained_comparison.rs:+7:43: +7:44
|
||||
switchInt(move _11) -> [0: bb3, otherwise: bb8]; // scope 0 at $DIR/chained_comparison.rs:+7:8: +7:44
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+9:5: +9:6
|
||||
StorageLive(_14); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
|
||||
StorageLive(_12); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21
|
||||
_12 = ((*_1).3: u32); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:21
|
||||
StorageLive(_13); // scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38
|
||||
_13 = ((*_2).3: u32); // scope 0 at $DIR/chained_comparison.rs:+10:25: +10:38
|
||||
_14 = Ne(move _12, move _13); // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
|
||||
StorageDead(_13); // scope 0 at $DIR/chained_comparison.rs:+10:37: +10:38
|
||||
StorageDead(_12); // scope 0 at $DIR/chained_comparison.rs:+10:37: +10:38
|
||||
switchInt(move _14) -> [0: bb4, otherwise: bb7]; // scope 0 at $DIR/chained_comparison.rs:+10:8: +10:38
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+12:5: +12:6
|
||||
StorageLive(_17); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
|
||||
StorageLive(_15); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17
|
||||
_15 = ((*_1).4: u32); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:17
|
||||
StorageLive(_16); // scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30
|
||||
_16 = ((*_2).4: u32); // scope 0 at $DIR/chained_comparison.rs:+13:21: +13:30
|
||||
_17 = Ne(move _15, move _16); // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
|
||||
StorageDead(_16); // scope 0 at $DIR/chained_comparison.rs:+13:29: +13:30
|
||||
StorageDead(_15); // scope 0 at $DIR/chained_comparison.rs:+13:29: +13:30
|
||||
switchInt(move _17) -> [0: bb5, otherwise: bb6]; // scope 0 at $DIR/chained_comparison.rs:+13:8: +13:30
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+15:5: +15:6
|
||||
_0 = const true; // scope 0 at $DIR/chained_comparison.rs:+16:5: +16:9
|
||||
goto -> bb11; // scope 0 at $DIR/chained_comparison.rs:+17:2: +17:2
|
||||
}
|
||||
|
||||
bb6: {
|
||||
_0 = const false; // scope 0 at $DIR/chained_comparison.rs:+14:16: +14:21
|
||||
StorageDead(_17); // scope 0 at $DIR/chained_comparison.rs:+15:5: +15:6
|
||||
goto -> bb11; // scope 0 at no-location
|
||||
}
|
||||
|
||||
bb7: {
|
||||
_0 = const false; // scope 0 at $DIR/chained_comparison.rs:+11:16: +11:21
|
||||
StorageDead(_14); // scope 0 at $DIR/chained_comparison.rs:+12:5: +12:6
|
||||
goto -> bb11; // scope 0 at no-location
|
||||
}
|
||||
|
||||
bb8: {
|
||||
_0 = const false; // scope 0 at $DIR/chained_comparison.rs:+8:16: +8:21
|
||||
StorageDead(_11); // scope 0 at $DIR/chained_comparison.rs:+9:5: +9:6
|
||||
goto -> bb11; // scope 0 at no-location
|
||||
}
|
||||
|
||||
bb9: {
|
||||
_0 = const false; // scope 0 at $DIR/chained_comparison.rs:+5:16: +5:21
|
||||
StorageDead(_8); // scope 0 at $DIR/chained_comparison.rs:+6:5: +6:6
|
||||
goto -> bb11; // scope 0 at no-location
|
||||
}
|
||||
|
||||
bb10: {
|
||||
_0 = const false; // scope 0 at $DIR/chained_comparison.rs:+2:16: +2:21
|
||||
StorageDead(_5); // scope 0 at $DIR/chained_comparison.rs:+3:5: +3:6
|
||||
goto -> bb11; // scope 0 at no-location
|
||||
}
|
||||
|
||||
bb11: {
|
||||
return; // scope 0 at $DIR/chained_comparison.rs:+17:2: +17:2
|
||||
}
|
||||
}
|
54
tests/mir-opt/pre-codegen/chained_comparison.rs
Normal file
54
tests/mir-opt/pre-codegen/chained_comparison.rs
Normal file
@ -0,0 +1,54 @@
|
||||
// compile-flags: -O -Zmir-opt-level=2 -Cdebuginfo=2
|
||||
// ignore-debug
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub struct Blueprint {
|
||||
pub fuel_tank_size: u32,
|
||||
pub payload: u32,
|
||||
pub wheel_diameter: u32,
|
||||
pub wheel_width: u32,
|
||||
pub storage: u32,
|
||||
}
|
||||
|
||||
// Equivalent of #[derive(PartialEq)]
|
||||
pub fn naive(a: &Blueprint, b: &Blueprint) -> bool {
|
||||
(a.fuel_tank_size == b.fuel_tank_size)
|
||||
&& (a.payload == b.payload)
|
||||
&& (a.wheel_diameter == b.wheel_diameter)
|
||||
&& (a.wheel_width == b.wheel_width)
|
||||
&& (a.storage == b.storage)
|
||||
}
|
||||
|
||||
// Optimizes good but changes semantics
|
||||
pub fn bitand(a: &Blueprint, b: &Blueprint) -> bool {
|
||||
(a.fuel_tank_size == b.fuel_tank_size)
|
||||
& (a.payload == b.payload)
|
||||
& (a.wheel_diameter == b.wheel_diameter)
|
||||
& (a.wheel_width == b.wheel_width)
|
||||
& (a.storage == b.storage)
|
||||
}
|
||||
|
||||
// Optimizes good and have same semantics as PartialEq
|
||||
pub fn returning(a: &Blueprint, b: &Blueprint) -> bool {
|
||||
if a.fuel_tank_size != b.fuel_tank_size {
|
||||
return false;
|
||||
}
|
||||
if a.payload != b.payload {
|
||||
return false;
|
||||
}
|
||||
if a.wheel_diameter != b.wheel_diameter {
|
||||
return false;
|
||||
}
|
||||
if a.wheel_width != b.wheel_width {
|
||||
return false;
|
||||
}
|
||||
if a.storage != b.storage {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
// EMIT_MIR chained_comparison.naive.PreCodegen.after.mir
|
||||
// EMIT_MIR chained_comparison.bitand.PreCodegen.after.mir
|
||||
// EMIT_MIR chained_comparison.returning.PreCodegen.after.mir
|
Loading…
x
Reference in New Issue
Block a user