diff --git a/tests/mir-opt/array_index_is_temporary.rs b/tests/mir-opt/array_index_is_temporary.rs index 771fb3771b5..cda9e86b3e6 100644 --- a/tests/mir-opt/array_index_is_temporary.rs +++ b/tests/mir-opt/array_index_is_temporary.rs @@ -15,7 +15,7 @@ fn main() { // CHECK: debug x => [[x:_.*]]; // CHECK: debug y => [[y:_.*]]; // CHECK: [[y]] = const 1_usize; - // CHECK: [[tmp:_.*]] = [[y]]; + // CHECK: [[tmp:_.*]] = copy [[y]]; // CHECK: [[x]][[[tmp]]] = let mut x = [42, 43, 44]; let mut y = 1; diff --git a/tests/mir-opt/box_expr.rs b/tests/mir-opt/box_expr.rs index a2d3ab94db6..41cd4ca57bf 100644 --- a/tests/mir-opt/box_expr.rs +++ b/tests/mir-opt/box_expr.rs @@ -7,7 +7,7 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: [[box:_.*]] = ShallowInitBox( - // CHECK: [[ptr:_.*]] = ((([[box]].0: std::ptr::Unique).0: std::ptr::NonNull).0: *const S); + // CHECK: [[ptr:_.*]] = copy ((([[box]].0: std::ptr::Unique).0: std::ptr::NonNull).0: *const S); // CHECK: (*[[ptr]]) = S::new() -> [return: [[ret:bb.*]], unwind: [[unwind:bb.*]]]; // CHECK: [[ret]]: { // CHECK: [[box2:_.*]] = move [[box]]; diff --git a/tests/mir-opt/building/match/sort_candidates.rs b/tests/mir-opt/building/match/sort_candidates.rs index 593a975a7a4..d7dd82791ff 100644 --- a/tests/mir-opt/building/match/sort_candidates.rs +++ b/tests/mir-opt/building/match/sort_candidates.rs @@ -25,7 +25,7 @@ fn disjoint_ranges(x: i32, b: bool) -> u32 { // CHECK-LABEL: fn disjoint_ranges( // CHECK: debug b => _2; // CHECK: bb0: { - // CHECK: switchInt(_2) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}]; + // CHECK: switchInt(copy _2) -> [0: [[jump:bb.*]], otherwise: {{bb.*}}]; // CHECK: [[jump]]: { // CHECK-NEXT: _0 = const 3_u32; // CHECK-NEXT: return; diff --git a/tests/mir-opt/building/while_storage.rs b/tests/mir-opt/building/while_storage.rs index 83095316f00..cd226eb0c1e 100644 --- a/tests/mir-opt/building/while_storage.rs +++ b/tests/mir-opt/building/while_storage.rs @@ -15,7 +15,7 @@ fn while_loop(c: bool) { // CHECK: bb1: { // CHECK-NEXT: StorageLive(_3); // CHECK-NEXT: StorageLive(_2); - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = get_bool(move _2) -> [return: bb2, unwind // CHECK: bb2: { // CHECK-NEXT: switchInt(move _3) -> [0: bb3, otherwise: bb4]; @@ -29,7 +29,7 @@ fn while_loop(c: bool) { // CHECK-NEXT: StorageDead(_2); // CHECK-NEXT: StorageLive(_5); // CHECK-NEXT: StorageLive(_4); - // CHECK-NEXT: _4 = _1; + // CHECK-NEXT: _4 = copy _1; // CHECK-NEXT: _5 = get_bool(move _4) -> [return: bb5, unwind // CHECK: bb5: { // CHECK-NEXT: switchInt(move _5) -> [0: bb6, otherwise: bb7]; diff --git a/tests/mir-opt/const_prop/address_of_pair.rs b/tests/mir-opt/const_prop/address_of_pair.rs index 9acaaa0ccaf..df1ab229d6e 100644 --- a/tests/mir-opt/const_prop/address_of_pair.rs +++ b/tests/mir-opt/const_prop/address_of_pair.rs @@ -10,13 +10,13 @@ pub fn fn0() -> bool { // CHECK: (*[[ptr]]) = const true; // CHECK-NOT: = const false; // CHECK-NOT: = const true; - // CHECK: [[tmp:_.*]] = ([[pair]].1: bool); + // CHECK: [[tmp:_.*]] = copy ([[pair]].1: bool); // CHECK-NOT: = const false; // CHECK-NOT: = const true; // CHECK: [[ret]] = Not(move [[tmp]]); // CHECK-NOT: = const false; // CHECK-NOT: = const true; - // CHECK: _0 = [[ret]]; + // CHECK: _0 = copy [[ret]]; let mut pair = (1, false); let ptr = core::ptr::addr_of_mut!(pair.1); pair = (1, false); diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs index 0f8d278535d..139d0fa2e0f 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.rs @@ -8,7 +8,7 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: debug a => [[a:_.*]]; // CHECK: debug _b => [[b:_.*]]; - // CHECK: [[b]] = (*[[a]])[3 of 4]; + // CHECK: [[b]] = copy (*[[a]])[3 of 4]; let a: *const [_] = &[1, 2, 3]; unsafe { let _b = (*a)[3]; diff --git a/tests/mir-opt/const_prop/boxes.rs b/tests/mir-opt/const_prop/boxes.rs index 7813352261e..f04db260e27 100644 --- a/tests/mir-opt/const_prop/boxes.rs +++ b/tests/mir-opt/const_prop/boxes.rs @@ -11,8 +11,8 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: debug x => [[x:_.*]]; // CHECK: (*{{_.*}}) = const 42_i32; - // CHECK: [[tmp:_.*]] = (*{{_.*}}); - // CHECK: [[x]] = [[tmp]]; + // CHECK: [[tmp:_.*]] = copy (*{{_.*}}); + // CHECK: [[x]] = copy [[tmp]]; let x = *(#[rustc_box] Box::new(42)) + 0; diff --git a/tests/mir-opt/const_prop/indirect_mutation.rs b/tests/mir-opt/const_prop/indirect_mutation.rs index 32ff8f142b1..0a4c455c76e 100644 --- a/tests/mir-opt/const_prop/indirect_mutation.rs +++ b/tests/mir-opt/const_prop/indirect_mutation.rs @@ -10,7 +10,7 @@ fn foo() { // CHECK: _1 = const (1_i32,); // CHECK: _2 = &mut (_1.0: i32); // CHECK: (*_2) = const 5_i32; - // CHECK: _4 = (_1.0: i32); + // CHECK: _4 = copy (_1.0: i32); // CHECK: _3 = Eq(move _4, const 5_i32); let mut u = (1,); @@ -25,7 +25,7 @@ fn bar() { // CHECK: debug y => _4; // CHECK: _3 = &raw mut (_1.0: i32); // CHECK: (*_3) = const 5_i32; - // CHECK: _5 = (_1.0: i32); + // CHECK: _5 = copy (_1.0: i32); // CHECK: _4 = Eq(move _5, const 5_i32); let mut v = (1,); diff --git a/tests/mir-opt/const_prop/mutable_variable.rs b/tests/mir-opt/const_prop/mutable_variable.rs index 9698fba6a11..3aa1b1bcd21 100644 --- a/tests/mir-opt/const_prop/mutable_variable.rs +++ b/tests/mir-opt/const_prop/mutable_variable.rs @@ -7,7 +7,7 @@ fn main() { // CHECK: debug y => [[y:_.*]]; // CHECK: [[x]] = const 42_i32; // CHECK: [[x]] = const 99_i32; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = 42; x = 99; let y = x; diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs index 80cd75215c1..bb8bf7f7164 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate.rs @@ -8,7 +8,7 @@ fn main() { // CHECK: debug y => [[y:_.*]]; // CHECK: [[x]] = const (42_i32, 43_i32); // CHECK: ([[x]].1: i32) = const 99_i32; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = (42, 43); x.1 = 99; let y = x; diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs index 856afd53ab4..332cac96f75 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_mut_ref.rs @@ -10,7 +10,7 @@ fn main() { // CHECK: [[x]] = const (42_i32, 43_i32); // CHECK: [[z]] = &mut [[x]]; // CHECK: ((*[[z]]).1: i32) = const 99_i32; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = (42, 43); let z = &mut x; z.1 = 99; diff --git a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs index 6f99e6be246..e27437a1c75 100644 --- a/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs +++ b/tests/mir-opt/const_prop/mutable_variable_aggregate_partial_read.rs @@ -9,7 +9,7 @@ fn main() { // CHECK: [[x]] = foo() // CHECK: ([[x]].1: i32) = const 99_i32; // CHECK: ([[x]].0: i32) = const 42_i32; - // CHECK: [[y]] = ([[x]].1: i32); + // CHECK: [[y]] = copy ([[x]].1: i32); let mut x: (i32, i32) = foo(); x.1 = 99; x.0 = 42; diff --git a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs index 8289832f81e..66af5bf1d5d 100644 --- a/tests/mir-opt/const_prop/mutable_variable_no_prop.rs +++ b/tests/mir-opt/const_prop/mutable_variable_no_prop.rs @@ -9,9 +9,9 @@ fn main() { // CHECK: debug x => [[x:_.*]]; // CHECK: debug y => [[y:_.*]]; // CHECK: [[x]] = const 42_u32; - // CHECK: [[tmp:_.*]] = (*{{_.*}}); + // CHECK: [[tmp:_.*]] = copy (*{{_.*}}); // CHECK: [[x]] = move [[tmp]]; - // CHECK: [[y]] = [[x]]; + // CHECK: [[y]] = copy [[x]]; let mut x = 42; unsafe { x = STATIC; diff --git a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs index 2c6cc0db6b2..1f4421331bc 100644 --- a/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs +++ b/tests/mir-opt/const_prop/mutable_variable_unprop_assign.rs @@ -11,9 +11,9 @@ fn main() { // CHECK: debug z => [[z:_.*]]; // CHECK: [[a]] = foo() // CHECK: [[x]] = const (1_i32, 2_i32); - // CHECK: ([[x]].1: i32) = [[a]]; - // CHECK: [[y]] = ([[x]].1: i32); - // CHECK: [[z]] = ([[x]].0: i32); + // CHECK: ([[x]].1: i32) = copy [[a]]; + // CHECK: [[y]] = copy ([[x]].1: i32); + // CHECK: [[z]] = copy ([[x]].0: i32); let a = foo(); let mut x: (i32, i32) = (1, 2); x.1 = a; diff --git a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs index a43558223fe..1d8890bf369 100644 --- a/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs +++ b/tests/mir-opt/const_prop/overwrite_with_const_with_params.rs @@ -15,7 +15,7 @@ fn size_of() -> usize { // CHECK-LABEL: fn size_of( // CHECK: _1 = const 0_usize; // CHECK-NEXT: _1 = const SizeOfConst::::SIZE; - // CHECK-NEXT: _0 = _1; + // CHECK-NEXT: _0 = copy _1; let mut a = 0; a = SizeOfConst::::SIZE; a diff --git a/tests/mir-opt/const_prop/pointer_expose_provenance.rs b/tests/mir-opt/const_prop/pointer_expose_provenance.rs index a76fead9859..bee8a985f8f 100644 --- a/tests/mir-opt/const_prop/pointer_expose_provenance.rs +++ b/tests/mir-opt/const_prop/pointer_expose_provenance.rs @@ -10,7 +10,7 @@ fn main() { // CHECK: [[ptr:_.*]] = const main::FOO; // CHECK: [[ref:_.*]] = &raw const (*[[ptr]]); // CHECK: [[x:_.*]] = move [[ref]] as usize (PointerExposeProvenance); - // CHECK: = read([[x]]) + // CHECK: = read(copy [[x]]) const FOO: &i32 = &1; let x = FOO as *const i32 as usize; read(x); diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 3d1b58965ac..46604cfe1e0 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -7,7 +7,7 @@ fn main() { // CHECK-LABEL: fn main( // CHECK: debug a => [[a:_.*]]; - // CHECK: [[slice:_.*]] = {{.*}} as &[u32] (PointerCoercion(Unsize)); + // CHECK: [[slice:_.*]] = copy {{.*}} as &[u32] (PointerCoercion(Unsize)); // CHECK: assert(const true, // CHECK: [[a]] = const 2_u32; let a = (&[1u32, 2, 3] as &[u32])[1]; diff --git a/tests/mir-opt/copy-prop/borrowed_local.rs b/tests/mir-opt/copy-prop/borrowed_local.rs index dd1679513f6..8db19fbd377 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.rs +++ b/tests/mir-opt/copy-prop/borrowed_local.rs @@ -21,11 +21,11 @@ fn compare_address() -> bool { // CHECK: bb0: { // CHECK-NEXT: _1 = const 5_u8; // CHECK-NEXT: _2 = &_1; - // CHECK-NEXT: _3 = _1; + // CHECK-NEXT: _3 = copy _1; // CHECK-NEXT: _4 = &_3; - // CHECK-NEXT: _0 = cmp_ref(_2, _4) + // CHECK-NEXT: _0 = cmp_ref(copy _2, copy _4) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::(_3) + // CHECK-NEXT: _0 = opaque::(copy _3) mir! { { let a = 5_u8; @@ -51,9 +51,9 @@ fn borrowed(x: T) -> bool { // CHECK-LABEL: fn borrowed( // CHECK: bb0: { // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::(_1) + // CHECK-NEXT: _0 = opaque::(copy _1) mir! { { let a = x; @@ -74,11 +74,11 @@ fn borrowed(x: T) -> bool { fn non_freeze(x: T) -> bool { // CHECK-LABEL: fn non_freeze( // CHECK: bb0: { - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::(_2) + // CHECK-NEXT: _0 = opaque::(copy _2) mir! { { let a = x; diff --git a/tests/mir-opt/dataflow-const-prop/array_index.rs b/tests/mir-opt/dataflow-const-prop/array_index.rs index daf9c7729c6..e442ef99f79 100644 --- a/tests/mir-opt/dataflow-const-prop/array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/array_index.rs @@ -16,6 +16,6 @@ fn main() { // CHECK: {{_.*}} = const 4_usize; // CHECK: {{_.*}} = const true; // CHECK: assert(const true - // CHECK: [[x]] = [[array_lit]][2 of 3]; + // CHECK: [[x]] = copy [[array_lit]][2 of 3]; let x: u32 = [0, 1, 2, 3][2]; } diff --git a/tests/mir-opt/dataflow-const-prop/enum.rs b/tests/mir-opt/dataflow-const-prop/enum.rs index 37304e3a270..207e29e63df 100644 --- a/tests/mir-opt/dataflow-const-prop/enum.rs +++ b/tests/mir-opt/dataflow-const-prop/enum.rs @@ -73,7 +73,7 @@ fn statics() { static RC: &E = &E::V2(4); // CHECK: [[t:_.*]] = const {alloc5: &&E}; - // CHECK: [[e2]] = (*[[t]]); + // CHECK: [[e2]] = copy (*[[t]]); let e2 = RC; // CHECK: switchInt({{move _.*}}) -> {{.*}} @@ -108,7 +108,7 @@ fn mutate_discriminant() -> u8 { // CHECK: [[a:_.*]] = discriminant({{_.*}}); let a = Discriminant(x); - // CHECK: switchInt([[a]]) -> [0: {{bb.*}}, otherwise: {{bb.*}}]; + // CHECK: switchInt(copy [[a]]) -> [0: {{bb.*}}, otherwise: {{bb.*}}]; match a { 0 => bb1, _ => bad, @@ -143,8 +143,8 @@ fn multiple(x: bool, i: u8) { // discriminant(e) => Top // (e as Some).0 => Top // CHECK: [[x2]] = const 0_u8; - // CHECK: [[some:_.*]] = (({{_.*}} as Some).0: u8) - // CHECK: [[x2]] = [[some]]; + // CHECK: [[some:_.*]] = copy (({{_.*}} as Some).0: u8) + // CHECK: [[x2]] = copy [[some]]; let x2 = match e { Some(i) => i, None => 0, @@ -153,7 +153,7 @@ fn multiple(x: bool, i: u8) { // Therefore, `x2` should be `Top` here, and no replacement shall happen. // CHECK-NOT: [[y]] = const - // CHECK: [[y]] = [[x2]]; + // CHECK: [[y]] = copy [[x2]]; // CHECK-NOT: [[y]] = const let y = x2; } diff --git a/tests/mir-opt/dataflow-const-prop/large_array_index.rs b/tests/mir-opt/dataflow-const-prop/large_array_index.rs index e74fd88d002..e9f2fa2badf 100644 --- a/tests/mir-opt/dataflow-const-prop/large_array_index.rs +++ b/tests/mir-opt/dataflow-const-prop/large_array_index.rs @@ -13,6 +13,6 @@ fn main() { // CHECK: {{_.*}} = const 5000_usize; // CHECK: {{_.*}} = const true; // CHECK: assert(const true - // CHECK: [[x]] = [[array_lit]][2 of 3]; + // CHECK: [[x]] = copy [[array_lit]][2 of 3]; let x: u8 = [0_u8; 5000][2]; } diff --git a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs index 399de921a59..1c4eb41f35e 100644 --- a/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs +++ b/tests/mir-opt/dataflow-const-prop/ref_without_sb.rs @@ -24,7 +24,7 @@ fn main() { // This should currently not be propagated. // CHECK-NOT: [[b]] = const - // CHECK: [[b]] = [[a]]; + // CHECK: [[b]] = copy [[a]]; // CHECK-NOT: [[b]] = const let b = a; } diff --git a/tests/mir-opt/dataflow-const-prop/repeat.rs b/tests/mir-opt/dataflow-const-prop/repeat.rs index e32c0d0877d..2067aa3d709 100644 --- a/tests/mir-opt/dataflow-const-prop/repeat.rs +++ b/tests/mir-opt/dataflow-const-prop/repeat.rs @@ -14,8 +14,8 @@ fn main() { // CHECK: {{_.*}} = const true; // CHECK: assert(const true - // CHECK-NOT: [[t:_.*]] = [[array_lit]][_ - // CHECK: [[t:_.*]] = [[array_lit]][2 of 3]; + // CHECK-NOT: [[t:_.*]] = {{copy|move}} [[array_lit]][_ + // CHECK: [[t:_.*]] = copy [[array_lit]][2 of 3]; // CHECK: [[x]] = Add(move [[t]], const 0_u32); let x: u32 = [42; 8][2] + 0; } diff --git a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs index be7f311cdc1..b123f06807d 100644 --- a/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs +++ b/tests/mir-opt/dataflow-const-prop/sibling_ptr.rs @@ -20,6 +20,6 @@ fn main() { *p.add(1) = 1; } - // CHECK: [[x1]] = ({{_.*}}.1: u8); + // CHECK: [[x1]] = copy ({{_.*}}.1: u8); let x1 = x.1; // should not be propagated } diff --git a/tests/mir-opt/dataflow-const-prop/slice_len.rs b/tests/mir-opt/dataflow-const-prop/slice_len.rs index 64c043cca79..e0e68f9fde5 100644 --- a/tests/mir-opt/dataflow-const-prop/slice_len.rs +++ b/tests/mir-opt/dataflow-const-prop/slice_len.rs @@ -17,7 +17,7 @@ fn main() { // CHECK: {{_.*}} = const true; // CHECK: assert(const true, - // CHECK: [[local]] = (*{{_.*}})[1 of 2]; + // CHECK: [[local]] = copy (*{{_.*}})[1 of 2]; let local = (&[1u32, 2, 3] as &[u32])[1]; // CHECK-NOT: {{_.*}} = Len( @@ -28,7 +28,7 @@ fn main() { // CHECK: {{_.*}} = const true; // CHECK: assert(const true, - // CHECK-NOT: [[constant]] = (*{{_.*}})[_ - // CHECK: [[constant]] = (*{{_.*}})[1 of 2]; + // CHECK-NOT: [[constant]] = {{copy|move}} (*{{_.*}})[_ + // CHECK: [[constant]] = copy (*{{_.*}})[1 of 2]; let constant = SLICE[1]; } diff --git a/tests/mir-opt/dataflow-const-prop/struct.rs b/tests/mir-opt/dataflow-const-prop/struct.rs index 89ad1b87029..44591ffb6de 100644 --- a/tests/mir-opt/dataflow-const-prop/struct.rs +++ b/tests/mir-opt/dataflow-const-prop/struct.rs @@ -46,15 +46,15 @@ fn main() { const SMALL_VAL: SmallStruct = SmallStruct(4., Some(S(1)), &[]); // CHECK: [[a1]] = const 4f32; - // CHECK: [[b1]] = ({{_.*}}.1: std::option::Option); - // CHECK: [[c1]] = ({{_.*}}.2: &[f32]); + // CHECK: [[b1]] = copy ({{_.*}}.1: std::option::Option); + // CHECK: [[c1]] = copy ({{_.*}}.2: &[f32]); let SmallStruct(a1, b1, c1) = SMALL_VAL; static SMALL_STAT: &SmallStruct = &SmallStruct(9., None, &[13.]); // CHECK: [[a2]] = const 9f32; - // CHECK: [[b2]] = ((*{{_.*}}).1: std::option::Option); - // CHECK: [[c2]] = ((*{{_.*}}).2: &[f32]); + // CHECK: [[b2]] = copy ((*{{_.*}}).1: std::option::Option); + // CHECK: [[c2]] = copy ((*{{_.*}}).2: &[f32]); let SmallStruct(a2, b2, c2) = *SMALL_STAT; // CHECK: [[ss]] = SmallStruct(const 9f32, move {{_.*}}, move {{_.*}}); @@ -63,14 +63,14 @@ fn main() { const BIG_VAL: BigStruct = BigStruct(25., None, &[]); // CHECK: [[a3]] = const 25f32; - // CHECK: [[b3]] = ({{_.*}}.1: std::option::Option); - // CHECK: [[c3]] = ({{_.*}}.2: &[f32]); + // CHECK: [[b3]] = copy ({{_.*}}.1: std::option::Option); + // CHECK: [[c3]] = copy ({{_.*}}.2: &[f32]); let BigStruct(a3, b3, c3) = BIG_VAL; static BIG_STAT: &BigStruct = &BigStruct(82., Some(S(35)), &[45., 72.]); // CHECK: [[a4]] = const 82f32; - // CHECK: [[b4]] = ((*{{_.*}}).1: std::option::Option); - // CHECK: [[c4]] = ((*{{_.*}}).2: &[f32]); + // CHECK: [[b4]] = copy ((*{{_.*}}).1: std::option::Option); + // CHECK: [[c4]] = copy ((*{{_.*}}).2: &[f32]); let BigStruct(a4, b4, c4) = *BIG_STAT; // We arbitrarily limit the size of synthetized values to 4 pointers. diff --git a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs index 2556848ec46..27b5ccdb936 100644 --- a/tests/mir-opt/dead-store-elimination/call_arg_copy.rs +++ b/tests/mir-opt/dead-store-elimination/call_arg_copy.rs @@ -14,7 +14,7 @@ fn use_both(_: i32, _: i32) {} // EMIT_MIR call_arg_copy.move_simple.DeadStoreElimination-final.diff fn move_simple(x: i32) { // CHECK-LABEL: fn move_simple( - // CHECK: = use_both(_1, move _1) + // CHECK: = use_both(copy _1, move _1) use_both(x, x); } @@ -28,7 +28,7 @@ struct Packed { #[custom_mir(dialect = "analysis")] fn move_packed(packed: Packed) { // CHECK-LABEL: fn move_packed( - // CHECK: = use_both(const 0_i32, (_1.1: i32)) + // CHECK: = use_both(const 0_i32, copy (_1.1: i32)) mir! { { // We have a packed struct, verify that the copy is not turned into a move. diff --git a/tests/mir-opt/dest-prop/copy_propagation_arg.rs b/tests/mir-opt/dest-prop/copy_propagation_arg.rs index 084bd0544c1..ef531f4afa2 100644 --- a/tests/mir-opt/dest-prop/copy_propagation_arg.rs +++ b/tests/mir-opt/dest-prop/copy_propagation_arg.rs @@ -41,9 +41,9 @@ fn arg_src(mut x: i32) -> i32 { // CHECK-LABEL: fn arg_src( // CHECK: debug x => [[x:_.*]]; // CHECK: debug y => [[y:_.*]]; - // CHECK: [[y]] = [[x]] + // CHECK: [[y]] = copy [[x]] // CHECK: [[x]] = const 123_i32; - // CHECK-NOT: {{_.*}} = [[y]]; + // CHECK-NOT: {{_.*}} = copy [[y]]; let y = x; x = 123; // Don't propagate this assignment to `y` y diff --git a/tests/mir-opt/dest-prop/dead_stores_79191.rs b/tests/mir-opt/dest-prop/dead_stores_79191.rs index 61060e4f850..d035de5ce07 100644 --- a/tests/mir-opt/dest-prop/dead_stores_79191.rs +++ b/tests/mir-opt/dest-prop/dead_stores_79191.rs @@ -10,7 +10,7 @@ fn f(mut a: usize) -> usize { // CHECK-LABEL: fn f( // CHECK: debug a => [[a:_.*]]; // CHECK: debug b => [[b:_.*]]; - // CHECK: [[b]] = [[a]]; + // CHECK: [[b]] = copy [[a]]; // CHECK: [[a]] = const 5_usize; // CHECK: [[a]] = move [[b]]; // CHECK: id::(move [[a]]) diff --git a/tests/mir-opt/dest-prop/dead_stores_better.rs b/tests/mir-opt/dest-prop/dead_stores_better.rs index d2b9fe05712..d4c297fd97a 100644 --- a/tests/mir-opt/dest-prop/dead_stores_better.rs +++ b/tests/mir-opt/dest-prop/dead_stores_better.rs @@ -14,7 +14,7 @@ pub fn f(mut a: usize) -> usize { // CHECK-LABEL: fn f( // CHECK: debug a => [[a:_.*]]; // CHECK: debug b => [[b:_.*]]; - // CHECK: [[b]] = [[a]]; + // CHECK: [[b]] = copy [[a]]; // CHECK: [[a]] = const 5_usize; // CHECK: [[a]] = move [[b]]; // CHECK: id::(move [[a]]) diff --git a/tests/mir-opt/dest-prop/simple.rs b/tests/mir-opt/dest-prop/simple.rs index 833d49b8c46..927a9c5b24c 100644 --- a/tests/mir-opt/dest-prop/simple.rs +++ b/tests/mir-opt/dest-prop/simple.rs @@ -7,9 +7,9 @@ // CHECK: debug init => [[init:_.*]]; // CHECK: debug buf => [[buf:_.*]]; // CHECK: [[buf]] = [const 0_u8; 1024]; - // CHECK-NOT: {{_.*}} = [[init]]; + // CHECK-NOT: {{_.*}} = copy [[init]]; // CHECK: move [[init]](move {{_.*}}) - // CHECK: {{_.*}} = [[buf]] + // CHECK: {{_.*}} = copy [[buf]] let mut buf = [0; 1024]; init(&mut buf); buf diff --git a/tests/mir-opt/early_otherwise_branch.rs b/tests/mir-opt/early_otherwise_branch.rs index b047c50df97..47bd4be295b 100644 --- a/tests/mir-opt/early_otherwise_branch.rs +++ b/tests/mir-opt/early_otherwise_branch.rs @@ -49,7 +49,7 @@ fn opt3(x: Option2, y: Option2) -> u32 { // CHECK: bb0: { // CHECK: [[LOCAL1:_.*]] = discriminant({{.*}}); // CHECK: [[LOCAL2:_.*]] = discriminant({{.*}}); - // CHECK: [[CMP_LOCAL]] = Ne([[LOCAL1]], move [[LOCAL2]]); + // CHECK: [[CMP_LOCAL]] = Ne(copy [[LOCAL1]], move [[LOCAL2]]); // CHECK: switchInt(move [[CMP_LOCAL]]) -> [ // CHECK-NEXT: } match (x, y) { @@ -67,7 +67,7 @@ fn opt4(x: Option2, y: Option2) -> u32 { // CHECK: bb0: { // CHECK: [[LOCAL1:_.*]] = discriminant({{.*}}); // CHECK: [[LOCAL2:_.*]] = discriminant({{.*}}); - // CHECK: [[CMP_LOCAL]] = Ne([[LOCAL1]], move [[LOCAL2]]); + // CHECK: [[CMP_LOCAL]] = Ne(copy [[LOCAL1]], move [[LOCAL2]]); // CHECK: switchInt(move [[CMP_LOCAL]]) -> [ // CHECK-NEXT: } match (x, y) { diff --git a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs index d2a3e1f59ff..d6b27fbce48 100644 --- a/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs +++ b/tests/mir-opt/early_otherwise_branch_3_element_tuple.rs @@ -32,7 +32,7 @@ fn opt2(x: Option2, y: Option2, z: Option2) -> u32 { // CHECK: bb0: { // CHECK: [[LOCAL1:_.*]] = discriminant({{.*}}); // CHECK: [[LOCAL2:_.*]] = discriminant({{.*}}); - // CHECK: [[CMP_LOCAL]] = Ne([[LOCAL1]], move [[LOCAL2]]); + // CHECK: [[CMP_LOCAL]] = Ne(copy [[LOCAL1]], move [[LOCAL2]]); // CHECK: switchInt(move [[CMP_LOCAL]]) -> [ // CHECK-NEXT: } match (x, y, z) { diff --git a/tests/mir-opt/gvn.rs b/tests/mir-opt/gvn.rs index 430f979fec7..ab1253eadee 100644 --- a/tests/mir-opt/gvn.rs +++ b/tests/mir-opt/gvn.rs @@ -21,91 +21,91 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) { // CHECK-LABEL: fn subexpression_elimination( - // CHECK: [[add:_.*]] = Add(_1, _2); - // CHECK: opaque::([[add]]) + // CHECK: [[add:_.*]] = Add(copy _1, copy _2); + // CHECK: opaque::(copy [[add]]) opaque(x + y); - // CHECK: [[mul:_.*]] = Mul(_1, _2); - // CHECK: opaque::([[mul]]) + // CHECK: [[mul:_.*]] = Mul(copy _1, copy _2); + // CHECK: opaque::(copy [[mul]]) opaque(x * y); - // CHECK: [[sub:_.*]] = Sub(_1, _2); - // CHECK: opaque::([[sub]]) + // CHECK: [[sub:_.*]] = Sub(copy _1, copy _2); + // CHECK: opaque::(copy [[sub]]) opaque(x - y); - // CHECK: [[div:_.*]] = Div(_1, _2); - // CHECK: opaque::([[div]]) + // CHECK: [[div:_.*]] = Div(copy _1, copy _2); + // CHECK: opaque::(copy [[div]]) opaque(x / y); - // CHECK: [[rem:_.*]] = Rem(_1, _2); - // CHECK: opaque::([[rem]]) + // CHECK: [[rem:_.*]] = Rem(copy _1, copy _2); + // CHECK: opaque::(copy [[rem]]) opaque(x % y); - // CHECK: [[and:_.*]] = BitAnd(_1, _2); - // CHECK: opaque::([[and]]) + // CHECK: [[and:_.*]] = BitAnd(copy _1, copy _2); + // CHECK: opaque::(copy [[and]]) opaque(x & y); - // CHECK: [[or:_.*]] = BitOr(_1, _2); - // CHECK: opaque::([[or]]) + // CHECK: [[or:_.*]] = BitOr(copy _1, copy _2); + // CHECK: opaque::(copy [[or]]) opaque(x | y); - // CHECK: [[xor:_.*]] = BitXor(_1, _2); - // CHECK: opaque::([[xor]]) + // CHECK: [[xor:_.*]] = BitXor(copy _1, copy _2); + // CHECK: opaque::(copy [[xor]]) opaque(x ^ y); - // CHECK: [[shl:_.*]] = Shl(_1, _2); - // CHECK: opaque::([[shl]]) + // CHECK: [[shl:_.*]] = Shl(copy _1, copy _2); + // CHECK: opaque::(copy [[shl]]) opaque(x << y); - // CHECK: [[shr:_.*]] = Shr(_1, _2); - // CHECK: opaque::([[shr]]) + // CHECK: [[shr:_.*]] = Shr(copy _1, copy _2); + // CHECK: opaque::(copy [[shr]]) opaque(x >> y); - // CHECK: [[int:_.*]] = _1 as u32 (IntToInt); - // CHECK: opaque::([[int]]) + // CHECK: [[int:_.*]] = copy _1 as u32 (IntToInt); + // CHECK: opaque::(copy [[int]]) opaque(x as u32); - // CHECK: [[float:_.*]] = _1 as f32 (IntToFloat); - // CHECK: opaque::([[float]]) + // CHECK: [[float:_.*]] = copy _1 as f32 (IntToFloat); + // CHECK: opaque::(copy [[float]]) opaque(x as f32); - // CHECK: [[wrap:_.*]] = S::(_1); - // CHECK: opaque::>([[wrap]]) + // CHECK: [[wrap:_.*]] = S::(copy _1); + // CHECK: opaque::>(copy [[wrap]]) opaque(S(x)); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(S(x).0); // Those are duplicates to substitute somehow. - // CHECK: opaque::([[add]]) + // CHECK: opaque::(copy [[add]]) opaque(x + y); - // CHECK: opaque::([[mul]]) + // CHECK: opaque::(copy [[mul]]) opaque(x * y); - // CHECK: opaque::([[sub]]) + // CHECK: opaque::(copy [[sub]]) opaque(x - y); - // CHECK: opaque::([[div]]) + // CHECK: opaque::(copy [[div]]) opaque(x / y); - // CHECK: opaque::([[rem]]) + // CHECK: opaque::(copy [[rem]]) opaque(x % y); - // CHECK: opaque::([[and]]) + // CHECK: opaque::(copy [[and]]) opaque(x & y); - // CHECK: opaque::([[or]]) + // CHECK: opaque::(copy [[or]]) opaque(x | y); - // CHECK: opaque::([[xor]]) + // CHECK: opaque::(copy [[xor]]) opaque(x ^ y); - // CHECK: opaque::([[shl]]) + // CHECK: opaque::(copy [[shl]]) opaque(x << y); - // CHECK: opaque::([[shr]]) + // CHECK: opaque::(copy [[shr]]) opaque(x >> y); - // CHECK: opaque::([[int]]) + // CHECK: opaque::(copy [[int]]) opaque(x as u32); - // CHECK: opaque::([[float]]) + // CHECK: opaque::(copy [[float]]) opaque(x as f32); - // CHECK: opaque::>([[wrap]]) + // CHECK: opaque::>(copy [[wrap]]) opaque(S(x)); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(S(x).0); // We can substitute through a complex expression. - // CHECK: [[compound:_.*]] = Sub([[mul]], _2); - // CHECK: opaque::([[compound]]) - // CHECK: opaque::([[compound]]) + // CHECK: [[compound:_.*]] = Sub(copy [[mul]], copy _2); + // CHECK: opaque::(copy [[compound]]) + // CHECK: opaque::(copy [[compound]]) opaque((x * y) - y); opaque((x * y) - y); // We can substitute through an immutable reference too. // CHECK: [[ref:_.*]] = &_3; - // CHECK: [[deref:_.*]] = (*[[ref]]); - // CHECK: [[addref:_.*]] = Add([[deref]], _1); - // CHECK: opaque::([[addref]]) - // CHECK: opaque::([[addref]]) + // CHECK: [[deref:_.*]] = copy (*[[ref]]); + // CHECK: [[addref:_.*]] = Add(copy [[deref]], copy _1); + // CHECK: opaque::(copy [[addref]]) + // CHECK: opaque::(copy [[addref]]) let a = &z; opaque(*a + x); opaque(*a + x); @@ -141,10 +141,10 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) { // We can substitute again, but not with the earlier computations. // Important: `e` is not `a`! // CHECK: [[ref2:_.*]] = &_3; - // CHECK: [[deref2:_.*]] = (*[[ref2]]); - // CHECK: [[addref2:_.*]] = Add([[deref2]], _1); - // CHECK: opaque::([[addref2]]) - // CHECK: opaque::([[addref2]]) + // CHECK: [[deref2:_.*]] = copy (*[[ref2]]); + // CHECK: [[addref2:_.*]] = Add(copy [[deref2]], copy _1); + // CHECK: opaque::(copy [[addref2]]) + // CHECK: opaque::(copy [[addref2]]) let e = &z; opaque(*e + x); opaque(*e + x); @@ -152,9 +152,9 @@ fn subexpression_elimination(x: u64, y: u64, mut z: u64) { fn wrap_unwrap(x: T) -> T { // CHECK-LABEL: fn wrap_unwrap( - // CHECK: [[some:_.*]] = Option::::Some(_1); + // CHECK: [[some:_.*]] = Option::::Some(copy _1); // CHECK: switchInt(const 1_isize) - // CHECK: _0 = _1; + // CHECK: _0 = copy _1; match Some(x) { Some(y) => y, None => panic!(), @@ -163,35 +163,35 @@ fn wrap_unwrap(x: T) -> T { fn repeated_index(x: T, idx: usize) { // CHECK-LABEL: fn repeated_index( - // CHECK: [[a:_.*]] = [_1; N]; + // CHECK: [[a:_.*]] = [copy _1; N]; let a = [x; N]; - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(a[0]); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(a[idx]); } fn unary(x: i64) { // CHECK-LABEL: fn unary( - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(--x); // This is `x`. - // CHECK: [[b:_.*]] = Lt(_1, const 13_i64); - // CHECK: opaque::([[b]]) + // CHECK: [[b:_.*]] = Lt(copy _1, const 13_i64); + // CHECK: opaque::(copy [[b]]) let b = x < 13; opaque(!!b); // This is `b`. // Both lines should test the same thing. - // CHECK: [[c:_.*]] = Ne(_1, const 15_i64); - // CHECK: opaque::([[c]]) - // CHECK: opaque::([[c]]) + // CHECK: [[c:_.*]] = Ne(copy _1, const 15_i64); + // CHECK: opaque::(copy [[c]]) + // CHECK: opaque::(copy [[c]]) opaque(x != 15); opaque(!(x == 15)); // Both lines should test the same thing. - // CHECK: [[d:_.*]] = Eq(_1, const 35_i64); - // CHECK: opaque::([[d]]) - // CHECK: opaque::([[d]]) + // CHECK: [[d:_.*]] = Eq(copy _1, const 35_i64); + // CHECK: opaque::(copy [[d]]) + // CHECK: opaque::(copy [[d]]) opaque(x == 35); opaque(!(x != 35)); } @@ -199,53 +199,53 @@ fn unary(x: i64) { /// Verify symbolic integer arithmetic simplifications. fn arithmetic(x: u64) { // CHECK-LABEL: fn arithmetic( - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x + 0); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x - 0); // CHECK: opaque::(const 0_u64) opaque(x - x); // CHECK: opaque::(const 0_u64) opaque(x * 0); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x * 1); // CHECK: assert(!const true, "attempt to divide `{}` by zero", - // CHECK: [[div0:_.*]] = Div(_1, const 0_u64); + // CHECK: [[div0:_.*]] = Div(copy _1, const 0_u64); // CHECK: opaque::(move [[div0]]) opaque(x / 0); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x / 1); // CHECK: opaque::(const 0_u64) opaque(0 / x); - // CHECK: [[odiv:_.*]] = Div(const 1_u64, _1); + // CHECK: [[odiv:_.*]] = Div(const 1_u64, copy _1); // CHECK: opaque::(move [[odiv]]) opaque(1 / x); // CHECK: assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero" - // CHECK: [[rem0:_.*]] = Rem(_1, const 0_u64); + // CHECK: [[rem0:_.*]] = Rem(copy _1, const 0_u64); // CHECK: opaque::(move [[rem0]]) opaque(x % 0); // CHECK: opaque::(const 0_u64) opaque(x % 1); // CHECK: opaque::(const 0_u64) opaque(0 % x); - // CHECK: [[orem:_.*]] = Rem(const 1_u64, _1); + // CHECK: [[orem:_.*]] = Rem(const 1_u64, copy _1); // CHECK: opaque::(move [[orem]]) opaque(1 % x); // CHECK: opaque::(const 0_u64) opaque(x & 0); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x & u64::MAX); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x | 0); // CHECK: opaque::(const u64::MAX) opaque(x | u64::MAX); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x ^ 0); // CHECK: opaque::(const 0_u64) opaque(x ^ x); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x >> 0); - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x << 0); } @@ -255,10 +255,10 @@ fn comparison(x: u64, y: u64) { opaque(x == x); // CHECK: opaque::(const false) opaque(x != x); - // CHECK: [[eqxy:_.*]] = Eq(_1, _2); + // CHECK: [[eqxy:_.*]] = Eq(copy _1, copy _2); // CHECK: opaque::(move [[eqxy]]) opaque(x == y); - // CHECK: [[nexy:_.*]] = Ne(_1, _2); + // CHECK: [[nexy:_.*]] = Ne(copy _1, copy _2); // CHECK: opaque::(move [[nexy]]) opaque(x != y); } @@ -268,10 +268,10 @@ fn comparison(x: u64, y: u64) { fn arithmetic_checked(x: u64) { // CHECK-LABEL: fn arithmetic_checked( // CHECK: assert(!const false, - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x + 0); // CHECK: assert(!const false, - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x - 0); // CHECK: assert(!const false, // CHECK: opaque::(const 0_u64) @@ -280,39 +280,39 @@ fn arithmetic_checked(x: u64) { // CHECK: opaque::(const 0_u64) opaque(x * 0); // CHECK: assert(!const false, - // CHECK: opaque::(_1) + // CHECK: opaque::(copy _1) opaque(x * 1); } /// Verify that we do not apply arithmetic simplifications on floats. fn arithmetic_float(x: f64) { // CHECK-LABEL: fn arithmetic_float( - // CHECK: [[add:_.*]] = Add(_1, const 0f64); + // CHECK: [[add:_.*]] = Add(copy _1, const 0f64); // CHECK: opaque::(move [[add]]) opaque(x + 0.); - // CHECK: [[sub:_.*]] = Sub(_1, const 0f64); + // CHECK: [[sub:_.*]] = Sub(copy _1, const 0f64); // CHECK: opaque::(move [[sub]]) opaque(x - 0.); - // CHECK: [[mul:_.*]] = Mul(_1, const 0f64); + // CHECK: [[mul:_.*]] = Mul(copy _1, const 0f64); // CHECK: opaque::(move [[mul]]) opaque(x * 0.); - // CHECK: [[div0:_.*]] = Div(_1, const 0f64); + // CHECK: [[div0:_.*]] = Div(copy _1, const 0f64); // CHECK: opaque::(move [[div0]]) opaque(x / 0.); - // CHECK: [[zdiv:_.*]] = Div(const 0f64, _1); + // CHECK: [[zdiv:_.*]] = Div(const 0f64, copy _1); // CHECK: opaque::(move [[zdiv]]) opaque(0. / x); - // CHECK: [[rem0:_.*]] = Rem(_1, const 0f64); + // CHECK: [[rem0:_.*]] = Rem(copy _1, const 0f64); // CHECK: opaque::(move [[rem0]]) opaque(x % 0.); - // CHECK: [[zrem:_.*]] = Rem(const 0f64, _1); + // CHECK: [[zrem:_.*]] = Rem(const 0f64, copy _1); // CHECK: opaque::(move [[zrem]]) opaque(0. % x); // Those are not simplifiable to `true`/`false`, thanks to NaNs. - // CHECK: [[eq:_.*]] = Eq(_1, _1); + // CHECK: [[eq:_.*]] = Eq(copy _1, copy _1); // CHECK: opaque::(move [[eq]]) opaque(x == x); - // CHECK: [[ne:_.*]] = Ne(_1, _1); + // CHECK: [[ne:_.*]] = Ne(copy _1, copy _1); // CHECK: opaque::(move [[ne]]) opaque(x != x); } @@ -386,36 +386,36 @@ fn cast() { fn multiple_branches(t: bool, x: u8, y: u8) { // CHECK-LABEL: fn multiple_branches( - // CHECK: switchInt(_1) -> [0: [[bbf:bb.*]], otherwise: [[bbt:bb.*]]]; + // CHECK: switchInt(copy _1) -> [0: [[bbf:bb.*]], otherwise: [[bbt:bb.*]]]; if t { // CHECK: [[bbt]]: { - // CHECK: [[a:_.*]] = Add(_2, _3); - // CHECK: opaque::([[a]]) - // CHECK: opaque::([[a]]) + // CHECK: [[a:_.*]] = Add(copy _2, copy _3); + // CHECK: opaque::(copy [[a]]) + // CHECK: opaque::(copy [[a]]) // CHECK: goto -> [[bbc:bb.*]]; opaque(x + y); opaque(x + y); } else { // CHECK: [[bbf]]: { - // CHECK: [[b:_.*]] = Add(_2, _3); - // CHECK: opaque::([[b]]) - // CHECK: opaque::([[b]]) + // CHECK: [[b:_.*]] = Add(copy _2, copy _3); + // CHECK: opaque::(copy [[b]]) + // CHECK: opaque::(copy [[b]]) // CHECK: goto -> [[bbc:bb.*]]; opaque(x + y); opaque(x + y); } // Neither `a` nor `b` dominate `c`, so we cannot reuse any of them. // CHECK: [[bbc]]: { - // CHECK: [[c:_.*]] = Add(_2, _3); - // CHECK: opaque::([[c]]) + // CHECK: [[c:_.*]] = Add(copy _2, copy _3); + // CHECK: opaque::(copy [[c]]) opaque(x + y); // `c` dominates both calls, so we can reuse it. if t { - // CHECK: opaque::([[c]]) + // CHECK: opaque::(copy [[c]]) opaque(x + y); } else { - // CHECK: opaque::([[c]]) + // CHECK: opaque::(copy [[c]]) opaque(x + y); } } @@ -469,18 +469,18 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S) { // CHECK-LABEL: fn dereferences( // Do not reuse dereferences of `&mut`. - // CHECK: [[st1:_.*]] = (*_1); + // CHECK: [[st1:_.*]] = copy (*_1); // CHECK: opaque::(move [[st1]]) - // CHECK: [[st2:_.*]] = (*_1); + // CHECK: [[st2:_.*]] = copy (*_1); // CHECK: opaque::(move [[st2]]) opaque(*t); opaque(*t); // Do not reuse dereferences of `*const`. // CHECK: [[raw:_.*]] = &raw const (*_1); - // CHECK: [[st3:_.*]] = (*[[raw]]); + // CHECK: [[st3:_.*]] = copy (*[[raw]]); // CHECK: opaque::(move [[st3]]) - // CHECK: [[st4:_.*]] = (*[[raw]]); + // CHECK: [[st4:_.*]] = copy (*[[raw]]); // CHECK: opaque::(move [[st4]]) let z = &raw const *t; unsafe { opaque(*z) }; @@ -488,9 +488,9 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S) { // Do not reuse dereferences of `*mut`. // CHECK: [[ptr:_.*]] = &raw mut (*_1); - // CHECK: [[st5:_.*]] = (*[[ptr]]); + // CHECK: [[st5:_.*]] = copy (*[[ptr]]); // CHECK: opaque::(move [[st5]]) - // CHECK: [[st6:_.*]] = (*[[ptr]]); + // CHECK: [[st6:_.*]] = copy (*[[ptr]]); // CHECK: opaque::(move [[st6]]) let z = &raw mut *t; unsafe { opaque(*z) }; @@ -498,9 +498,9 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S) { // We can reuse dereferences of `&Freeze`. // CHECK: [[ref:_.*]] = &(*_1); - // CHECK: [[st7:_.*]] = (*[[ref]]); - // CHECK: opaque::([[st7]]) - // CHECK: opaque::([[st7]]) + // CHECK: [[st7:_.*]] = copy (*[[ref]]); + // CHECK: opaque::(copy [[st7]]) + // CHECK: opaque::(copy [[st7]]) let z = &*t; opaque(*z); opaque(*z); @@ -510,17 +510,17 @@ fn dereferences(t: &mut u32, u: &impl Copy, s: &S) { opaque(&*z); // `*u` is not Freeze, so we cannot reuse. - // CHECK: [[st8:_.*]] = (*_2); + // CHECK: [[st8:_.*]] = copy (*_2); // CHECK: opaque::(move [[st8]]) - // CHECK: [[st9:_.*]] = (*_2); + // CHECK: [[st9:_.*]] = copy (*_2); // CHECK: opaque::(move [[st9]]) opaque(*u); opaque(*u); - // `*s` is not Copy, by `(*s).0` is, so we can reuse. - // CHECK: [[st10:_.*]] = ((*_3).0: u32); - // CHECK: opaque::([[st10]]) - // CHECK: opaque::([[st10]]) + // `*s` is not Copy, but `(*s).0` is, so we can reuse. + // CHECK: [[st10:_.*]] = copy ((*_3).0: u32); + // CHECK: opaque::(copy [[st10]]) + // CHECK: opaque::(copy [[st10]]) opaque(s.0); opaque(s.0); } @@ -551,38 +551,38 @@ fn duplicate_slice() -> (bool, bool) { let d: &str; { // CHECK: [[a:_.*]] = (const "a",); - // CHECK: [[au:_.*]] = ([[a]].0: &str) as u128 (Transmute); + // CHECK: [[au:_.*]] = copy ([[a]].0: &str) as u128 (Transmute); let a = ("a",); Call(au = transmute::<_, u128>(a.0), ReturnTo(bb1), UnwindContinue()) } bb1 = { - // CHECK: [[c:_.*]] = identity::<&str>(([[a]].0: &str)) + // CHECK: [[c:_.*]] = identity::<&str>(copy ([[a]].0: &str)) Call(c = identity(a.0), ReturnTo(bb2), UnwindContinue()) } bb2 = { - // CHECK: [[cu:_.*]] = [[c]] as u128 (Transmute); + // CHECK: [[cu:_.*]] = copy [[c]] as u128 (Transmute); Call(cu = transmute::<_, u128>(c), ReturnTo(bb3), UnwindContinue()) } bb3 = { // This slice is different from `a.0`. Hence `bu` is not `au`. // CHECK: [[b:_.*]] = const "a"; - // CHECK: [[bu:_.*]] = [[b]] as u128 (Transmute); + // CHECK: [[bu:_.*]] = copy [[b]] as u128 (Transmute); let b = "a"; Call(bu = transmute::<_, u128>(b), ReturnTo(bb4), UnwindContinue()) } bb4 = { // This returns a copy of `b`, which is not `a`. - // CHECK: [[d:_.*]] = identity::<&str>([[b]]) + // CHECK: [[d:_.*]] = identity::<&str>(copy [[b]]) Call(d = identity(b), ReturnTo(bb5), UnwindContinue()) } bb5 = { - // CHECK: [[du:_.*]] = [[d]] as u128 (Transmute); + // CHECK: [[du:_.*]] = copy [[d]] as u128 (Transmute); Call(du = transmute::<_, u128>(d), ReturnTo(bb6), UnwindContinue()) } bb6 = { // `direct` must not fold to `true`, as `indirect` will not. - // CHECK: = Eq([[au]], [[bu]]); - // CHECK: = Eq([[cu]], [[du]]); + // CHECK: = Eq(copy [[au]], copy [[bu]]); + // CHECK: = Eq(copy [[cu]], copy [[du]]); let direct = au == bu; let indirect = cu == du; RET = (direct, indirect); @@ -602,21 +602,21 @@ fn repeat() { fn fn_pointers() { // CHECK-LABEL: fn fn_pointers( // CHECK: [[f:_.*]] = identity:: as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer - // CHECK: opaque:: u8>([[f]]) + // CHECK: opaque:: u8>(copy [[f]]) let f = identity as fn(u8) -> u8; opaque(f); // CHECK: [[g:_.*]] = identity:: as fn(u8) -> u8 (PointerCoercion(ReifyFnPointer - // CHECK: opaque:: u8>([[g]]) + // CHECK: opaque:: u8>(copy [[g]]) let g = identity as fn(u8) -> u8; opaque(g); // CHECK: [[cf:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer - // CHECK: opaque::([[cf]]) + // CHECK: opaque::(copy [[cf]]) let closure = || {}; let cf = closure as fn(); opaque(cf); // CHECK: [[cg:_.*]] = const {{.*}} as fn() (PointerCoercion(ClosureFnPointer - // CHECK: opaque::([[cg]]) + // CHECK: opaque::(copy [[cg]]) let cg = closure as fn(); opaque(cg); } @@ -642,9 +642,9 @@ fn constant_index_overflow(x: &[T]) { // CHECK: debug b => [[b:_.*]]; // CHECK: [[a]] = const usize::MAX; // CHECK-NOT: = (*_1)[{{.*}} of 0]; - // CHECK: [[b]] = (*_1)[[[a]]]; + // CHECK: [[b]] = copy (*_1)[[[a]]]; // CHECK-NOT: = (*_1)[{{.*}} of 0]; - // CHECK: [[b]] = (*_1)[0 of 1]; + // CHECK: [[b]] = copy (*_1)[0 of 1]; // CHECK-NOT: = (*_1)[{{.*}} of 0]; let a = u64::MAX as usize; let b = if a < x.len() { x[a] } else { x[0] }; @@ -657,22 +657,22 @@ fn wide_ptr_provenance() { let a: *const dyn Send = &1 as &dyn Send; let b: *const dyn Send = &1 as &dyn Send; - // CHECK: [[eqp:_.*]] = Eq([[a:_.*]], [[b:_.*]]); + // CHECK: [[eqp:_.*]] = Eq(copy [[a:_.*]], copy [[b:_.*]]); // CHECK: opaque::(move [[eqp]]) opaque(a == b); - // CHECK: [[nep:_.*]] = Ne([[a]], [[b]]); + // CHECK: [[nep:_.*]] = Ne(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[nep]]) opaque(a != b); - // CHECK: [[ltp:_.*]] = Lt([[a]], [[b]]); + // CHECK: [[ltp:_.*]] = Lt(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[ltp]]) opaque(a < b); - // CHECK: [[lep:_.*]] = Le([[a]], [[b]]); + // CHECK: [[lep:_.*]] = Le(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[lep]]) opaque(a <= b); - // CHECK: [[gtp:_.*]] = Gt([[a]], [[b]]); + // CHECK: [[gtp:_.*]] = Gt(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[gtp]]) opaque(a > b); - // CHECK: [[gep:_.*]] = Ge([[a]], [[b]]); + // CHECK: [[gep:_.*]] = Ge(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[gep]]) opaque(a >= b); } @@ -684,22 +684,22 @@ fn wide_ptr_same_provenance() { let a: *const dyn Send = &slice[0] as &dyn Send; let b: *const dyn Send = &slice[1] as &dyn Send; - // CHECK: [[eqp:_.*]] = Eq([[a:_.*]], [[b:_.*]]); + // CHECK: [[eqp:_.*]] = Eq(copy [[a:_.*]], copy [[b:_.*]]); // CHECK: opaque::(move [[eqp]]) opaque(a == b); - // CHECK: [[nep:_.*]] = Ne([[a]], [[b]]); + // CHECK: [[nep:_.*]] = Ne(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[nep]]) opaque(a != b); - // CHECK: [[ltp:_.*]] = Lt([[a]], [[b]]); + // CHECK: [[ltp:_.*]] = Lt(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[ltp]]) opaque(a < b); - // CHECK: [[lep:_.*]] = Le([[a]], [[b]]); + // CHECK: [[lep:_.*]] = Le(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[lep]]) opaque(a <= b); - // CHECK: [[gtp:_.*]] = Gt([[a]], [[b]]); + // CHECK: [[gtp:_.*]] = Gt(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[gtp]]) opaque(a > b); - // CHECK: [[gep:_.*]] = Ge([[a]], [[b]]); + // CHECK: [[gep:_.*]] = Ge(copy [[a]], copy [[b]]); // CHECK: opaque::(move [[gep]]) opaque(a >= b); } @@ -731,13 +731,13 @@ fn wide_ptr_integer() { fn borrowed(x: T) { // CHECK-LABEL: fn borrowed( // CHECK: bb0: { - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::(_1) + // CHECK-NEXT: _0 = opaque::(copy _1) // CHECK: bb2: { - // CHECK-NEXT: _0 = opaque::(_1) + // CHECK-NEXT: _0 = opaque::(copy _1) mir! { { let a = x; @@ -761,13 +761,13 @@ fn borrowed(x: T) { fn non_freeze(x: T) { // CHECK-LABEL: fn non_freeze( // CHECK: bb0: { - // CHECK-NEXT: _2 = _1; + // CHECK-NEXT: _2 = copy _1; // CHECK-NEXT: _3 = &_1; - // CHECK-NEXT: _0 = opaque::<&T>(_3) + // CHECK-NEXT: _0 = opaque::<&T>(copy _3) // CHECK: bb1: { - // CHECK-NEXT: _0 = opaque::(_2) + // CHECK-NEXT: _0 = opaque::(copy _2) // CHECK: bb2: { - // CHECK-NEXT: _0 = opaque::((*_3)) + // CHECK-NEXT: _0 = opaque::(copy (*_3)) mir! { { let a = x; @@ -789,7 +789,7 @@ fn non_freeze(x: T) { // Check that we can const-prop into `from_raw_parts` fn slice_const_length(x: &[i32]) -> *const [i32] { // CHECK-LABEL: fn slice_const_length( - // CHECK: _0 = *const [i32] from ({{_[0-9]+}}, const 123_usize); + // CHECK: _0 = *const [i32] from (copy {{_[0-9]+}}, const 123_usize); let ptr = x.as_ptr(); let len = 123; std::intrinsics::aggregate_raw_ptr(ptr, len) @@ -804,15 +804,15 @@ fn meta_of_ref_to_slice(x: *const i32) -> usize { fn slice_from_raw_parts_as_ptr(x: *const u16, n: usize) -> (*const u16, *const f32) { // CHECK-LABEL: fn slice_from_raw_parts_as_ptr - // CHECK: _8 = _1 as *const f32 (PtrToPtr); - // CHECK: _0 = (_1, move _8); + // CHECK: _8 = copy _1 as *const f32 (PtrToPtr); + // CHECK: _0 = (copy _1, move _8); let ptr: *const [u16] = std::intrinsics::aggregate_raw_ptr(x, n); (ptr as *const u16, ptr as *const f32) } fn casts_before_aggregate_raw_ptr(x: *const u32) -> *const [u8] { // CHECK-LABEL: fn casts_before_aggregate_raw_ptr - // CHECK: _0 = *const [u8] from (_1, const 4_usize); + // CHECK: _0 = *const [u8] from (copy _1, const 4_usize); let x = x as *const [u8; 4]; let x = x as *const u8; let x = x as *const (); @@ -821,7 +821,7 @@ fn casts_before_aggregate_raw_ptr(x: *const u32) -> *const [u8] { fn manual_slice_mut_len(x: &mut [i32]) -> usize { // CHECK-LABEL: fn manual_slice_mut_len - // CHECK: _0 = PtrMetadata(_1); + // CHECK: _0 = PtrMetadata(copy _1); let x: *mut [i32] = x; let x: *const [i32] = x; std::intrinsics::ptr_metadata(x) @@ -844,38 +844,38 @@ fn generic_cast_metadata(ps: *const [T], pa: *const A, // when the pointee metadata do or don't match, respectively. // Metadata usize -> (), do not optimize. - // CHECK: [[T:_.+]] = _1 as - // CHECK-NEXT: PtrMetadata([[T]]) + // CHECK: [[T:_.+]] = copy _1 as + // CHECK-NEXT: PtrMetadata(copy [[T]]) let t1 = CastPtrToPtr::<_, *const T>(ps); let m1 = PtrMetadata(t1); // `(&A, [T])` has `usize` metadata, same as `[T]`, yes optimize. - // CHECK: [[T:_.+]] = _1 as - // CHECK-NEXT: PtrMetadata(_1) + // CHECK: [[T:_.+]] = copy _1 as + // CHECK-NEXT: PtrMetadata(copy _1) let t2 = CastPtrToPtr::<_, *const (&A, [T])>(ps); let m2 = PtrMetadata(t2); // Tail `A` and tail `B`, do not optimize. - // CHECK: [[T:_.+]] = _2 as - // CHECK-NEXT: PtrMetadata([[T]]) + // CHECK: [[T:_.+]] = copy _2 as + // CHECK-NEXT: PtrMetadata(copy [[T]]) let t3 = CastPtrToPtr::<_, *const (T, B)>(pa); let m3 = PtrMetadata(t3); // Both have tail `A`, yes optimize. - // CHECK: [[T:_.+]] = _2 as - // CHECK-NEXT: PtrMetadata(_2) + // CHECK: [[T:_.+]] = copy _2 as + // CHECK-NEXT: PtrMetadata(copy _2) let t4 = CastPtrToPtr::<_, *const (T, A)>(pa); let m4 = PtrMetadata(t4); // Tail `B` and tail `A`, do not optimize. - // CHECK: [[T:_.+]] = _3 as - // CHECK-NEXT: PtrMetadata([[T]]) + // CHECK: [[T:_.+]] = copy _3 as + // CHECK-NEXT: PtrMetadata(copy [[T]]) let t5 = CastPtrToPtr::<_, *mut A>(pb); let m5 = PtrMetadata(t5); // Both have tail `B`, yes optimize. - // CHECK: [[T:_.+]] = _3 as - // CHECK-NEXT: PtrMetadata(_3) + // CHECK: [[T:_.+]] = copy _3 as + // CHECK-NEXT: PtrMetadata(copy _3) let t6 = CastPtrToPtr::<_, *mut B>(pb); let m6 = PtrMetadata(t6); @@ -891,21 +891,21 @@ fn cast_pointer_eq(p1: *mut u8, p2: *mut u32, p3: *mut u32, p4: *mut [u32]) { // CHECK: debug p3 => [[P3:_3]]; // CHECK: debug p4 => [[P4:_4]]; - // CHECK: [[M1:_.+]] = [[P1]] as *const u32 (PtrToPtr); - // CHECK: [[M2:_.+]] = [[P2]] as *const u32 (PtrToPtr); - // CHECK: [[M3:_.+]] = [[P3]] as *const u32 (PtrToPtr); - // CHECK: [[M4:_.+]] = [[P4]] as *const u32 (PtrToPtr); + // CHECK: [[M1:_.+]] = copy [[P1]] as *const u32 (PtrToPtr); + // CHECK: [[M2:_.+]] = copy [[P2]] as *const u32 (PtrToPtr); + // CHECK: [[M3:_.+]] = copy [[P3]] as *const u32 (PtrToPtr); + // CHECK: [[M4:_.+]] = copy [[P4]] as *const u32 (PtrToPtr); let m1 = p1 as *const u32; let m2 = p2 as *const u32; let m3 = p3 as *const u32; let m4 = p4 as *const u32; // CHECK-NOT: Eq - // CHECK: Eq([[M1]], [[M2]]) + // CHECK: Eq(copy [[M1]], copy [[M2]]) // CHECK-NOT: Eq - // CHECK: Eq([[P2]], [[P3]]) + // CHECK: Eq(copy [[P2]], copy [[P3]]) // CHECK-NOT: Eq - // CHECK: Eq([[M3]], [[M4]]) + // CHECK: Eq(copy [[M3]], copy [[M4]]) // CHECK-NOT: Eq let eq_different_thing = m1 == m2; let eq_optimize = m2 == m3; @@ -918,11 +918,11 @@ fn cast_pointer_eq(p1: *mut u8, p2: *mut u32, p3: *mut u32, p4: *mut [u32]) { unsafe fn cast_pointer_then_transmute(thin: *mut u32, fat: *mut [u8]) { // CHECK-LABEL: fn cast_pointer_then_transmute - // CHECK: [[UNUSED:_.+]] = _1 as *const () (PtrToPtr); - // CHECK: = _1 as usize (Transmute); + // CHECK: [[UNUSED:_.+]] = copy _1 as *const () (PtrToPtr); + // CHECK: = copy _1 as usize (Transmute); let thin_addr: usize = std::intrinsics::transmute(thin as *const ()); - // CHECK: [[TEMP2:_.+]] = _2 as *const () (PtrToPtr); + // CHECK: [[TEMP2:_.+]] = copy _2 as *const () (PtrToPtr); // CHECK: = move [[TEMP2]] as usize (Transmute); let fat_addr: usize = std::intrinsics::transmute(fat as *const ()); } @@ -935,11 +935,11 @@ fn remove_casts_must_change_both_sides(mut_a: &*mut u8, mut_b: *mut u8) -> bool // to be locals, so make sure we don't change one without the other, as // that would be a type error. { - // CHECK: [[A:_.+]] = (*_1) as *const u8 (PtrToPtr); + // CHECK: [[A:_.+]] = copy (*_1) as *const u8 (PtrToPtr); let a = *mut_a as *const u8; - // CHECK: [[B:_.+]] = _2 as *const u8 (PtrToPtr); + // CHECK: [[B:_.+]] = copy _2 as *const u8 (PtrToPtr); let b = mut_b as *const u8; - // CHECK: _0 = Eq([[A]], [[B]]); + // CHECK: _0 = Eq(copy [[A]], copy [[B]]); RET = a == b; Return() } diff --git a/tests/mir-opt/gvn_copy_moves.rs b/tests/mir-opt/gvn_copy_moves.rs index 1812de16d69..b1fe2caf3a1 100644 --- a/tests/mir-opt/gvn_copy_moves.rs +++ b/tests/mir-opt/gvn_copy_moves.rs @@ -18,9 +18,9 @@ fn fn0() { // CHECK-NEXT: _1 = const 1_usize; // CHECK-NEXT: _2 = [const 42_u128; 6]; // CHECK-NEXT: _2[1 of 2] = const 1_u128; - // CHECK-NEXT: _3 = (_2,); - // CHECK-NEXT: _4 = _3; - // CHECK-NEXT: _5 = fn1((_3.0: [u128; 6]), _3) + // CHECK-NEXT: _3 = (copy _2,); + // CHECK-NEXT: _4 = copy _3; + // CHECK-NEXT: _5 = fn1(copy (_3.0: [u128; 6]), copy _3) a = 1_usize; b = [42; 6]; b[a] = 1; diff --git a/tests/mir-opt/instsimplify/casts.rs b/tests/mir-opt/instsimplify/casts.rs index 24dbb67b42d..27308ee52bc 100644 --- a/tests/mir-opt/instsimplify/casts.rs +++ b/tests/mir-opt/instsimplify/casts.rs @@ -19,7 +19,7 @@ pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { // EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn roundtrip(x: *const u8) -> *const u8 { // CHECK-LABEL: fn roundtrip( - // CHECK: _4 = _1; + // CHECK: _4 = copy _1; // CHECK: _3 = move _4 as *mut u8 (PtrToPtr); // CHECK: _2 = move _3 as *const u8 (PtrToPtr); x as *mut u8 as *const u8 @@ -28,7 +28,7 @@ pub fn roundtrip(x: *const u8) -> *const u8 { // EMIT_MIR casts.roundtrip.InstSimplify-after-simplifycfg.diff pub fn cast_thin_via_aggregate(x: *const u8) -> *const () { // CHECK-LABEL: fn cast_thin_via_aggregate( - // CHECK: _2 = _1; + // CHECK: _2 = copy _1; // CHECK: _0 = move _2 as *const () (PtrToPtr); std::intrinsics::aggregate_raw_ptr(x, ()) } diff --git a/tests/mir-opt/instsimplify/ref_of_deref.rs b/tests/mir-opt/instsimplify/ref_of_deref.rs index dc0f5f8198b..5ba9bafaea2 100644 --- a/tests/mir-opt/instsimplify/ref_of_deref.rs +++ b/tests/mir-opt/instsimplify/ref_of_deref.rs @@ -8,11 +8,11 @@ // EMIT_MIR ref_of_deref.references.InstSimplify-after-simplifycfg.diff // CHECK-LABEL: references pub fn references(const_ref: &i32, mut_ref: &mut [i32]) { - // CHECK: _3 = _1; + // CHECK: _3 = copy _1; let _a = &*const_ref; // CHECK: _4 = &(*_2); let _b = &*mut_ref; - // CHECK: _5 = _2; + // CHECK: _5 = copy _2; let _c = &mut *mut_ref; // CHECK: _6 = &raw const (*_1); let _d = &raw const *const_ref; @@ -31,10 +31,10 @@ pub unsafe fn pointers(const_ptr: *const [i32], mut_ptr: *mut i32) { let _b = &*mut_ptr; // CHECK: _5 = &mut (*_2); let _c = &mut *mut_ptr; - // CHECK: _6 = _1; + // CHECK: _6 = copy _1; let _d = &raw const *const_ptr; // CHECK: _7 = &raw const (*_2); let _e = &raw const *mut_ptr; - // CHECK: _8 = _2; + // CHECK: _8 = copy _2; let _f = &raw mut *mut_ptr; } diff --git a/tests/mir-opt/instsimplify/ub_check.rs b/tests/mir-opt/instsimplify/ub_check.rs index ee72511c132..b513f60dc7b 100644 --- a/tests/mir-opt/instsimplify/ub_check.rs +++ b/tests/mir-opt/instsimplify/ub_check.rs @@ -6,7 +6,7 @@ pub fn unwrap_unchecked(x: Option) -> i32 { // CHECK-LABEL: fn unwrap_unchecked( // CHECK-NOT: UbChecks() // CHECK: [[assume:_.*]] = const false; - // CHECK-NEXT: assume([[assume]]); + // CHECK-NEXT: assume(copy [[assume]]); // CHECK-NEXT: unreachable_unchecked::precondition_check unsafe { x.unwrap_unchecked() } } diff --git a/tests/mir-opt/jump_threading.rs b/tests/mir-opt/jump_threading.rs index 6486a321e69..9487a4e7e5f 100644 --- a/tests/mir-opt/jump_threading.rs +++ b/tests/mir-opt/jump_threading.rs @@ -24,11 +24,11 @@ fn too_complex(x: Result) -> Option { // CHECK: bb4: { // CHECK: goto -> bb6; // CHECK: bb5: { - // CHECK: {{_.*}} = (([[controlflow]] as Break).0: usize); + // CHECK: {{_.*}} = copy (([[controlflow]] as Break).0: usize); // CHECK: _0 = Option::::None; // CHECK: goto -> bb7; // CHECK: bb6: { - // CHECK: {{_.*}} = (([[controlflow]] as Continue).0: i32); + // CHECK: {{_.*}} = copy (([[controlflow]] as Continue).0: i32); // CHECK: _0 = Option::::Some( // CHECK: goto -> bb7; // CHECK: bb7: { @@ -49,16 +49,16 @@ fn too_complex(x: Result) -> Option { fn identity(x: Result) -> Result { // CHECK-LABEL: fn identity( // CHECK: bb0: { - // CHECK: [[x:_.*]] = _1; + // CHECK: [[x:_.*]] = copy _1; // CHECK: switchInt(move {{_.*}}) -> [0: bb7, 1: bb6, otherwise: bb1]; // CHECK: bb1: { // CHECK: unreachable; // CHECK: bb2: { - // CHECK: {{_.*}} = (([[controlflow:_.*]] as Continue).0: i32); + // CHECK: {{_.*}} = copy (([[controlflow:_.*]] as Continue).0: i32); // CHECK: _0 = Result::::Ok( // CHECK: goto -> bb4; // CHECK: bb3: { - // CHECK: {{_.*}} = (([[controlflow]] as Break).0: std::result::Result); + // CHECK: {{_.*}} = copy (([[controlflow]] as Break).0: std::result::Result); // CHECK: _0 = Result::::Err( // CHECK: goto -> bb4; // CHECK: bb4: { @@ -160,13 +160,13 @@ fn multiple_match(x: u8) -> u8 { mir! { { // CHECK: bb0: { - // CHECK: switchInt([[x:_.*]]) -> [3: bb1, otherwise: bb2]; + // CHECK: switchInt(copy [[x:_.*]]) -> [3: bb1, otherwise: bb2]; match x { 3 => bb1, _ => bb2 } } bb1 = { // We know `x == 3`, so we can take `bb3`. // CHECK: bb1: { - // CHECK: {{_.*}} = [[x]]; + // CHECK: {{_.*}} = copy [[x]]; // CHECK: goto -> bb3; let y = x; match y { 3 => bb3, _ => bb4 } @@ -174,7 +174,7 @@ fn multiple_match(x: u8) -> u8 { bb2 = { // We know `x != 3`, so we can take `bb6`. // CHECK: bb2: { - // CHECK: [[z:_.*]] = [[x]]; + // CHECK: [[z:_.*]] = copy [[x]]; // CHECK: goto -> bb6; let z = x; match z { 3 => bb5, _ => bb6 } @@ -203,7 +203,7 @@ fn multiple_match(x: u8) -> u8 { bb6 = { // We know `z != 3`, so we CANNOT take `bb7`. // CHECK: bb6: { - // CHECK: switchInt([[z]]) -> [1: bb7, otherwise: bb8]; + // CHECK: switchInt(copy [[z]]) -> [1: bb7, otherwise: bb8]; match z { 1 => bb7, _ => bb8 } } bb7 = { @@ -467,12 +467,12 @@ fn assume(a: u8, b: bool) -> u8 { mir! { { // CHECK: bb0: { - // CHECK-NEXT: switchInt(_1) -> [7: bb1, otherwise: bb2] + // CHECK-NEXT: switchInt(copy _1) -> [7: bb1, otherwise: bb2] match a { 7 => bb1, _ => bb2 } } bb1 = { // CHECK: bb1: { - // CHECK-NEXT: assume(_2); + // CHECK-NEXT: assume(copy _2); // CHECK-NEXT: goto -> bb6; Assume(b); Goto(bb3) @@ -484,7 +484,7 @@ fn assume(a: u8, b: bool) -> u8 { } bb3 = { // CHECK: bb3: { - // CHECK-NEXT: switchInt(_2) -> [0: bb4, otherwise: bb5]; + // CHECK-NEXT: switchInt(copy _2) -> [0: bb4, otherwise: bb5]; match b { false => bb4, _ => bb5 } } bb4 = { diff --git a/tests/mir-opt/lower_array_len.rs b/tests/mir-opt/lower_array_len.rs index f7ed376726c..6553343cbf0 100644 --- a/tests/mir-opt/lower_array_len.rs +++ b/tests/mir-opt/lower_array_len.rs @@ -6,7 +6,7 @@ pub fn array_bound(index: usize, slice: &[u8; N]) -> u8 { // CHECK-LABEL: fn array_bound( // CHECK-NOT: Lt - // CHECK: Lt(_1, const N); + // CHECK: Lt(copy _1, const N); // CHECK-NOT: Lt if index < slice.len() { slice[index] } else { 42 } } @@ -15,7 +15,7 @@ pub fn array_bound_mut(index: usize, slice: &mut [u8; N]) -> u8 { // CHECK-LABEL: fn array_bound_mut( // CHECK-NOT: Lt - // CHECK: Lt(_1, const N); + // CHECK: Lt(copy _1, const N); // CHECK-NOT: Lt // CHECK: Lt(const 0_usize, const N) // CHECK-NOT: Lt diff --git a/tests/mir-opt/lower_intrinsics.rs b/tests/mir-opt/lower_intrinsics.rs index 2569f4f4de5..4859d935461 100644 --- a/tests/mir-opt/lower_intrinsics.rs +++ b/tests/mir-opt/lower_intrinsics.rs @@ -197,7 +197,7 @@ pub fn with_overflow(a: i32, b: i32) { pub fn read_via_copy_primitive(r: &i32) -> i32 { // CHECK-LABEL: fn read_via_copy_primitive( // CHECK: [[tmp:_.*]] = &raw const (*_1); - // CHECK: _0 = (*[[tmp]]); + // CHECK: _0 = copy (*[[tmp]]); // CHECK: return; unsafe { core::intrinsics::read_via_copy(r) } @@ -207,7 +207,7 @@ pub fn read_via_copy_primitive(r: &i32) -> i32 { pub fn read_via_copy_uninhabited(r: &Never) -> Never { // CHECK-LABEL: fn read_via_copy_uninhabited( // CHECK: [[tmp:_.*]] = &raw const (*_1); - // CHECK: _0 = (*[[tmp]]); + // CHECK: _0 = copy (*[[tmp]]); // CHECK: unreachable; unsafe { core::intrinsics::read_via_copy(r) } diff --git a/tests/mir-opt/pre-codegen/slice_index.rs b/tests/mir-opt/pre-codegen/slice_index.rs index 6ddc4ad0220..574062d6c35 100644 --- a/tests/mir-opt/pre-codegen/slice_index.rs +++ b/tests/mir-opt/pre-codegen/slice_index.rs @@ -10,17 +10,17 @@ pub fn slice_index_usize(slice: &[u32], index: usize) -> u32 { // CHECK-LABEL: slice_index_usize // CHECK: [[LEN:_[0-9]+]] = Len((*_1)) - // CHECK: Lt(_2, [[LEN]]) + // CHECK: Lt(copy _2, copy [[LEN]]) // CHECK-NOT: precondition_check - // CHECK: _0 = (*_1)[_2]; + // CHECK: _0 = copy (*_1)[_2]; slice[index] } // EMIT_MIR slice_index.slice_get_mut_usize.PreCodegen.after.mir pub fn slice_get_mut_usize(slice: &mut [u32], index: usize) -> Option<&mut u32> { // CHECK-LABEL: slice_get_mut_usize - // CHECK: [[LEN:_[0-9]+]] = PtrMetadata(_1) - // CHECK: Lt(_2, move [[LEN]]) + // CHECK: [[LEN:_[0-9]+]] = PtrMetadata(copy _1) + // CHECK: Lt(copy _2, move [[LEN]]) // CHECK-NOT: precondition_check slice.get_mut(index) } @@ -37,9 +37,9 @@ pub unsafe fn slice_get_unchecked_mut_range(slice: &mut [u32], index: Range(single: &'a T, mut multiple: &'a T) { // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &a; // This borrow is only used once. @@ -32,7 +32,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[btmp:_.*]] = &[[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let a2 = 7_usize; @@ -49,7 +49,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &a; @@ -64,7 +64,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &a; @@ -78,7 +78,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &[[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 7_usize; let b = &a; @@ -91,10 +91,10 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &[[a]]; - // CHECK: [[c:_.*]] = [[a]]; - // CHECK: [[b2:_.*]] = [[b1]]; - // CHECK: [[c2:_.*]] = [[a]]; - // CHECK: [[b3:_.*]] = [[b2]]; + // CHECK: [[c:_.*]] = copy [[a]]; + // CHECK: [[b2:_.*]] = copy [[b1]]; + // CHECK: [[c2:_.*]] = copy [[a]]; + // CHECK: [[b3:_.*]] = copy [[b2]]; let a = 7_usize; let b1 = &a; @@ -111,7 +111,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &*single; let b = *a; // This should be optimized as `*single`. @@ -124,7 +124,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = &(*_2); // CHECK: [[tmp:_.*]] = &(*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &*multiple; multiple = &*single; @@ -138,7 +138,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &a; @@ -154,7 +154,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { // CHECK: [[b:_.*]] = &[[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &a; @@ -172,7 +172,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &mut [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let mut a = 5_usize; let b = &mut a; // This borrow is only used once. @@ -188,7 +188,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[btmp:_.*]] = &mut [[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut a2 = 7_usize; @@ -205,7 +205,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &mut a; @@ -220,7 +220,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &mut a; @@ -234,7 +234,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 7_usize; let b = &mut a; @@ -247,9 +247,9 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b1]]); + // CHECK: [[c:_.*]] = copy (*[[b1]]); // CHECK: [[b2:_.*]] = move [[b1]]; - // CHECK: [[c2:_.*]] = (*[[b2]]); + // CHECK: [[c2:_.*]] = copy (*[[b2]]); // CHECK: [[b3:_.*]] = move [[b2]]; let mut a = 7_usize; @@ -267,7 +267,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &mut *single; let b = *a; // This should be optimized as `*single`. @@ -280,7 +280,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[a:_.*]] = &mut (*_2); // CHECK: [[tmp:_.*]] = &mut (*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &mut *multiple; multiple = &mut *single; @@ -295,7 +295,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &mut a; @@ -311,7 +311,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m // CHECK: [[b:_.*]] = &mut [[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &mut a; @@ -329,7 +329,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &raw const a; // This borrow is only used once. @@ -345,7 +345,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[btmp:_.*]] = &raw const [[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let a2 = 7_usize; @@ -362,7 +362,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &raw const a; @@ -377,7 +377,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &raw const a; @@ -391,7 +391,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 7_usize; let b = &raw const a; @@ -404,10 +404,10 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; - // CHECK: [[b2:_.*]] = [[b1]]; - // CHECK: [[c2:_.*]] = [[a]]; - // CHECK: [[b3:_.*]] = [[b2]]; + // CHECK: [[c:_.*]] = copy [[a]]; + // CHECK: [[b2:_.*]] = copy [[b1]]; + // CHECK: [[c2:_.*]] = copy [[a]]; + // CHECK: [[b3:_.*]] = copy [[b2]]; let a = 7_usize; let b1 = &raw const a; @@ -424,7 +424,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con unsafe { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &raw const *single; let b = *a; // This should be optimized as `*single`. @@ -437,7 +437,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = &raw const (*_2); // CHECK: [[tmp:_.*]] = &raw const (*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &raw const *multiple; multiple = &raw const *single; @@ -451,7 +451,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 13_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &raw const [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 13_usize; let b = &raw const a; @@ -466,7 +466,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let a = 5_usize; let b = &raw const a; @@ -482,7 +482,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con // CHECK: [[b:_.*]] = &raw const [[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let a = 5_usize; let mut b = &raw const a; @@ -500,7 +500,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: bb0: { // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; - // CHECK: [[c:_.*]] = [[a]]; + // CHECK: [[c:_.*]] = copy [[a]]; let mut a = 5_usize; let b = &raw mut a; // This borrow is only used once. @@ -516,7 +516,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[btmp:_.*]] = &raw mut [[a2]]; // CHECK: [[b]] = move [[btmp]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut a2 = 7_usize; @@ -533,7 +533,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &raw mut a; @@ -548,7 +548,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: [[a:_.*]] = const 5_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &raw mut [[b]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &raw mut a; @@ -562,7 +562,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: bb4: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b:_.*]] = &raw mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 7_usize; let b = &raw mut a; @@ -575,10 +575,10 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: bb5: { // CHECK: [[a:_.*]] = const 7_usize; // CHECK: [[b1:_.*]] = &raw mut [[a]]; - // CHECK: [[c:_.*]] = (*[[b1]]); - // CHECK: [[b2:_.*]] = [[b1]]; - // CHECK: [[c2:_.*]] = (*[[b2]]); - // CHECK: [[b3:_.*]] = [[b2]]; + // CHECK: [[c:_.*]] = copy (*[[b1]]); + // CHECK: [[b2:_.*]] = copy [[b1]]; + // CHECK: [[c2:_.*]] = copy (*[[b2]]); + // CHECK: [[b3:_.*]] = copy [[b2]]; let mut a = 7_usize; let b1 = &raw mut a; @@ -595,7 +595,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) unsafe { // CHECK: bb6: { // CHECK-NOT: {{_.*}} = &(*_1); - // CHECK: [[b:_.*]] = (*_1); + // CHECK: [[b:_.*]] = copy (*_1); let a = &raw mut *single; let b = *a; // This should be optimized as `*single`. @@ -608,7 +608,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: [[a:_.*]] = &raw mut (*_2); // CHECK: [[tmp:_.*]] = &raw mut (*_1); // CHECK: _2 = move [[tmp]]; - // CHECK: [[b:_.*]] = (*[[a]]); + // CHECK: [[b:_.*]] = copy (*[[a]]); let a = &raw mut *multiple; multiple = &raw mut *single; @@ -623,7 +623,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &[[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let b = &raw mut a; @@ -639,7 +639,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) // CHECK: [[b:_.*]] = &raw mut [[a]]; // CHECK: [[d:_.*]] = &mut [[b]]; // FIXME this could be [[a]] - // CHECK: [[c:_.*]] = (*[[b]]); + // CHECK: [[c:_.*]] = copy (*[[b]]); let mut a = 5_usize; let mut b = &raw mut a; @@ -653,8 +653,8 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) fn read_through_raw(x: &mut usize) -> usize { // CHECK-LABEL: read_through_raw // CHECK: bb0: { - // CHECK-NEXT: _0 = (*_1); - // CHECK-NEXT: _0 = (*_1); + // CHECK-NEXT: _0 = copy (*_1); + // CHECK-NEXT: _0 = copy (*_1); // CHECK-NEXT: return; use std::intrinsics::mir::*; @@ -680,7 +680,7 @@ fn read_through_raw(x: &mut usize) -> usize { #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn multiple_storage() { // CHECK-LABEL: multiple_storage - // CHECK: _3 = (*_2); + // CHECK: _3 = copy (*_2); use std::intrinsics::mir::*; mir! { @@ -706,7 +706,7 @@ fn multiple_storage() { #[custom_mir(dialect = "runtime", phase = "post-cleanup")] fn dominate_storage() { // CHECK-LABEL: dominate_storage - // CHECK: _5 = (*_2); + // CHECK: _5 = copy (*_2); use std::intrinsics::mir::*; mir! { @@ -798,12 +798,12 @@ fn unique_with_copies() { // CHECK: [[a:_.*]] = const 0_i32; // CHECK: [[x:_.*]] = &raw mut [[a]]; // CHECK-NOT: [[a]] - // CHECK: [[tmp:_.*]] = (*[[x]]); + // CHECK: [[tmp:_.*]] = copy (*[[x]]); // CHECK-NEXT: opaque::(move [[tmp]]) // CHECK-NOT: [[a]] // CHECK: StorageDead([[a]]); // CHECK-NOT: [[a]] - // CHECK: [[tmp:_.*]] = (*[[x]]); + // CHECK: [[tmp:_.*]] = copy (*[[x]]); // CHECK-NEXT: opaque::(move [[tmp]]) let y = { diff --git a/tests/mir-opt/simplify_dead_blocks.rs b/tests/mir-opt/simplify_dead_blocks.rs index b9a404fd35c..7f2134c6121 100644 --- a/tests/mir-opt/simplify_dead_blocks.rs +++ b/tests/mir-opt/simplify_dead_blocks.rs @@ -10,7 +10,7 @@ pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { // CHECK-LABEL: fn assert_nonzero_nonmax( // CHECK: bb0: { - // CHECK-NEXT: switchInt({{.*}}) -> [0: [[unreachable:bb.*]], 1: [[retblock2:bb.*]], 255: [[unreachable:bb.*]], otherwise: [[retblock:bb.*]]]; + // CHECK-NEXT: switchInt(copy {{_[0-9]+}}) -> [0: [[unreachable:bb.*]], 1: [[retblock2:bb.*]], 255: [[unreachable:bb.*]], otherwise: [[retblock:bb.*]]]; // CHECK-NEXT: } // CHECK-NOT: _0 = const 1_u8; // CHECK: [[retblock2]]: { @@ -21,7 +21,7 @@ pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 { // CHECK-NEXT: unreachable; // CHECK-NEXT: } // CHECK: [[retblock]]: { - // CHECK-NEXT: _0 = _1; + // CHECK-NEXT: _0 = copy _1; // CHECK-NEXT: return; // CHECK-NEXT: } mir! { diff --git a/tests/mir-opt/sroa/structs.rs b/tests/mir-opt/sroa/structs.rs index a177dbf71cf..d5f13f8b009 100644 --- a/tests/mir-opt/sroa/structs.rs +++ b/tests/mir-opt/sroa/structs.rs @@ -31,8 +31,8 @@ pub fn enums(a: usize) -> usize { // CHECK: bb0: { // CHECK: [[enum]] = Option::::Some - // CHECK: _5 = (([[enum]] as Some).0: usize) - // CHECK: _0 = _5 + // CHECK: _5 = copy (([[enum]] as Some).0: usize) + // CHECK: _0 = copy _5 if let Some(a) = Some(a) { a } else { 0 } } @@ -51,13 +51,13 @@ struct U { // CHECK: bb0: { // CHECK-NOT: [[struct]] - // CHECK: [[a_tmp]] = _1; + // CHECK: [[a_tmp]] = copy _1; // CHECK-NOT: [[struct]] // CHECK: [[foo]] = const 0_usize; // CHECK-NOT: [[struct]] // CHECK: [[a_ret]] = move [[a_tmp]]; // CHECK-NOT: [[struct]] - // CHECK: _0 = [[a_ret]]; + // CHECK: _0 = copy [[a_ret]]; // CHECK-NOT: [[struct]] U { _foo: 0, a }.a } @@ -73,7 +73,7 @@ union Repr { // CHECK: bb0: { // CHECK: [[union]] = Repr { - // CHECK: _0 = ([[union]].1: u32) + // CHECK: _0 = copy ([[union]].1: u32) unsafe { Repr { f: a }.u } } @@ -156,10 +156,10 @@ fn copies(x: Foo) { // CHECK: [[opt_isize:_[0-9]+]]: std::option::Option; // CHECK: bb0: { - // CHECK: [[byte]] = ([[external]].0 - // CHECK: [[unit]] = ([[external]].1 - // CHECK: [[str]] = ([[external]].2 - // CHECK: [[opt_isize]] = ([[external]].3 + // CHECK: [[byte]] = copy ([[external]].0 + // CHECK: [[unit]] = copy ([[external]].1 + // CHECK: [[str]] = copy ([[external]].2 + // CHECK: [[opt_isize]] = copy ([[external]].3 let y = x; let t = y.a; @@ -181,10 +181,10 @@ fn ref_copies(x: &Foo) { // CHECK: [[opt_isize:_[0-9]+]]: std::option::Option; // CHECK: bb0: { - // CHECK: [[byte]] = ((*[[external]]).0 - // CHECK: [[unit]] = ((*[[external]]).1 - // CHECK: [[str]] = ((*[[external]]).2 - // CHECK: [[opt_isize]] = ((*[[external]]).3 + // CHECK: [[byte]] = copy ((*[[external]]).0 + // CHECK: [[unit]] = copy ((*[[external]]).1 + // CHECK: [[str]] = copy ((*[[external]]).2 + // CHECK: [[opt_isize]] = copy ((*[[external]]).3 let y = *x; let t = y.a;