Repurpose defunct test.

This commit is contained in:
Camille Gillot 2025-09-26 21:06:22 +00:00
parent 5407eb8ca2
commit 96c3978eaa
4 changed files with 48 additions and 64 deletions

View file

@ -0,0 +1,42 @@
- // MIR for `main` before GVN
+ // MIR for `main` after GVN
fn main() -> () {
let mut _0: ();
let _1: main::Un;
let mut _2: u32;
let _3: ();
let mut _4: u32;
scope 1 {
debug un => _1;
scope 3 (inlined std::mem::drop::<u32>) {
}
}
scope 2 (inlined val) {
}
bb0: {
StorageLive(_1);
- StorageLive(_2);
+ nop;
_2 = const 1_u32;
- _1 = Un { us: move _2 };
- StorageDead(_2);
+ _1 = const Un {{ us: 1_u32 }};
+ nop;
StorageLive(_3);
StorageLive(_4);
- _4 = copy (_1.0: u32);
+ _4 = const 1_u32;
StorageDead(_4);
StorageDead(_3);
_0 = const ();
StorageDead(_1);
return;
}
+ }
+
+ ALLOC0 (size: 4, align: 4) {
+ 01 00 00 00 │ ....
}

View file

@ -1,17 +1,17 @@
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we can propagate into places that are projections into unions
//@ compile-flags: -Zunsound-mir-opts -C debuginfo=full
//@ test-mir-pass: GVN
//@ compile-flags: -Zinline-mir
fn val() -> u32 {
1
}
// EMIT_MIR union.main.DestinationPropagation.diff
// EMIT_MIR union.main.GVN.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: debug un => const Un
// CHECK: debug _x => const 1_u32;
// CHECK: debug un => [[un:_.*]];
// CHECK: bb0: {
// CHECK-NEXT: return;
// CHECK: [[un]] = const Un {{{{ us: 1_u32 }}}};
union Un {
us: u32,
}

View file

@ -1,29 +0,0 @@
- // MIR for `main` before DestinationPropagation
+ // MIR for `main` after DestinationPropagation
fn main() -> () {
let mut _0: ();
let _1: main::Un;
let mut _2: u32;
scope 1 {
debug un => const Un {{ us: 1_u32 }};
scope 3 (inlined std::mem::drop::<u32>) {
debug _x => const 1_u32;
}
}
scope 2 (inlined val) {
}
bb0: {
StorageLive(_1);
StorageLive(_2);
StorageDead(_2);
StorageDead(_1);
return;
}
}
ALLOC0 (size: 4, align: 4) {
01 00 00 00 │ ....
}

View file

@ -1,29 +0,0 @@
- // MIR for `main` before DestinationPropagation
+ // MIR for `main` after DestinationPropagation
fn main() -> () {
let mut _0: ();
let _1: main::Un;
let mut _2: u32;
scope 1 {
debug un => const Un {{ us: 1_u32 }};
scope 3 (inlined std::mem::drop::<u32>) {
debug _x => const 1_u32;
}
}
scope 2 (inlined val) {
}
bb0: {
StorageLive(_1);
StorageLive(_2);
StorageDead(_2);
StorageDead(_1);
return;
}
}
ALLOC0 (size: 4, align: 4) {
01 00 00 00 │ ....
}