Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FileCheck annotations to MIR-opt unnamed-fields tests #121865

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Changes from 2 commits
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
21 changes: 20 additions & 1 deletion tests/mir-opt/unnamed-fields/field_access.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// skip-filecheck
// Tests the correct handling of unnamed fields within structs and unions marked with #[repr(C)].

// EMIT_MIR field_access.foo.SimplifyCfg-initial.after.mir
// EMIT_MIR field_access.bar.SimplifyCfg-initial.after.mir

Expand Down Expand Up @@ -36,18 +37,36 @@ union Bar {

fn access<T>(_: T) {}

// CHECK-LABEL: fn foo(
fn foo(foo: Foo) {
// CHECK _3 = (_1.0: u8);
// CHECK _2 = access::<u8>(move _3) -> [return: bb1, unwind: bb5];
access(foo.a);
oli-obk marked this conversation as resolved.
Show resolved Hide resolved
// CHECK _5 = ((_1.1: Foo::{anon_adt#0}).0: i8);
// CHECK _4 = access::<i8>(move _5) -> [return: bb2, unwind: bb5];
access(foo.b);
// CHECK _7 = ((_1.1: Foo::{anon_adt#0}).1: bool);
// CHECK _6 = access::<bool>(move _7) -> [return: bb3, unwind: bb5];
access(foo.c);
// CHECK _9 = (((_1.2: Foo::{anon_adt#1}).0: Foo::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]);
// CHECK _8 = access::<[u8; 1]>(move _9) -> [return: bb4, unwind: bb5];
access(foo.d);
}

// CHECK-LABEL: fn bar(
fn bar(bar: Bar) {
unsafe {
// CHECK _3 = (_1.0: u8);
// CHECK _2 = access::<u8>(move _3) -> [return: bb1, unwind: bb5];
access(bar.a);
// CHECK _5 = ((_1.1: Bar::{anon_adt#0}).0: i8);
// CHECK _4 = access::<i8>(move _5) -> [return: bb2, unwind: bb5];
access(bar.b);
// CHECK _7 = ((_1.1: Bar::{anon_adt#0}).1: bool);
// CHECK _6 = access::<bool>(move _7) -> [return: bb3, unwind: bb5];
access(bar.c);
// CHECK _9 = (((_1.2: Bar::{anon_adt#1}).0: Bar::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]);
// CHECK _8 = access::<[u8; 1]>(move _9) -> [return: bb4, unwind: bb5];
access(bar.d);
}
}
Expand Down
Loading