1
Fork 0

Do not unify dereferences in GVN.

This commit is contained in:
Camille GILLOT 2024-11-01 14:32:09 +00:00 committed by Ralf Jung
parent 2cc0ee65d9
commit 917dd82628
31 changed files with 351 additions and 389 deletions

View file

@ -638,7 +638,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
let proj = match proj { let proj = match proj {
ProjectionElem::Deref => { ProjectionElem::Deref => {
let ty = place.ty(self.local_decls, self.tcx).ty; let ty = place.ty(self.local_decls, self.tcx).ty;
if let Some(Mutability::Not) = ty.ref_mutability() // unsound: https://github.com/rust-lang/rust/issues/130853
if self.tcx.sess.opts.unstable_opts.unsound_mir_opts
&& let Some(Mutability::Not) = ty.ref_mutability()
&& let Some(pointee_ty) = ty.builtin_deref(true) && let Some(pointee_ty) = ty.builtin_deref(true)
&& pointee_ty.is_freeze(self.tcx, self.typing_env()) && pointee_ty.is_freeze(self.tcx, self.typing_env())
{ {

View file

@ -14,23 +14,19 @@
bb0: { bb0: {
StorageLive(_1); StorageLive(_1);
- StorageLive(_2); StorageLive(_2);
- StorageLive(_3); - StorageLive(_3);
+ nop;
+ nop; + nop;
_3 = const {ALLOC0: &u8}; _3 = const {ALLOC0: &u8};
- _2 = copy (*_3); _2 = copy (*_3);
+ _2 = const 2_u8;
StorageLive(_4); StorageLive(_4);
StorageLive(_5); StorageLive(_5);
_5 = const {ALLOC0: &u8}; _5 = const {ALLOC0: &u8};
- _4 = copy (*_5); - _4 = copy (*_5);
- _1 = Add(move _2, move _4); + _4 = copy (*_3);
+ _4 = const 2_u8; _1 = Add(move _2, move _4);
+ _1 = const 4_u8;
StorageDead(_4); StorageDead(_4);
- StorageDead(_2); StorageDead(_2);
+ nop;
StorageDead(_5); StorageDead(_5);
- StorageDead(_3); - StorageDead(_3);
+ nop; + nop;

View file

@ -6,6 +6,6 @@ static FOO: u8 = 2;
fn main() { fn main() {
// CHECK-LABEL: fn main( // CHECK-LABEL: fn main(
// CHECK: debug x => [[x:_.*]]; // CHECK: debug x => [[x:_.*]];
// CHECK: [[x]] = const 4_u8; // CHECK-NOT: [[x]] = const 4_u8;
let x = FOO + FOO; let x = FOO + FOO;
} }

View file

@ -16,8 +16,7 @@
StorageLive(_2); StorageLive(_2);
_4 = const main::promoted[0]; _4 = const main::promoted[0];
_2 = &(*_4); _2 = &(*_4);
- _1 = copy (*_2); _1 = copy (*_2);
+ _1 = const 4_i32;
StorageDead(_2); StorageDead(_2);
_0 = const (); _0 = const ();
StorageDead(_1); StorageDead(_1);

View file

@ -16,8 +16,7 @@
StorageLive(_2); StorageLive(_2);
_4 = const main::promoted[0]; _4 = const main::promoted[0];
_2 = &((*_4).1: i32); _2 = &((*_4).1: i32);
- _1 = copy (*_2); _1 = copy (*_2);
+ _1 = const 5_i32;
StorageDead(_2); StorageDead(_2);
_0 = const (); _0 = const ();
StorageDead(_1); StorageDead(_1);

View file

@ -5,6 +5,6 @@
fn main() { fn main() {
// CHECK-LABEL: fn main( // CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]]; // CHECK: debug a => [[a:_.*]];
// CHECK: [[a]] = const 5_i32; // CHECK-NOT: [[a]] = const 5_i32;
let a = *(&(4, 5).1); let a = *(&(4, 5).1);
} }

View file

@ -30,17 +30,16 @@
StorageDead(_3); StorageDead(_3);
StorageLive(_6); StorageLive(_6);
_6 = const 1_usize; _6 = const 1_usize;
- _7 = Len((*_2)); _7 = Len((*_2));
- _8 = Lt(copy _6, copy _7); - _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable];
+ _7 = const 3_usize; + _8 = Lt(const 1_usize, copy _7);
+ _8 = const true; + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable];
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
} }
bb1: { bb1: {
- _1 = copy (*_2)[_6]; - _1 = copy (*_2)[_6];
+ _1 = const 2_u32; + _1 = copy (*_2)[1 of 2];
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
StorageDead(_2); StorageDead(_2);

View file

@ -30,17 +30,16 @@
StorageDead(_3); StorageDead(_3);
StorageLive(_6); StorageLive(_6);
_6 = const 1_usize; _6 = const 1_usize;
- _7 = Len((*_2)); _7 = Len((*_2));
- _8 = Lt(copy _6, copy _7); - _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue];
+ _7 = const 3_usize; + _8 = Lt(const 1_usize, copy _7);
+ _8 = const true; + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue];
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
} }
bb1: { bb1: {
- _1 = copy (*_2)[_6]; - _1 = copy (*_2)[_6];
+ _1 = const 2_u32; + _1 = copy (*_2)[1 of 2];
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
StorageDead(_2); StorageDead(_2);

View file

@ -30,17 +30,16 @@
StorageDead(_3); StorageDead(_3);
StorageLive(_6); StorageLive(_6);
_6 = const 1_usize; _6 = const 1_usize;
- _7 = Len((*_2)); _7 = Len((*_2));
- _8 = Lt(copy _6, copy _7); - _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable]; - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind unreachable];
+ _7 = const 3_usize; + _8 = Lt(const 1_usize, copy _7);
+ _8 = const true; + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind unreachable];
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind unreachable];
} }
bb1: { bb1: {
- _1 = copy (*_2)[_6]; - _1 = copy (*_2)[_6];
+ _1 = const 2_u32; + _1 = copy (*_2)[1 of 2];
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
StorageDead(_2); StorageDead(_2);

View file

@ -30,17 +30,16 @@
StorageDead(_3); StorageDead(_3);
StorageLive(_6); StorageLive(_6);
_6 = const 1_usize; _6 = const 1_usize;
- _7 = Len((*_2)); _7 = Len((*_2));
- _8 = Lt(copy _6, copy _7); - _8 = Lt(copy _6, copy _7);
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue]; - assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, copy _6) -> [success: bb1, unwind continue];
+ _7 = const 3_usize; + _8 = Lt(const 1_usize, copy _7);
+ _8 = const true; + assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 1_usize) -> [success: bb1, unwind continue];
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 1_usize) -> [success: bb1, unwind continue];
} }
bb1: { bb1: {
- _1 = copy (*_2)[_6]; - _1 = copy (*_2)[_6];
+ _1 = const 2_u32; + _1 = copy (*_2)[1 of 2];
StorageDead(_6); StorageDead(_6);
StorageDead(_4); StorageDead(_4);
StorageDead(_2); StorageDead(_2);

View file

@ -8,7 +8,7 @@ fn main() {
// CHECK-LABEL: fn main( // CHECK-LABEL: fn main(
// CHECK: debug a => [[a:_.*]]; // CHECK: debug a => [[a:_.*]];
// CHECK: [[slice:_.*]] = copy {{.*}} as &[u32] (PointerCoercion(Unsize, AsCast)); // CHECK: [[slice:_.*]] = copy {{.*}} as &[u32] (PointerCoercion(Unsize, AsCast));
// CHECK: assert(const true, // CHECK-NOT: assert(const true,
// CHECK: [[a]] = const 2_u32; // CHECK-NOT: [[a]] = const 2_u32;
let a = (&[1u32, 2, 3] as &[u32])[1]; let a = (&[1u32, 2, 3] as &[u32])[1];
} }

View file

@ -18,8 +18,7 @@
} }
bb2: { bb2: {
- _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind unreachable]; _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind unreachable];
+ _0 = opaque::<T>(copy _1) -> [return: bb3, unwind unreachable];
} }
bb3: { bb3: {

View file

@ -18,8 +18,7 @@
} }
bb2: { bb2: {
- _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind continue]; _0 = opaque::<T>(copy (*_3)) -> [return: bb3, unwind continue];
+ _0 = opaque::<T>(copy _1) -> [return: bb3, unwind continue];
} }
bb3: { bb3: {

View file

@ -107,23 +107,18 @@
StorageLive(_18); StorageLive(_18);
_18 = &(*_1); _18 = &(*_1);
StorageLive(_19); StorageLive(_19);
- StorageLive(_20); StorageLive(_20);
+ nop;
_20 = copy (*_18); _20 = copy (*_18);
- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable]; _19 = opaque::<u32>(move _20) -> [return: bb7, unwind unreachable];
+ _19 = opaque::<u32>(copy _20) -> [return: bb7, unwind unreachable];
} }
bb7: { bb7: {
- StorageDead(_20); StorageDead(_20);
+ nop;
StorageDead(_19); StorageDead(_19);
StorageLive(_21); StorageLive(_21);
StorageLive(_22); StorageLive(_22);
- _22 = copy (*_18); _22 = copy (*_18);
- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable]; _21 = opaque::<u32>(move _22) -> [return: bb8, unwind unreachable];
+ _22 = copy _20;
+ _21 = opaque::<u32>(copy _20) -> [return: bb8, unwind unreachable];
} }
bb8: { bb8: {
@ -157,23 +152,18 @@
StorageDead(_28); StorageDead(_28);
StorageDead(_27); StorageDead(_27);
StorageLive(_29); StorageLive(_29);
- StorageLive(_30); StorageLive(_30);
+ nop;
_30 = copy ((*_3).0: u32); _30 = copy ((*_3).0: u32);
- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable]; _29 = opaque::<u32>(move _30) -> [return: bb12, unwind unreachable];
+ _29 = opaque::<u32>(copy _30) -> [return: bb12, unwind unreachable];
} }
bb12: { bb12: {
- StorageDead(_30); StorageDead(_30);
+ nop;
StorageDead(_29); StorageDead(_29);
StorageLive(_31); StorageLive(_31);
StorageLive(_32); StorageLive(_32);
- _32 = copy ((*_3).0: u32); _32 = copy ((*_3).0: u32);
- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable]; _31 = opaque::<u32>(move _32) -> [return: bb13, unwind unreachable];
+ _32 = copy _30;
+ _31 = opaque::<u32>(copy _30) -> [return: bb13, unwind unreachable];
} }
bb13: { bb13: {

View file

@ -107,23 +107,18 @@
StorageLive(_18); StorageLive(_18);
_18 = &(*_1); _18 = &(*_1);
StorageLive(_19); StorageLive(_19);
- StorageLive(_20); StorageLive(_20);
+ nop;
_20 = copy (*_18); _20 = copy (*_18);
- _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue]; _19 = opaque::<u32>(move _20) -> [return: bb7, unwind continue];
+ _19 = opaque::<u32>(copy _20) -> [return: bb7, unwind continue];
} }
bb7: { bb7: {
- StorageDead(_20); StorageDead(_20);
+ nop;
StorageDead(_19); StorageDead(_19);
StorageLive(_21); StorageLive(_21);
StorageLive(_22); StorageLive(_22);
- _22 = copy (*_18); _22 = copy (*_18);
- _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue]; _21 = opaque::<u32>(move _22) -> [return: bb8, unwind continue];
+ _22 = copy _20;
+ _21 = opaque::<u32>(copy _20) -> [return: bb8, unwind continue];
} }
bb8: { bb8: {
@ -157,23 +152,18 @@
StorageDead(_28); StorageDead(_28);
StorageDead(_27); StorageDead(_27);
StorageLive(_29); StorageLive(_29);
- StorageLive(_30); StorageLive(_30);
+ nop;
_30 = copy ((*_3).0: u32); _30 = copy ((*_3).0: u32);
- _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue]; _29 = opaque::<u32>(move _30) -> [return: bb12, unwind continue];
+ _29 = opaque::<u32>(copy _30) -> [return: bb12, unwind continue];
} }
bb12: { bb12: {
- StorageDead(_30); StorageDead(_30);
+ nop;
StorageDead(_29); StorageDead(_29);
StorageLive(_31); StorageLive(_31);
StorageLive(_32); StorageLive(_32);
- _32 = copy ((*_3).0: u32); _32 = copy ((*_3).0: u32);
- _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue]; _31 = opaque::<u32>(move _32) -> [return: bb13, unwind continue];
+ _32 = copy _30;
+ _31 = opaque::<u32>(copy _30) -> [return: bb13, unwind continue];
} }
bb13: { bb13: {

View file

@ -8,10 +8,10 @@
let mut _3: fn(u8) -> u8; let mut _3: fn(u8) -> u8;
let _5: (); let _5: ();
let mut _6: fn(u8) -> u8; let mut _6: fn(u8) -> u8;
let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21}; let mut _9: {closure@$DIR/gvn.rs:620:19: 620:21};
let _10: (); let _10: ();
let mut _11: fn(); let mut _11: fn();
let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21}; let mut _13: {closure@$DIR/gvn.rs:620:19: 620:21};
let _14: (); let _14: ();
let mut _15: fn(); let mut _15: fn();
scope 1 { scope 1 {
@ -19,7 +19,7 @@
let _4: fn(u8) -> u8; let _4: fn(u8) -> u8;
scope 2 { scope 2 {
debug g => _4; debug g => _4;
let _7: {closure@$DIR/gvn.rs:614:19: 614:21}; let _7: {closure@$DIR/gvn.rs:620:19: 620:21};
scope 3 { scope 3 {
debug closure => _7; debug closure => _7;
let _8: fn(); let _8: fn();
@ -62,16 +62,16 @@
StorageDead(_6); StorageDead(_6);
StorageDead(_5); StorageDead(_5);
- StorageLive(_7); - StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:614:19: 614:21}; - _7 = {closure@$DIR/gvn.rs:620:19: 620:21};
- StorageLive(_8); - StorageLive(_8);
+ nop; + nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + _7 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21};
+ nop; + nop;
StorageLive(_9); StorageLive(_9);
- _9 = copy _7; - _9 = copy _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + _9 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); + _8 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
StorageDead(_9); StorageDead(_9);
StorageLive(_10); StorageLive(_10);
StorageLive(_11); StorageLive(_11);
@ -88,8 +88,8 @@
StorageLive(_13); StorageLive(_13);
- _13 = copy _7; - _13 = copy _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + _13 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); + _12 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
StorageDead(_13); StorageDead(_13);
StorageLive(_14); StorageLive(_14);
StorageLive(_15); StorageLive(_15);

View file

@ -8,10 +8,10 @@
let mut _3: fn(u8) -> u8; let mut _3: fn(u8) -> u8;
let _5: (); let _5: ();
let mut _6: fn(u8) -> u8; let mut _6: fn(u8) -> u8;
let mut _9: {closure@$DIR/gvn.rs:614:19: 614:21}; let mut _9: {closure@$DIR/gvn.rs:620:19: 620:21};
let _10: (); let _10: ();
let mut _11: fn(); let mut _11: fn();
let mut _13: {closure@$DIR/gvn.rs:614:19: 614:21}; let mut _13: {closure@$DIR/gvn.rs:620:19: 620:21};
let _14: (); let _14: ();
let mut _15: fn(); let mut _15: fn();
scope 1 { scope 1 {
@ -19,7 +19,7 @@
let _4: fn(u8) -> u8; let _4: fn(u8) -> u8;
scope 2 { scope 2 {
debug g => _4; debug g => _4;
let _7: {closure@$DIR/gvn.rs:614:19: 614:21}; let _7: {closure@$DIR/gvn.rs:620:19: 620:21};
scope 3 { scope 3 {
debug closure => _7; debug closure => _7;
let _8: fn(); let _8: fn();
@ -62,16 +62,16 @@
StorageDead(_6); StorageDead(_6);
StorageDead(_5); StorageDead(_5);
- StorageLive(_7); - StorageLive(_7);
- _7 = {closure@$DIR/gvn.rs:614:19: 614:21}; - _7 = {closure@$DIR/gvn.rs:620:19: 620:21};
- StorageLive(_8); - StorageLive(_8);
+ nop; + nop;
+ _7 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + _7 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21};
+ nop; + nop;
StorageLive(_9); StorageLive(_9);
- _9 = copy _7; - _9 = copy _7;
- _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); - _8 = move _9 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
+ _9 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + _9 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21};
+ _8 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); + _8 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
StorageDead(_9); StorageDead(_9);
StorageLive(_10); StorageLive(_10);
StorageLive(_11); StorageLive(_11);
@ -88,8 +88,8 @@
StorageLive(_13); StorageLive(_13);
- _13 = copy _7; - _13 = copy _7;
- _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); - _12 = move _13 as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
+ _13 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21}; + _13 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21};
+ _12 = const ZeroSized: {closure@$DIR/gvn.rs:614:19: 614:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast)); + _12 = const ZeroSized: {closure@$DIR/gvn.rs:620:19: 620:21} as fn() (PointerCoercion(ClosureFnPointer(Safe), AsCast));
StorageDead(_13); StorageDead(_13);
StorageLive(_14); StorageLive(_14);
StorageLive(_15); StorageLive(_15);

View file

@ -99,12 +99,14 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
opaque((x * y) - y); opaque((x * y) - y);
opaque((x * y) - y); opaque((x * y) - y);
// We can substitute through an immutable reference too. // We cannot substitute through an immutable reference.
// CHECK: [[ref:_.*]] = &_3; // CHECK: [[ref:_.*]] = &_3;
// CHECK: [[deref:_.*]] = copy (*[[ref]]); // CHECK: [[deref:_.*]] = copy (*[[ref]]);
// CHECK: [[addref:_.*]] = Add(copy [[deref]], copy _1); // CHECK: [[addref:_.*]] = Add(move [[deref]], copy _1);
// CHECK: opaque::<u64>(copy [[addref]]) // CHECK: opaque::<u64>(move [[addref]])
// CHECK: opaque::<u64>(copy [[addref]]) // CHECK: [[deref2:_.*]] = copy (*[[ref]]);
// CHECK: [[addref2:_.*]] = Add(move [[deref2]], copy _1);
// CHECK: opaque::<u64>(move [[addref2]])
let a = &z; let a = &z;
opaque(*a + x); opaque(*a + x);
opaque(*a + x); opaque(*a + x);
@ -137,13 +139,15 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) {
opaque(*d + x); opaque(*d + x);
} }
// We can substitute again, but not with the earlier computations. // We still cannot substitute again, and never with the earlier computations.
// Important: `e` is not `a`! // Important: `e` is not `a`!
// CHECK: [[ref2:_.*]] = &_3; // CHECK: [[ref2:_.*]] = &_3;
// CHECK: [[deref2:_.*]] = copy (*[[ref2]]); // CHECK: [[deref2:_.*]] = copy (*[[ref2]]);
// CHECK: [[addref2:_.*]] = Add(copy [[deref2]], copy _1); // CHECK: [[addref2:_.*]] = Add(move [[deref2]], copy _1);
// CHECK: opaque::<u64>(copy [[addref2]]) // CHECK: opaque::<u64>(move [[addref2]])
// CHECK: opaque::<u64>(copy [[addref2]]) // CHECK: [[deref3:_.*]] = copy (*[[ref2]]);
// CHECK: [[addref3:_.*]] = Add(move [[deref3]], copy _1);
// CHECK: opaque::<u64>(move [[addref3]])
let e = &z; let e = &z;
opaque(*e + x); opaque(*e + x);
opaque(*e + x); opaque(*e + x);
@ -495,15 +499,16 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) {
unsafe { opaque(*z) }; unsafe { opaque(*z) };
unsafe { opaque(*z) }; unsafe { opaque(*z) };
// We can reuse dereferences of `&Freeze`. // Do not reuse dereferences of `&Freeze`.
// CHECK: [[ref:_.*]] = &(*_1); // CHECK: [[ref:_.*]] = &(*_1);
// CHECK: [[st7:_.*]] = copy (*[[ref]]); // CHECK: [[st7:_.*]] = copy (*[[ref]]);
// CHECK: opaque::<u32>(copy [[st7]]) // CHECK: opaque::<u32>(move [[st7]])
// CHECK: opaque::<u32>(copy [[st7]]) // CHECK: [[st8:_.*]] = copy (*[[ref]]);
// CHECK: opaque::<u32>(move [[st8]])
let z = &*t; let z = &*t;
opaque(*z); opaque(*z);
opaque(*z); opaque(*z);
// But not in reborrows. // Not in reborrows either.
// CHECK: [[reborrow:_.*]] = &(*[[ref]]); // CHECK: [[reborrow:_.*]] = &(*[[ref]]);
// CHECK: opaque::<&u32>(move [[reborrow]]) // CHECK: opaque::<&u32>(move [[reborrow]])
opaque(&*z); opaque(&*z);
@ -516,10 +521,11 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S<u32>) {
opaque(*u); opaque(*u);
opaque(*u); opaque(*u);
// `*s` is not Copy, but `(*s).0` is, so we can reuse. // `*s` is not Copy, but `(*s).0` is, but we still cannot reuse.
// CHECK: [[st10:_.*]] = copy ((*_3).0: u32); // CHECK: [[st10:_.*]] = copy ((*_3).0: u32);
// CHECK: opaque::<u32>(copy [[st10]]) // CHECK: opaque::<u32>(move [[st10]])
// CHECK: opaque::<u32>(copy [[st10]]) // CHECK: [[st11:_.*]] = copy ((*_3).0: u32);
// CHECK: opaque::<u32>(move [[st11]])
opaque(s.0); opaque(s.0);
opaque(s.0); opaque(s.0);
} }
@ -736,7 +742,7 @@ fn borrowed<T: Copy + Freeze>(x: T) {
// CHECK: bb1: { // CHECK: bb1: {
// CHECK-NEXT: _0 = opaque::<T>(copy _1) // CHECK-NEXT: _0 = opaque::<T>(copy _1)
// CHECK: bb2: { // CHECK: bb2: {
// CHECK-NEXT: _0 = opaque::<T>(copy _1) // CHECK-NEXT: _0 = opaque::<T>(copy (*_3))
mir! { mir! {
{ {
let a = x; let a = x;

View file

@ -111,9 +111,8 @@
StorageLive(_7); StorageLive(_7);
StorageLive(_8); StorageLive(_8);
- StorageLive(_9); - StorageLive(_9);
- StorageLive(_10);
+ nop;
+ nop; + nop;
StorageLive(_10);
StorageLive(_11); StorageLive(_11);
_11 = &(*_1); _11 = &(*_1);
_10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind unreachable]; _10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind unreachable];
@ -123,9 +122,8 @@
StorageDead(_11); StorageDead(_11);
_9 = &_10; _9 = &_10;
- StorageLive(_12); - StorageLive(_12);
- StorageLive(_13);
+ nop;
+ nop; + nop;
StorageLive(_13);
StorageLive(_14); StorageLive(_14);
- _14 = &(*_4); - _14 = &(*_4);
+ _14 = &(*_1); + _14 = &(*_1);
@ -150,12 +148,11 @@
StorageLive(_17); StorageLive(_17);
StorageLive(_18); StorageLive(_18);
- _18 = copy (*_15); - _18 = copy (*_15);
+ _18 = copy _10; + _18 = copy (*_9);
StorageLive(_19); StorageLive(_19);
- _19 = copy (*_16); - _19 = copy (*_16);
- _17 = Eq(move _18, move _19); + _19 = copy (*_12);
+ _19 = copy _13; _17 = Eq(move _18, move _19);
+ _17 = Eq(copy _10, copy _13);
switchInt(move _17) -> [0: bb6, otherwise: bb5]; switchInt(move _17) -> [0: bb6, otherwise: bb5];
} }
@ -166,10 +163,8 @@
StorageDead(_17); StorageDead(_17);
StorageDead(_16); StorageDead(_16);
StorageDead(_15); StorageDead(_15);
- StorageDead(_13); StorageDead(_13);
- StorageDead(_10); StorageDead(_10);
+ nop;
+ nop;
StorageDead(_8); StorageDead(_8);
StorageDead(_7); StorageDead(_7);
- StorageLive(_29); - StorageLive(_29);
@ -218,9 +213,8 @@
StorageLive(_33); StorageLive(_33);
StorageLive(_34); StorageLive(_34);
- StorageLive(_35); - StorageLive(_35);
- StorageLive(_36);
+ nop;
+ nop; + nop;
StorageLive(_36);
StorageLive(_37); StorageLive(_37);
_37 = &(*_1); _37 = &(*_1);
_36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind unreachable]; _36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind unreachable];
@ -230,9 +224,8 @@
StorageDead(_37); StorageDead(_37);
_35 = &_36; _35 = &_36;
- StorageLive(_38); - StorageLive(_38);
- StorageLive(_39);
+ nop;
+ nop; + nop;
StorageLive(_39);
StorageLive(_40); StorageLive(_40);
_40 = &(*_29); _40 = &(*_29);
_39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind unreachable]; _39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind unreachable];
@ -256,12 +249,11 @@
StorageLive(_43); StorageLive(_43);
StorageLive(_44); StorageLive(_44);
- _44 = copy (*_41); - _44 = copy (*_41);
+ _44 = copy _36; + _44 = copy (*_35);
StorageLive(_45); StorageLive(_45);
- _45 = copy (*_42); - _45 = copy (*_42);
- _43 = Eq(move _44, move _45); + _45 = copy (*_38);
+ _45 = copy _39; _43 = Eq(move _44, move _45);
+ _43 = Eq(copy _36, copy _39);
switchInt(move _43) -> [0: bb11, otherwise: bb10]; switchInt(move _43) -> [0: bb11, otherwise: bb10];
} }
@ -272,10 +264,8 @@
StorageDead(_43); StorageDead(_43);
StorageDead(_42); StorageDead(_42);
StorageDead(_41); StorageDead(_41);
- StorageDead(_39); StorageDead(_39);
- StorageDead(_36); StorageDead(_36);
+ nop;
+ nop;
StorageDead(_34); StorageDead(_34);
StorageDead(_33); StorageDead(_33);
_0 = const (); _0 = const ();

View file

@ -111,9 +111,8 @@
StorageLive(_7); StorageLive(_7);
StorageLive(_8); StorageLive(_8);
- StorageLive(_9); - StorageLive(_9);
- StorageLive(_10);
+ nop;
+ nop; + nop;
StorageLive(_10);
StorageLive(_11); StorageLive(_11);
_11 = &(*_1); _11 = &(*_1);
_10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind continue]; _10 = core::str::<impl str>::as_ptr(move _11) -> [return: bb3, unwind continue];
@ -123,9 +122,8 @@
StorageDead(_11); StorageDead(_11);
_9 = &_10; _9 = &_10;
- StorageLive(_12); - StorageLive(_12);
- StorageLive(_13);
+ nop;
+ nop; + nop;
StorageLive(_13);
StorageLive(_14); StorageLive(_14);
- _14 = &(*_4); - _14 = &(*_4);
+ _14 = &(*_1); + _14 = &(*_1);
@ -150,12 +148,11 @@
StorageLive(_17); StorageLive(_17);
StorageLive(_18); StorageLive(_18);
- _18 = copy (*_15); - _18 = copy (*_15);
+ _18 = copy _10; + _18 = copy (*_9);
StorageLive(_19); StorageLive(_19);
- _19 = copy (*_16); - _19 = copy (*_16);
- _17 = Eq(move _18, move _19); + _19 = copy (*_12);
+ _19 = copy _13; _17 = Eq(move _18, move _19);
+ _17 = Eq(copy _10, copy _13);
switchInt(move _17) -> [0: bb6, otherwise: bb5]; switchInt(move _17) -> [0: bb6, otherwise: bb5];
} }
@ -166,10 +163,8 @@
StorageDead(_17); StorageDead(_17);
StorageDead(_16); StorageDead(_16);
StorageDead(_15); StorageDead(_15);
- StorageDead(_13); StorageDead(_13);
- StorageDead(_10); StorageDead(_10);
+ nop;
+ nop;
StorageDead(_8); StorageDead(_8);
StorageDead(_7); StorageDead(_7);
- StorageLive(_29); - StorageLive(_29);
@ -218,9 +213,8 @@
StorageLive(_33); StorageLive(_33);
StorageLive(_34); StorageLive(_34);
- StorageLive(_35); - StorageLive(_35);
- StorageLive(_36);
+ nop;
+ nop; + nop;
StorageLive(_36);
StorageLive(_37); StorageLive(_37);
_37 = &(*_1); _37 = &(*_1);
_36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind continue]; _36 = core::str::<impl str>::as_ptr(move _37) -> [return: bb8, unwind continue];
@ -230,9 +224,8 @@
StorageDead(_37); StorageDead(_37);
_35 = &_36; _35 = &_36;
- StorageLive(_38); - StorageLive(_38);
- StorageLive(_39);
+ nop;
+ nop; + nop;
StorageLive(_39);
StorageLive(_40); StorageLive(_40);
_40 = &(*_29); _40 = &(*_29);
_39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind continue]; _39 = core::slice::<impl [u8]>::as_ptr(move _40) -> [return: bb9, unwind continue];
@ -256,12 +249,11 @@
StorageLive(_43); StorageLive(_43);
StorageLive(_44); StorageLive(_44);
- _44 = copy (*_41); - _44 = copy (*_41);
+ _44 = copy _36; + _44 = copy (*_35);
StorageLive(_45); StorageLive(_45);
- _45 = copy (*_42); - _45 = copy (*_42);
- _43 = Eq(move _44, move _45); + _45 = copy (*_38);
+ _45 = copy _39; _43 = Eq(move _44, move _45);
+ _43 = Eq(copy _36, copy _39);
switchInt(move _43) -> [0: bb11, otherwise: bb10]; switchInt(move _43) -> [0: bb11, otherwise: bb10];
} }
@ -272,10 +264,8 @@
StorageDead(_43); StorageDead(_43);
StorageDead(_42); StorageDead(_42);
StorageDead(_41); StorageDead(_41);
- StorageDead(_39); StorageDead(_39);
- StorageDead(_36); StorageDead(_36);
+ nop;
+ nop;
StorageDead(_34); StorageDead(_34);
StorageDead(_33); StorageDead(_33);
_0 = const (); _0 = const ();

View file

@ -758,39 +758,32 @@
StorageLive(_126); StorageLive(_126);
_126 = &_3; _126 = &_3;
StorageLive(_127); StorageLive(_127);
- StorageLive(_128); StorageLive(_128);
- StorageLive(_129); StorageLive(_129);
+ nop;
+ nop;
_129 = copy (*_126); _129 = copy (*_126);
StorageLive(_130); StorageLive(_130);
_130 = copy _1; _130 = copy _1;
- _128 = Add(move _129, move _130); - _128 = Add(move _129, move _130);
+ _128 = Add(copy _129, copy _1); + _128 = Add(move _129, copy _1);
StorageDead(_130); StorageDead(_130);
- StorageDead(_129); StorageDead(_129);
- _127 = opaque::<u64>(move _128) -> [return: bb35, unwind unreachable]; _127 = opaque::<u64>(move _128) -> [return: bb35, unwind unreachable];
+ nop;
+ _127 = opaque::<u64>(copy _128) -> [return: bb35, unwind unreachable];
} }
bb35: { bb35: {
- StorageDead(_128); StorageDead(_128);
+ nop;
StorageDead(_127); StorageDead(_127);
StorageLive(_131); StorageLive(_131);
StorageLive(_132); StorageLive(_132);
StorageLive(_133); StorageLive(_133);
- _133 = copy (*_126); _133 = copy (*_126);
+ _133 = copy _129;
StorageLive(_134); StorageLive(_134);
_134 = copy _1; _134 = copy _1;
- _132 = Add(move _133, move _134); - _132 = Add(move _133, move _134);
+ _132 = copy _128; + _132 = Add(move _133, copy _1);
StorageDead(_134); StorageDead(_134);
StorageDead(_133); StorageDead(_133);
- _131 = opaque::<u64>(move _132) -> [return: bb36, unwind unreachable]; _131 = opaque::<u64>(move _132) -> [return: bb36, unwind unreachable];
+ _131 = opaque::<u64>(copy _128) -> [return: bb36, unwind unreachable];
} }
bb36: { bb36: {
@ -906,39 +899,32 @@
StorageLive(_163); StorageLive(_163);
_163 = &_3; _163 = &_3;
StorageLive(_164); StorageLive(_164);
- StorageLive(_165); StorageLive(_165);
- StorageLive(_166); StorageLive(_166);
+ nop;
+ nop;
_166 = copy (*_163); _166 = copy (*_163);
StorageLive(_167); StorageLive(_167);
_167 = copy _1; _167 = copy _1;
- _165 = Add(move _166, move _167); - _165 = Add(move _166, move _167);
+ _165 = Add(copy _166, copy _1); + _165 = Add(move _166, copy _1);
StorageDead(_167); StorageDead(_167);
- StorageDead(_166); StorageDead(_166);
- _164 = opaque::<u64>(move _165) -> [return: bb43, unwind unreachable]; _164 = opaque::<u64>(move _165) -> [return: bb43, unwind unreachable];
+ nop;
+ _164 = opaque::<u64>(copy _165) -> [return: bb43, unwind unreachable];
} }
bb43: { bb43: {
- StorageDead(_165); StorageDead(_165);
+ nop;
StorageDead(_164); StorageDead(_164);
StorageLive(_168); StorageLive(_168);
StorageLive(_169); StorageLive(_169);
StorageLive(_170); StorageLive(_170);
- _170 = copy (*_163); _170 = copy (*_163);
+ _170 = copy _166;
StorageLive(_171); StorageLive(_171);
_171 = copy _1; _171 = copy _1;
- _169 = Add(move _170, move _171); - _169 = Add(move _170, move _171);
+ _169 = copy _165; + _169 = Add(move _170, copy _1);
StorageDead(_171); StorageDead(_171);
StorageDead(_170); StorageDead(_170);
- _168 = opaque::<u64>(move _169) -> [return: bb44, unwind unreachable]; _168 = opaque::<u64>(move _169) -> [return: bb44, unwind unreachable];
+ _168 = opaque::<u64>(copy _165) -> [return: bb44, unwind unreachable];
} }
bb44: { bb44: {

View file

@ -758,39 +758,32 @@
StorageLive(_126); StorageLive(_126);
_126 = &_3; _126 = &_3;
StorageLive(_127); StorageLive(_127);
- StorageLive(_128); StorageLive(_128);
- StorageLive(_129); StorageLive(_129);
+ nop;
+ nop;
_129 = copy (*_126); _129 = copy (*_126);
StorageLive(_130); StorageLive(_130);
_130 = copy _1; _130 = copy _1;
- _128 = Add(move _129, move _130); - _128 = Add(move _129, move _130);
+ _128 = Add(copy _129, copy _1); + _128 = Add(move _129, copy _1);
StorageDead(_130); StorageDead(_130);
- StorageDead(_129); StorageDead(_129);
- _127 = opaque::<u64>(move _128) -> [return: bb35, unwind continue]; _127 = opaque::<u64>(move _128) -> [return: bb35, unwind continue];
+ nop;
+ _127 = opaque::<u64>(copy _128) -> [return: bb35, unwind continue];
} }
bb35: { bb35: {
- StorageDead(_128); StorageDead(_128);
+ nop;
StorageDead(_127); StorageDead(_127);
StorageLive(_131); StorageLive(_131);
StorageLive(_132); StorageLive(_132);
StorageLive(_133); StorageLive(_133);
- _133 = copy (*_126); _133 = copy (*_126);
+ _133 = copy _129;
StorageLive(_134); StorageLive(_134);
_134 = copy _1; _134 = copy _1;
- _132 = Add(move _133, move _134); - _132 = Add(move _133, move _134);
+ _132 = copy _128; + _132 = Add(move _133, copy _1);
StorageDead(_134); StorageDead(_134);
StorageDead(_133); StorageDead(_133);
- _131 = opaque::<u64>(move _132) -> [return: bb36, unwind continue]; _131 = opaque::<u64>(move _132) -> [return: bb36, unwind continue];
+ _131 = opaque::<u64>(copy _128) -> [return: bb36, unwind continue];
} }
bb36: { bb36: {
@ -906,39 +899,32 @@
StorageLive(_163); StorageLive(_163);
_163 = &_3; _163 = &_3;
StorageLive(_164); StorageLive(_164);
- StorageLive(_165); StorageLive(_165);
- StorageLive(_166); StorageLive(_166);
+ nop;
+ nop;
_166 = copy (*_163); _166 = copy (*_163);
StorageLive(_167); StorageLive(_167);
_167 = copy _1; _167 = copy _1;
- _165 = Add(move _166, move _167); - _165 = Add(move _166, move _167);
+ _165 = Add(copy _166, copy _1); + _165 = Add(move _166, copy _1);
StorageDead(_167); StorageDead(_167);
- StorageDead(_166); StorageDead(_166);
- _164 = opaque::<u64>(move _165) -> [return: bb43, unwind continue]; _164 = opaque::<u64>(move _165) -> [return: bb43, unwind continue];
+ nop;
+ _164 = opaque::<u64>(copy _165) -> [return: bb43, unwind continue];
} }
bb43: { bb43: {
- StorageDead(_165); StorageDead(_165);
+ nop;
StorageDead(_164); StorageDead(_164);
StorageLive(_168); StorageLive(_168);
StorageLive(_169); StorageLive(_169);
StorageLive(_170); StorageLive(_170);
- _170 = copy (*_163); _170 = copy (*_163);
+ _170 = copy _166;
StorageLive(_171); StorageLive(_171);
_171 = copy _1; _171 = copy _1;
- _169 = Add(move _170, move _171); - _169 = Add(move _170, move _171);
+ _169 = copy _165; + _169 = Add(move _170, copy _1);
StorageDead(_171); StorageDead(_171);
StorageDead(_170); StorageDead(_170);
- _168 = opaque::<u64>(move _169) -> [return: bb44, unwind continue]; _168 = opaque::<u64>(move _169) -> [return: bb44, unwind continue];
+ _168 = opaque::<u64>(copy _165) -> [return: bb44, unwind continue];
} }
bb44: { bb44: {

View file

@ -17,16 +17,15 @@
StorageLive(_3); StorageLive(_3);
_5 = const f::promoted[0]; _5 = const f::promoted[0];
_3 = &(*_5); _3 = &(*_5);
- _2 = copy ((*_3).1: E); _2 = copy ((*_3).1: E);
+ _2 = copy ((*_5).1: E); - StorageLive(_1);
StorageLive(_1); + nop;
- _1 = copy ((_2 as A).1: u32); _1 = copy ((_2 as A).1: u32);
+ _1 = const 0_u32;
StorageDead(_3); StorageDead(_3);
StorageDead(_2); StorageDead(_2);
- _0 = copy _1; _0 = copy _1;
+ _0 = const 0_u32; - StorageDead(_1);
StorageDead(_1); + nop;
return; return;
} }
} }

View file

@ -17,16 +17,15 @@
StorageLive(_3); StorageLive(_3);
_5 = const f::promoted[0]; _5 = const f::promoted[0];
_3 = &(*_5); _3 = &(*_5);
- _2 = copy ((*_3).1: E); _2 = copy ((*_3).1: E);
+ _2 = copy ((*_5).1: E); - StorageLive(_1);
StorageLive(_1); + nop;
- _1 = copy ((_2 as A).1: u32); _1 = copy ((_2 as A).1: u32);
+ _1 = const 0_u32;
StorageDead(_3); StorageDead(_3);
StorageDead(_2); StorageDead(_2);
- _0 = copy _1; _0 = copy _1;
+ _0 = const 0_u32; - StorageDead(_1);
StorageDead(_1); + nop;
return; return;
} }
} }

View file

@ -2,7 +2,9 @@
fn src(x: &&u8) -> bool { fn src(x: &&u8) -> bool {
// CHECK-LABEL: fn src( // CHECK-LABEL: fn src(
// CHECK: _0 = const true; // CHECK-NOT: _0 = const true;
// CHECK: _0 = Eq({{.*}}, {{.*}});
// CHECK-NOT: _0 = const true;
let y = **x; let y = **x;
unsafe { unknown() }; unsafe { unknown() };
**x == y **x == y

View file

@ -26,13 +26,12 @@
bb1: { bb1: {
StorageLive(_4); StorageLive(_4);
- _7 = deref_copy (*_1); - _7 = deref_copy (*_1);
- _4 = copy (*_7); + _7 = copy (*_1);
+ _7 = copy _6; _4 = copy (*_7);
+ _4 = copy _2;
StorageLive(_5); StorageLive(_5);
_5 = copy _2; _5 = copy _2;
- _0 = Eq(move _4, move _5); - _0 = Eq(move _4, move _5);
+ _0 = const true; + _0 = Eq(move _4, copy _2);
StorageDead(_5); StorageDead(_5);
StorageDead(_4); StorageDead(_4);
- StorageDead(_2); - StorageDead(_2);

View file

@ -26,13 +26,12 @@
bb1: { bb1: {
StorageLive(_4); StorageLive(_4);
- _7 = deref_copy (*_1); - _7 = deref_copy (*_1);
- _4 = copy (*_7); + _7 = copy (*_1);
+ _7 = copy _6; _4 = copy (*_7);
+ _4 = copy _2;
StorageLive(_5); StorageLive(_5);
_5 = copy _2; _5 = copy _2;
- _0 = Eq(move _4, move _5); - _0 = Eq(move _4, move _5);
+ _0 = const true; + _0 = Eq(move _4, copy _2);
StorageDead(_5); StorageDead(_5);
StorageDead(_4); StorageDead(_4);
- StorageDead(_2); - StorageDead(_2);

View file

@ -6,6 +6,8 @@ fn src(_1: &&u8) -> bool {
let mut _2: &u8; let mut _2: &u8;
let _3: u8; let _3: u8;
let _4: (); let _4: ();
let mut _5: &u8;
let mut _6: u8;
scope 1 { scope 1 {
debug y => _3; debug y => _3;
} }
@ -17,7 +19,11 @@ fn src(_1: &&u8) -> bool {
} }
bb1: { bb1: {
_0 = const true; StorageLive(_6);
_5 = copy (*_1);
_6 = copy (*_5);
_0 = Eq(move _6, copy _3);
StorageDead(_6);
return; return;
} }
} }

View file

@ -6,6 +6,8 @@ fn src(_1: &&u8) -> bool {
let mut _2: &u8; let mut _2: &u8;
let _3: u8; let _3: u8;
let _4: (); let _4: ();
let mut _5: &u8;
let mut _6: u8;
scope 1 { scope 1 {
debug y => _3; debug y => _3;
} }
@ -17,7 +19,11 @@ fn src(_1: &&u8) -> bool {
} }
bb1: { bb1: {
_0 = const true; StorageLive(_6);
_5 = copy (*_1);
_6 = copy (*_5);
_0 = Eq(move _6, copy _3);
StorageDead(_6);
return; return;
} }
} }

View file

@ -4,65 +4,70 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
let mut _0: bool; let mut _0: bool;
let mut _3: &(usize, usize, usize, usize); let mut _3: &(usize, usize, usize, usize);
let _4: &usize; let _4: &usize;
let _5: &usize; let mut _5: &(usize, usize, usize, usize);
let _6: &usize; let _6: &usize;
let _7: &usize; let mut _7: &(usize, usize, usize, usize);
let mut _8: &&usize; let _8: &usize;
let _9: &usize; let mut _9: &(usize, usize, usize, usize);
let mut _10: &&usize; let _10: &usize;
let mut _13: bool; let mut _11: &&usize;
let mut _14: &&usize; let _12: &usize;
let _15: &usize; let mut _13: &&usize;
let mut _16: &&usize; let mut _16: bool;
let mut _19: bool; let mut _17: &&usize;
let mut _20: &&usize; let _18: &usize;
let _21: &usize; let mut _19: &&usize;
let mut _22: &&usize; let mut _22: bool;
let mut _23: bool; let mut _23: &&usize;
let mut _24: &&usize; let _24: &usize;
let _25: &usize; let mut _25: &&usize;
let mut _26: &&usize; let mut _28: bool;
let mut _29: &&usize;
let _30: &usize;
let mut _31: &&usize;
scope 1 { scope 1 {
debug a => _4; debug a => _4;
debug b => _5; debug b => _6;
debug c => _6; debug c => _8;
debug d => _7; debug d => _10;
scope 2 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) { scope 2 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _8; debug self => _11;
debug other => _10; debug other => _13;
scope 3 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { scope 3 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _4; debug self => _4;
debug other => _6; debug other => _8;
let mut _11: usize; let mut _14: usize;
let mut _12: usize; let mut _15: usize;
} }
} }
scope 4 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) { scope 4 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _14; debug self => _17;
debug other => _16; debug other => _19;
scope 5 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { scope 5 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _7; debug self => _10;
debug other => _5; debug other => _6;
let mut _17: usize; let mut _20: usize;
let mut _18: usize; let mut _21: usize;
} }
} }
scope 6 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) { scope 6 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _20; debug self => _23;
debug other => _22; debug other => _25;
scope 7 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { scope 7 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _6; debug self => _8;
debug other => _4; debug other => _4;
let mut _26: usize;
let mut _27: usize;
} }
} }
scope 8 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) { scope 8 (inlined std::cmp::impls::<impl PartialOrd for &usize>::le) {
debug self => _24; debug self => _29;
debug other => _26; debug other => _31;
scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) { scope 9 (inlined std::cmp::impls::<impl PartialOrd for usize>::le) {
debug self => _5; debug self => _6;
debug other => _7; debug other => _10;
let mut _27: usize; let mut _32: usize;
let mut _28: usize; let mut _33: usize;
} }
} }
} }
@ -70,116 +75,129 @@ fn variant_a::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:7:25: 7:39}, _2
bb0: { bb0: {
_3 = copy (*_2); _3 = copy (*_2);
_4 = &((*_3).0: usize); _4 = &((*_3).0: usize);
_5 = &((*_3).1: usize); _5 = copy (*_2);
_6 = &((*_3).2: usize); _6 = &((*_5).1: usize);
_7 = &((*_3).3: usize); _7 = copy (*_2);
_8 = &((*_7).2: usize);
_9 = copy (*_2);
_10 = &((*_9).3: usize);
StorageLive(_16);
StorageLive(_11);
_11 = &_4;
StorageLive(_13); StorageLive(_13);
StorageLive(_8); StorageLive(_12);
_8 = &_4; _12 = copy _8;
StorageLive(_10); _13 = &_12;
StorageLive(_9); StorageLive(_14);
_9 = copy _6; _14 = copy ((*_3).0: usize);
_10 = &_9; StorageLive(_15);
_11 = copy ((*_3).0: usize); _15 = copy ((*_7).2: usize);
_12 = copy ((*_3).2: usize); _16 = Le(move _14, move _15);
_13 = Le(copy _11, copy _12); StorageDead(_15);
switchInt(move _13) -> [0: bb1, otherwise: bb2]; StorageDead(_14);
switchInt(move _16) -> [0: bb1, otherwise: bb2];
} }
bb1: { bb1: {
StorageDead(_9); StorageDead(_12);
StorageDead(_10); StorageDead(_13);
StorageDead(_8); StorageDead(_11);
goto -> bb4; goto -> bb4;
} }
bb2: { bb2: {
StorageDead(_9); StorageDead(_12);
StorageDead(_10); StorageDead(_13);
StorageDead(_8); StorageDead(_11);
StorageLive(_19); StorageLive(_22);
StorageLive(_14);
_14 = &_7;
StorageLive(_16);
StorageLive(_15);
_15 = copy _5;
_16 = &_15;
StorageLive(_17); StorageLive(_17);
_17 = copy ((*_3).3: usize); _17 = &_10;
StorageLive(_19);
StorageLive(_18); StorageLive(_18);
_18 = copy ((*_3).1: usize); _18 = copy _6;
_19 = Le(move _17, move _18); _19 = &_18;
StorageDead(_18); StorageLive(_20);
StorageDead(_17); _20 = copy ((*_9).3: usize);
switchInt(move _19) -> [0: bb3, otherwise: bb8]; StorageLive(_21);
_21 = copy ((*_5).1: usize);
_22 = Le(move _20, move _21);
StorageDead(_21);
StorageDead(_20);
switchInt(move _22) -> [0: bb3, otherwise: bb8];
} }
bb3: { bb3: {
StorageDead(_15); StorageDead(_18);
StorageDead(_16); StorageDead(_19);
StorageDead(_14); StorageDead(_17);
goto -> bb4; goto -> bb4;
} }
bb4: { bb4: {
StorageLive(_28);
StorageLive(_23); StorageLive(_23);
StorageLive(_20); _23 = &_8;
_20 = &_6; StorageLive(_25);
StorageLive(_22); StorageLive(_24);
StorageLive(_21); _24 = copy _4;
_21 = copy _4; _25 = &_24;
_22 = &_21; StorageLive(_26);
_23 = Le(copy _12, copy _11); _26 = copy ((*_7).2: usize);
switchInt(move _23) -> [0: bb5, otherwise: bb6]; StorageLive(_27);
_27 = copy ((*_3).0: usize);
_28 = Le(move _26, move _27);
StorageDead(_27);
StorageDead(_26);
switchInt(move _28) -> [0: bb5, otherwise: bb6];
} }
bb5: { bb5: {
StorageDead(_21); StorageDead(_24);
StorageDead(_22); StorageDead(_25);
StorageDead(_20); StorageDead(_23);
_0 = const false; _0 = const false;
goto -> bb7; goto -> bb7;
} }
bb6: { bb6: {
StorageDead(_21);
StorageDead(_22);
StorageDead(_20);
StorageLive(_24);
_24 = &_5;
StorageLive(_26);
StorageLive(_25);
_25 = copy _7;
_26 = &_25;
StorageLive(_27);
_27 = copy ((*_3).1: usize);
StorageLive(_28);
_28 = copy ((*_3).3: usize);
_0 = Le(move _27, move _28);
StorageDead(_28);
StorageDead(_27);
StorageDead(_25);
StorageDead(_26);
StorageDead(_24); StorageDead(_24);
StorageDead(_25);
StorageDead(_23);
StorageLive(_29);
_29 = &_6;
StorageLive(_31);
StorageLive(_30);
_30 = copy _10;
_31 = &_30;
StorageLive(_32);
_32 = copy ((*_5).1: usize);
StorageLive(_33);
_33 = copy ((*_9).3: usize);
_0 = Le(move _32, move _33);
StorageDead(_33);
StorageDead(_32);
StorageDead(_30);
StorageDead(_31);
StorageDead(_29);
goto -> bb7; goto -> bb7;
} }
bb7: { bb7: {
StorageDead(_23); StorageDead(_28);
goto -> bb9; goto -> bb9;
} }
bb8: { bb8: {
StorageDead(_15); StorageDead(_18);
StorageDead(_16); StorageDead(_19);
StorageDead(_14); StorageDead(_17);
_0 = const true; _0 = const true;
goto -> bb9; goto -> bb9;
} }
bb9: { bb9: {
StorageDead(_19); StorageDead(_22);
StorageDead(_13); StorageDead(_16);
return; return;
} }
} }

View file

@ -4,40 +4,46 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41},
let mut _0: bool; let mut _0: bool;
let mut _3: &(usize, usize, usize, usize); let mut _3: &(usize, usize, usize, usize);
let _4: usize; let _4: usize;
let _5: usize; let mut _5: &(usize, usize, usize, usize);
let _6: usize; let _6: usize;
let _7: usize; let mut _7: &(usize, usize, usize, usize);
let mut _8: bool; let _8: usize;
let mut _9: bool; let mut _9: &(usize, usize, usize, usize);
let mut _10: bool; let _10: usize;
let mut _11: bool;
let mut _12: bool;
let mut _13: bool;
scope 1 { scope 1 {
debug a => _4; debug a => _4;
debug b => _5; debug b => _6;
debug c => _6; debug c => _8;
debug d => _7; debug d => _10;
} }
bb0: { bb0: {
_3 = copy (*_2); _3 = copy (*_2);
_4 = copy ((*_3).0: usize); _4 = copy ((*_3).0: usize);
_5 = copy ((*_3).1: usize); _5 = copy (*_2);
_6 = copy ((*_3).2: usize); _6 = copy ((*_5).1: usize);
_7 = copy ((*_3).3: usize); _7 = copy (*_2);
StorageLive(_8); _8 = copy ((*_7).2: usize);
_8 = Le(copy _4, copy _6); _9 = copy (*_2);
switchInt(move _8) -> [0: bb2, otherwise: bb1]; _10 = copy ((*_9).3: usize);
StorageLive(_11);
_11 = Le(copy _4, copy _8);
switchInt(move _11) -> [0: bb2, otherwise: bb1];
} }
bb1: { bb1: {
StorageLive(_9); StorageLive(_12);
_9 = Le(copy _7, copy _5); _12 = Le(copy _10, copy _6);
switchInt(move _9) -> [0: bb2, otherwise: bb6]; switchInt(move _12) -> [0: bb2, otherwise: bb6];
} }
bb2: { bb2: {
StorageLive(_10); StorageLive(_13);
_10 = Le(copy _6, copy _4); _13 = Le(copy _8, copy _4);
switchInt(move _10) -> [0: bb3, otherwise: bb4]; switchInt(move _13) -> [0: bb3, otherwise: bb4];
} }
bb3: { bb3: {
@ -46,12 +52,12 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41},
} }
bb4: { bb4: {
_0 = Le(copy _5, copy _7); _0 = Le(copy _6, copy _10);
goto -> bb5; goto -> bb5;
} }
bb5: { bb5: {
StorageDead(_10); StorageDead(_13);
goto -> bb7; goto -> bb7;
} }
@ -61,8 +67,8 @@ fn variant_b::{closure#0}(_1: &mut {closure@$DIR/slice_filter.rs:11:25: 11:41},
} }
bb7: { bb7: {
StorageDead(_9); StorageDead(_12);
StorageDead(_8); StorageDead(_11);
return; return;
} }
} }