Skip to content

Commit be41333

Browse files
committed
Store a full Ty with each Value.
1 parent ac70dc8 commit be41333

File tree

7 files changed

+122
-136
lines changed

7 files changed

+122
-136
lines changed

compiler/rustc_mir_transform/src/gvn.rs

Lines changed: 114 additions & 130 deletions
Large diffs are not rendered by default.

tests/mir-opt/const_prop/transmute.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub unsafe fn undef_union_as_integer() -> u32 {
5656
pub unsafe fn unreachable_direct() -> ! {
5757
// CHECK-LABEL: fn unreachable_direct(
5858
// CHECK: = const ();
59-
// CHECK: = const () as Never (Transmute);
59+
// CHECK: = const ZeroSized: Never;
6060
let x: Never = unsafe { transmute(()) };
6161
match x {}
6262
}

tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.32bit.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- _2 = ();
1616
- _1 = move _2 as Never (Transmute);
1717
+ _2 = const ();
18-
+ _1 = const () as Never (Transmute);
18+
+ _1 = const ZeroSized: Never;
1919
unreachable;
2020
}
2121
}

tests/mir-opt/const_prop/transmute.unreachable_direct.GVN.64bit.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
- _2 = ();
1616
- _1 = move _2 as Never (Transmute);
1717
+ _2 = const ();
18-
+ _1 = const () as Never (Transmute);
18+
+ _1 = const ZeroSized: Never;
1919
unreachable;
2020
}
2121
}

tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-abort.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
bb0: {
2020
_4 = copy _1 as *const T (PtrToPtr);
21-
_5 = PtrMetadata(copy _4);
21+
- _5 = PtrMetadata(copy _4);
22+
+ _5 = const ();
2223
_6 = copy _1 as *const (&A, [T]) (PtrToPtr);
2324
- _7 = PtrMetadata(copy _6);
2425
+ _7 = PtrMetadata(copy _1);

tests/mir-opt/gvn.generic_cast_metadata.GVN.panic-unwind.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919
bb0: {
2020
_4 = copy _1 as *const T (PtrToPtr);
21-
_5 = PtrMetadata(copy _4);
21+
- _5 = PtrMetadata(copy _4);
22+
+ _5 = const ();
2223
_6 = copy _1 as *const (&A, [T]) (PtrToPtr);
2324
- _7 = PtrMetadata(copy _6);
2425
+ _7 = PtrMetadata(copy _1);

tests/mir-opt/gvn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ fn generic_cast_metadata<T, A: ?Sized, B: ?Sized>(ps: *const [T], pa: *const A,
869869

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

0 commit comments

Comments
 (0)