Skip to content

Commit 4010d46

Browse files
committed
Mark simplify_aggregate_to_copy mir-opt as unsound
Mark the `simplify_aggregate_to_copy` mir-opt added in <rust-lang#128299>. This **partially** reverts commit e7386b3, reversing changes made to 02b1be1. The implementation is just marked as unsound, but the test changes are reverted.
1 parent 8a90123 commit 4010d46

27 files changed

+50
-1542
lines changed

Diff for: compiler/rustc_mir_transform/src/gvn.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
10791079
}
10801080
}
10811081

1082-
if let AggregateTy::Def(_, _) = ty
1082+
// unsound: https://github.com/rust-lang/rust/issues/132353
1083+
if tcx.sess.opts.unstable_opts.unsound_mir_opts
1084+
&& let AggregateTy::Def(_, _) = ty
10831085
&& let Some(value) =
10841086
self.simplify_aggregate_to_copy(rvalue, location, &fields, variant_index)
10851087
{

Diff for: tests/codegen/clone_as_copy.rs

-40
This file was deleted.

Diff for: tests/codegen/enum/unreachable_enum_default_branch.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,11 @@ pub fn implicit_match(x: Int) -> bool {
2828
// The code is from https://github.com/rust-lang/rust/issues/110097.
2929
// We expect it to generate the same optimized code as a full match.
3030
// CHECK-LABEL: @if_let(
31-
// CHECK: start:
32-
// CHECK-NOT: zext
33-
// CHECK: select
31+
// CHECK-NEXT: start:
3432
// CHECK-NEXT: insertvalue
3533
// CHECK-NEXT: insertvalue
3634
// CHECK-NEXT: ret
3735
#[no_mangle]
3836
pub fn if_let(val: Result<i32, ()>) -> Result<i32, ()> {
39-
if let Ok(x) = val { Ok(x * 2) } else { Err(()) }
37+
if let Ok(x) = val { Ok(x) } else { Err(()) }
4038
}

Diff for: tests/mir-opt/gvn_clone.rs

-17
This file was deleted.

Diff for: tests/mir-opt/gvn_clone.{impl#0}-clone.GVN.diff

-71
This file was deleted.

Diff for: tests/mir-opt/gvn_copy_aggregate.all_copy.GVN.diff

-53
This file was deleted.

Diff for: tests/mir-opt/gvn_copy_aggregate.all_copy_2.GVN.diff

-64
This file was deleted.

Diff for: tests/mir-opt/gvn_copy_aggregate.all_copy_different_type.GVN.diff

-53
This file was deleted.

Diff for: tests/mir-opt/gvn_copy_aggregate.all_copy_has_changed.GVN.diff

-54
This file was deleted.

0 commit comments

Comments
 (0)