From 3ab693689ae878aca6c0c6f188370de973d246e1 Mon Sep 17 00:00:00 2001 From: kirandevraj Date: Fri, 1 Mar 2024 23:33:24 +0530 Subject: [PATCH 1/3] mir-opt unnamed-fields filecheck annotations --- tests/mir-opt/unnamed-fields/field_access.rs | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/mir-opt/unnamed-fields/field_access.rs b/tests/mir-opt/unnamed-fields/field_access.rs index 3d33ca26875ba..8024fd5015d46 100644 --- a/tests/mir-opt/unnamed-fields/field_access.rs +++ b/tests/mir-opt/unnamed-fields/field_access.rs @@ -1,4 +1,5 @@ -// skip-filecheck +//@ unit-test: UnnamedFields + // EMIT_MIR field_access.foo.SimplifyCfg-initial.after.mir // EMIT_MIR field_access.bar.SimplifyCfg-initial.after.mir @@ -36,18 +37,36 @@ union Bar { fn access(_: T) {} +// CHECK-LABEL: fn foo( fn foo(foo: Foo) { + // CHECK _3 = (_1.0: u8); + // CHECK _2 = access::(move _3) -> [return: bb1, unwind: bb5]; access(foo.a); + // CHECK _5 = ((_1.1: Foo::{anon_adt#0}).0: i8); + // CHECK _4 = access::(move _5) -> [return: bb2, unwind: bb5]; access(foo.b); + // CHECK _7 = ((_1.1: Foo::{anon_adt#0}).1: bool); + // CHECK _6 = access::(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::(move _3) -> [return: bb1, unwind: bb5]; access(bar.a); + // CHECK _5 = ((_1.1: Bar::{anon_adt#0}).0: i8); + // CHECK _4 = access::(move _5) -> [return: bb2, unwind: bb5]; access(bar.b); + // CHECK _7 = ((_1.1: Bar::{anon_adt#0}).1: bool); + // CHECK _6 = access::(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); } } From 6f1156a9ff75305b88ce2cb43e21ee04e7a8b556 Mon Sep 17 00:00:00 2001 From: kirandevraj Date: Sun, 10 Mar 2024 01:24:35 +0530 Subject: [PATCH 2/3] fixing mir pass name to text comment --- tests/mir-opt/unnamed-fields/field_access.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/mir-opt/unnamed-fields/field_access.rs b/tests/mir-opt/unnamed-fields/field_access.rs index 8024fd5015d46..70ce7c222ffbc 100644 --- a/tests/mir-opt/unnamed-fields/field_access.rs +++ b/tests/mir-opt/unnamed-fields/field_access.rs @@ -1,4 +1,4 @@ -//@ unit-test: UnnamedFields +// 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 From ba70528fd8cfbc1bf3d0b08c60dd753d6865d8a6 Mon Sep 17 00:00:00 2001 From: kirandevraj Date: Tue, 12 Mar 2024 01:51:52 +0530 Subject: [PATCH 3/3] updating variable names in CHECK --- tests/mir-opt/unnamed-fields/field_access.rs | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/mir-opt/unnamed-fields/field_access.rs b/tests/mir-opt/unnamed-fields/field_access.rs index 70ce7c222ffbc..5badfa1646bc7 100644 --- a/tests/mir-opt/unnamed-fields/field_access.rs +++ b/tests/mir-opt/unnamed-fields/field_access.rs @@ -39,34 +39,34 @@ fn access(_: T) {} // CHECK-LABEL: fn foo( fn foo(foo: Foo) { - // CHECK _3 = (_1.0: u8); - // CHECK _2 = access::(move _3) -> [return: bb1, unwind: bb5]; + // CHECK [[a:_.*]] = (_1.0: u8); + // CHECK _.* = access::(move [[a]]) -> [return: bb1, unwind: bb5]; access(foo.a); - // CHECK _5 = ((_1.1: Foo::{anon_adt#0}).0: i8); - // CHECK _4 = access::(move _5) -> [return: bb2, unwind: bb5]; + // CHECK [[b:_.*]] = ((_1.1: Foo::{anon_adt#0}).0: i8); + // CHECK _.* = access::(move [[b]]) -> [return: bb2, unwind: bb5]; access(foo.b); - // CHECK _7 = ((_1.1: Foo::{anon_adt#0}).1: bool); - // CHECK _6 = access::(move _7) -> [return: bb3, unwind: bb5]; + // CHECK [[c:_.*]] = ((_1.1: Foo::{anon_adt#0}).1: bool); + // CHECK _.* = access::(move [[c]]) -> [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]; + // CHECK [[d:_.*]] = (((_1.2: Foo::{anon_adt#1}).0: Foo::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); + // CHECK _.* = access::<[u8; 1]>(move [[d]]) -> [return: bb4, unwind: bb5]; access(foo.d); } // CHECK-LABEL: fn bar( fn bar(bar: Bar) { unsafe { - // CHECK _3 = (_1.0: u8); - // CHECK _2 = access::(move _3) -> [return: bb1, unwind: bb5]; + // CHECK [[a:_.*]] = (_1.0: u8); + // CHECK _.* = access::(move [[a]]) -> [return: bb1, unwind: bb5]; access(bar.a); - // CHECK _5 = ((_1.1: Bar::{anon_adt#0}).0: i8); - // CHECK _4 = access::(move _5) -> [return: bb2, unwind: bb5]; + // CHECK [[b:_.*]] = ((_1.1: Bar::{anon_adt#0}).0: i8); + // CHECK _.* = access::(move [[b]]) -> [return: bb2, unwind: bb5]; access(bar.b); - // CHECK _7 = ((_1.1: Bar::{anon_adt#0}).1: bool); - // CHECK _6 = access::(move _7) -> [return: bb3, unwind: bb5]; + // CHECK [[c:_.*]] = ((_1.1: Bar::{anon_adt#0}).1: bool); + // CHECK _.* = access::(move [[c]]) -> [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]; + // CHECK [[d:_.*]] = (((_1.2: Bar::{anon_adt#1}).0: Bar::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]); + // CHECK _.* = access::<[u8; 1]>(move [[d]]) -> [return: bb4, unwind: bb5]; access(bar.d); } }