Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
244 changes: 114 additions & 130 deletions compiler/rustc_mir_transform/src/gvn.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/mir-opt/const_prop/transmute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub unsafe fn undef_union_as_integer() -> u32 {
pub unsafe fn unreachable_direct() -> ! {
// CHECK-LABEL: fn unreachable_direct(
// CHECK: = const ();
// CHECK: = const () as Never (Transmute);
// CHECK: = const ZeroSized: Never;
let x: Never = unsafe { transmute(()) };
match x {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- _2 = ();
- _1 = move _2 as Never (Transmute);
+ _2 = const ();
+ _1 = const () as Never (Transmute);
+ _1 = const ZeroSized: Never;
unreachable;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- _2 = ();
- _1 = move _2 as Never (Transmute);
+ _2 = const ();
+ _1 = const () as Never (Transmute);
+ _1 = const ZeroSized: Never;
unreachable;
}
}
Expand Down
3 changes: 2 additions & 1 deletion tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-abort.diff
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

bb0: {
_4 = copy _1 as *const T (PtrToPtr);
_5 = PtrMetadata(copy _4);
- _5 = PtrMetadata(copy _4);
+ _5 = const ();
_6 = copy _1 as *const (&A, [T]) (PtrToPtr);
- _7 = PtrMetadata(copy _6);
+ _7 = PtrMetadata(copy _1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

bb0: {
_4 = copy _1 as *const T (PtrToPtr);
_5 = PtrMetadata(copy _4);
- _5 = PtrMetadata(copy _4);
+ _5 = const ();
_6 = copy _1 as *const (&A, [T]) (PtrToPtr);
- _7 = PtrMetadata(copy _6);
+ _7 = PtrMetadata(copy _1);
Expand Down
2 changes: 1 addition & 1 deletion tests/mir-opt/gvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ fn generic_cast_metadata<T, A: ?Sized, B: ?Sized>(ps: *const [T], pa: *const A,

// Metadata usize -> (), do not optimize.
// CHECK: [[T:_.+]] = copy _1 as
// CHECK-NEXT: PtrMetadata(copy [[T]])
// CHECK-NEXT: const ();
let t1 = CastPtrToPtr::<_, *const T>(ps);
let m1 = PtrMetadata(t1);

Expand Down