Reflection: typeref_lowering test case on Linuxone


(Raminder Sodhi) #1

Hi,

I am trying to fix the typeref_lowering tet on the LinuxONE platform (s390x).

Due to differernce in value of SWIFT_ABI_DEFAULT_OBJC_RESERVED_BITS_MASK the num_extra_inhabitants is different for some structures.

I just wanted a opinion on the best way to fix this issue as the one which I have looks a bit messy to me.

Note: I have modified the FileCheck params to have arch based matching.

Below is a diff which passes on both the x86_64 and s390x platform.

diff --git a/test/Reflection/typeref_lowering.swift b/test/Reflection/typeref_lowering.swift
index c2d721c…15f971c 100644
— a/test/Reflection/typeref_lowering.swift
+++ b/test/Reflection/typeref_lowering.swift
@@ -1,6 +1,6 @@
// RUN: rm -rf %t && mkdir -p %t
// RUN: %target-build-swift %S/Inputs/TypeLowering.swift -parse-as-library -emit-module -emit-library -module-name TypeLowering -o %t/libTypesToReflect.%target-dylib-extension
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension -binary-filename %platform-module-dir/libswiftCore.%target-dylib-extension -dump-type-lowering < %s | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension -binary-filename %platform-module-dir/libswiftCore.%target-dylib-extension -dump-type-lowering < %s | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-cpu

V12TypeLowering11BasicStruct
// CHECK-64: (struct TypeLowering.BasicStruct)
@@ -170,34 +170,63 @@ TGV12TypeLowering3BoxVs5Int16_Vs5Int32_

V12TypeLowering15ReferenceStruct
-// CHECK-64: (struct TypeLowering.ReferenceStruct)
-// CHECK-64-NEXT: (struct size=72 alignment=8 stride=72 num_extra_inhabitants=[[PTR_XI:2048|2147483647]]
-// CHECK-64-NEXT: (field name=strongRef offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=optionalStrongRef offset=8
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1:2047|2147483646]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=strongRefTuple offset=16
-// CHECK-64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
-// CHECK-64-NEXT: (field offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field offset=8
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=optionalStrongRefTuple offset=32
-// CHECK-64-NEXT: (single_payload_enum size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI_SUB_1]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
-// CHECK-64-NEXT: (field offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field offset=8
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))))
-// CHECK-64-NEXT: (field name=unownedRef offset=48
-// CHECK-64-NEXT: (reference kind=unowned refcounting=native))
-// CHECK-64-NEXT: (field name=weakRef offset=56
-// CHECK-64-NEXT: (reference kind=weak refcounting=native))
-// CHECK-64-NEXT: (field name=unmanagedRef offset=64
-// CHECK-64-NEXT: (reference kind=unmanaged refcounting=native)))
+// CHECK-x86_64: (struct TypeLowering.ReferenceStruct)
+// CHECK-x86_64-NEXT: (struct size=72 alignment=8 stride=72 num_extra_inhabitants=[[PTR_XI:2048|2147483647]]
+// CHECK-x86_64-NEXT: (field name=strongRef offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=optionalStrongRef offset=8
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1:2047|2147483646]]
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=strongRefTuple offset=16
+// CHECK-x86_64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-x86_64-NEXT: (field offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field offset=8
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=optionalStrongRefTuple offset=32
+// CHECK-x86_64-NEXT: (single_payload_enum size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI_SUB_1]]

+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-x86_64-NEXT: (field offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field offset=8
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-x86_64-NEXT: (field name=unownedRef offset=48
+// CHECK-x86_64-NEXT: (reference kind=unowned refcounting=native))
+// CHECK-x86_64-NEXT: (field name=weakRef offset=56
+// CHECK-x86_64-NEXT: (reference kind=weak refcounting=native))
+// CHECK-x86_64-NEXT: (field name=unmanagedRef offset=64
+// CHECK-x86_64-NEXT: (reference kind=unmanaged refcounting=native)))

···

+// CHECK-s390x: (struct TypeLowering.ReferenceStruct)
+// CHECK-s390x-NEXT: (struct size=72 alignment=8 stride=72 num_extra_inhabitants=[[PTR_XI:4096|2147483647]]
+// CHECK-s390x-NEXT: (field name=strongRef offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=optionalStrongRef offset=8
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1:4095|2147483646]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=strongRefTuple offset=16
+// CHECK-s390x-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-s390x-NEXT: (field offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field offset=8
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=optionalStrongRefTuple offset=32
+// CHECK-s390x-NEXT: (single_payload_enum size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-s390x-NEXT: (field offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field offset=8
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-s390x-NEXT: (field name=unownedRef offset=48
+// CHECK-s390x-NEXT: (reference kind=unowned refcounting=native))
+// CHECK-s390x-NEXT: (field name=weakRef offset=56
+// CHECK-s390x-NEXT: (reference kind=weak refcounting=native))
+// CHECK-s390x-NEXT: (field name=unmanagedRef offset=64
+// CHECK-s390x-NEXT: (reference kind=unmanaged refcounting=native)))

// CHECK-32: (struct TypeLowering.ReferenceStruct)
// CHECK-32-NEXT: (struct size=36 alignment=4 stride=36 num_extra_inhabitants=4096
@@ -686,57 +715,107 @@ V12TypeLowering14MetatypeStruct
// CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=4096)))))

V12TypeLowering10EnumStruct
-// CHECK-64: (struct TypeLowering.EnumStruct)
-// CHECK-64-NEXT: (struct size=81 alignment=8 stride=88 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=empty offset=0
-// CHECK-64-NEXT: (no_payload_enum size=0 alignment=0 stride=0 num_extra_inhabitants=0))
-// CHECK-64-NEXT: (field name=noPayload offset=0
-// CHECK-64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
-// CHECK-64-NEXT: (field name=sillyNoPayload offset=0
-// CHECK-64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
-// CHECK-64-NEXT: (field name=singleton offset=8
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=singlePayload offset=16
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
-// CHECK-64-NEXT: (field name=Indirect offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=multiPayloadConcrete offset=24
-// CHECK-64-NEXT: (multi_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=Left offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=Right offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=multiPayloadGenericFixed offset=32
-// CHECK-64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=Left offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=Right offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=multiPayloadGenericDynamic offset=48
-// CHECK-64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=Left offset=0
-// CHECK-64-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=_value offset=0
-// CHECK-64-NEXT: (builtin size=1 alignment=1 stride=1 num_extra_inhabitants=0))))
-// CHECK-64-NEXT: (field name=Right offset=0
-// CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=_value offset=0
-// CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))))
-// CHECK-64-NEXT: (field name=optionalOptionalRef offset=64
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_2:2147483645|2046]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))))
-// CHECK-64-NEXT: (field name=optionalOptionalPtr offset=72
-// CHECK-64-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=1
-// CHECK-64-NEXT: (field name=_rawValue offset=0
-// CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1)))))))))
+// CHECK-x86_64: (struct TypeLowering.EnumStruct)
+// CHECK-x86_64-NEXT: (struct size=81 alignment=8 stride=88 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=empty offset=0
+// CHECK-x86_64-NEXT: (no_payload_enum size=0 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-x86_64-NEXT: (field name=noPayload offset=0
+// CHECK-x86_64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-x86_64-NEXT: (field name=sillyNoPayload offset=0
+// CHECK-x86_64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-x86_64-NEXT: (field name=singleton offset=8
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=singlePayload offset=16
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-x86_64-NEXT: (field name=Indirect offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=multiPayloadConcrete offset=24
+// CHECK-x86_64-NEXT: (multi_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=Left offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=Right offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=multiPayloadGenericFixed offset=32
+// CHECK-x86_64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=Left offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=Right offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=multiPayloadGenericDynamic offset=48
+// CHECK-x86_64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=Left offset=0
+// CHECK-x86_64-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=_value offset=0
+// CHECK-x86_64-NEXT: (builtin size=1 alignment=1 stride=1 num_extra_inhabitants=0))))
+// CHECK-x86_64-NEXT: (field name=Right offset=0
+// CHECK-x86_64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=_value offset=0
+// CHECK-x86_64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))))
+// CHECK-x86_64-NEXT: (field name=optionalOptionalRef offset=64
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_2:2147483645|2046]]
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-x86_64-NEXT: (field name=optionalOptionalPtr offset=72
+// CHECK-x86_64-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=1
+// CHECK-x86_64-NEXT: (field name=_rawValue offset=0
+// CHECK-x86_64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1)))))))))

+// CHECK-s390x: (struct TypeLowering.EnumStruct)
+// CHECK-s390x-NEXT: (struct size=81 alignment=8 stride=88 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=empty offset=0
+// CHECK-s390x-NEXT: (no_payload_enum size=0 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-s390x-NEXT: (field name=noPayload offset=0
+// CHECK-s390x-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-s390x-NEXT: (field name=sillyNoPayload offset=0
+// CHECK-s390x-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-s390x-NEXT: (field name=singleton offset=8
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=singlePayload offset=16
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-s390x-NEXT: (field name=Indirect offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=multiPayloadConcrete offset=24
+// CHECK-s390x-NEXT: (multi_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=Left offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=Right offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=multiPayloadGenericFixed offset=32
+// CHECK-s390x-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=Left offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=Right offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=multiPayloadGenericDynamic offset=48
+// CHECK-s390x-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=Left offset=0
+// CHECK-s390x-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=_value offset=0
+// CHECK-s390x-NEXT: (builtin size=1 alignment=1 stride=1 num_extra_inhabitants=0))))
+// CHECK-s390x-NEXT: (field name=Right offset=0
+// CHECK-s390x-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=_value offset=0
+// CHECK-s390x-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))))
+// CHECK-s390x-NEXT: (field name=optionalOptionalRef offset=64
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_2_SUB_2:2147483645|4094]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-s390x-NEXT: (field name=optionalOptionalPtr offset=72
+// CHECK-s390x-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=1
+// CHECK-s390x-NEXT: (field name=_rawValue offset=0
+// CHECK-s390x-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1)))))))))

Thanks

Raminder Sodhi


(Slava Pestov) #2

You’ll notice the existing CHECK-64’s already have stuff like

// CHECK-64-NEXT: (struct size=72 alignment=8 stride=72 num_extra_inhabitants=[[PTR_XI:2048|2147483647]]

To deal with Linux vs Darwin. You could just fold all the different possible values into the alternation there, instead of having CHECK lines for each architecture/OS combination.

However if you think it’s more readable or more robust to separate the tests into OS/CPU combinations, that’s fine by me. Don’t worry too much about verbosity, it is easy to update the tests when things change with regular expressions :slight_smile:

If you wanted to clean this up further, you could take a look at some of the other tests in test/Reflection/* which have CPU: x86_64 requirements. Those can probably be relaxed.

Thanks for digging into this!

Slava

···

On Aug 25, 2016, at 8:10 AM, Raminder Sodhi via swift-dev <swift-dev@swift.org> wrote:

Hi,

I am trying to fix the typeref_lowering tet on the LinuxONE platform (s390x).
Due to differernce in value of SWIFT_ABI_DEFAULT_OBJC_RESERVED_BITS_MASK the num_extra_inhabitants is different for some structures.
I just wanted a opinion on the best way to fix this issue as the one which I have looks a bit messy to me.
Note: I have modified the FileCheck params to have arch based matching.

Below is a diff which passes on both the x86_64 and s390x platform.
diff --git a/test/Reflection/typeref_lowering.swift b/test/Reflection/typeref_lowering.swift
index c2d721c..15f971c 100644
--- a/test/Reflection/typeref_lowering.swift
+++ b/test/Reflection/typeref_lowering.swift
@@ -1,6 +1,6 @@
// RUN: rm -rf %t && mkdir -p %t
// RUN: %target-build-swift %S/Inputs/TypeLowering.swift -parse-as-library -emit-module -emit-library -module-name TypeLowering -o %t/libTypesToReflect.%target-dylib-extension
-// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension -binary-filename %platform-module-dir/libswiftCore.%target-dylib-extension -dump-type-lowering < %s | %FileCheck %s --check-prefix=CHECK-%target-ptrsize
+// RUN: %target-swift-reflection-dump -binary-filename %t/libTypesToReflect.%target-dylib-extension -binary-filename %platform-module-dir/libswiftCore.%target-dylib-extension -dump-type-lowering < %s | %FileCheck %s --check-prefix=CHECK-%target-ptrsize --check-prefix=CHECK-%target-cpu
V12TypeLowering11BasicStruct
// CHECK-64: (struct TypeLowering.BasicStruct)
@@ -170,34 +170,63 @@ TGV12TypeLowering3BoxVs5Int16_Vs5Int32_

V12TypeLowering15ReferenceStruct
-// CHECK-64: (struct TypeLowering.ReferenceStruct)
-// CHECK-64-NEXT: (struct size=72 alignment=8 stride=72 num_extra_inhabitants=[[PTR_XI:2048|2147483647]]
-// CHECK-64-NEXT: (field name=strongRef offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=optionalStrongRef offset=8
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1:2047|2147483646]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=strongRefTuple offset=16
-// CHECK-64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
-// CHECK-64-NEXT: (field offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field offset=8
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=optionalStrongRefTuple offset=32
-// CHECK-64-NEXT: (single_payload_enum size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI_SUB_1]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
-// CHECK-64-NEXT: (field offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field offset=8
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))))
-// CHECK-64-NEXT: (field name=unownedRef offset=48
-// CHECK-64-NEXT: (reference kind=unowned refcounting=native))
-// CHECK-64-NEXT: (field name=weakRef offset=56
-// CHECK-64-NEXT: (reference kind=weak refcounting=native))
-// CHECK-64-NEXT: (field name=unmanagedRef offset=64
-// CHECK-64-NEXT: (reference kind=unmanaged refcounting=native)))
+// CHECK-x86_64: (struct TypeLowering.ReferenceStruct)
+// CHECK-x86_64-NEXT: (struct size=72 alignment=8 stride=72 num_extra_inhabitants=[[PTR_XI:2048|2147483647]]
+// CHECK-x86_64-NEXT: (field name=strongRef offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=optionalStrongRef offset=8
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1:2047|2147483646]]
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=strongRefTuple offset=16
+// CHECK-x86_64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-x86_64-NEXT: (field offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field offset=8
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=optionalStrongRefTuple offset=32
+// CHECK-x86_64-NEXT: (single_payload_enum size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-x86_64-NEXT: (field offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field offset=8
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-x86_64-NEXT: (field name=unownedRef offset=48
+// CHECK-x86_64-NEXT: (reference kind=unowned refcounting=native))
+// CHECK-x86_64-NEXT: (field name=weakRef offset=56
+// CHECK-x86_64-NEXT: (reference kind=weak refcounting=native))
+// CHECK-x86_64-NEXT: (field name=unmanagedRef offset=64
+// CHECK-x86_64-NEXT: (reference kind=unmanaged refcounting=native)))
+
+// CHECK-s390x: (struct TypeLowering.ReferenceStruct)
+// CHECK-s390x-NEXT: (struct size=72 alignment=8 stride=72 num_extra_inhabitants=[[PTR_XI:4096|2147483647]]
+// CHECK-s390x-NEXT: (field name=strongRef offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=optionalStrongRef offset=8
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1:4095|2147483646]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=strongRefTuple offset=16
+// CHECK-s390x-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-s390x-NEXT: (field offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field offset=8
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=optionalStrongRefTuple offset=32
+// CHECK-s390x-NEXT: (single_payload_enum size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (tuple size=16 alignment=8 stride=16 num_extra_inhabitants=[[PTR_XI]]
+// CHECK-s390x-NEXT: (field offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field offset=8
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-s390x-NEXT: (field name=unownedRef offset=48
+// CHECK-s390x-NEXT: (reference kind=unowned refcounting=native))
+// CHECK-s390x-NEXT: (field name=weakRef offset=56
+// CHECK-s390x-NEXT: (reference kind=weak refcounting=native))
+// CHECK-s390x-NEXT: (field name=unmanagedRef offset=64
+// CHECK-s390x-NEXT: (reference kind=unmanaged refcounting=native)))
// CHECK-32: (struct TypeLowering.ReferenceStruct)
// CHECK-32-NEXT: (struct size=36 alignment=4 stride=36 num_extra_inhabitants=4096
@@ -686,57 +715,107 @@ V12TypeLowering14MetatypeStruct
// CHECK-32-NEXT: (builtin size=4 alignment=4 stride=4 num_extra_inhabitants=4096)))))
V12TypeLowering10EnumStruct
-// CHECK-64: (struct TypeLowering.EnumStruct)
-// CHECK-64-NEXT: (struct size=81 alignment=8 stride=88 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=empty offset=0
-// CHECK-64-NEXT: (no_payload_enum size=0 alignment=0 stride=0 num_extra_inhabitants=0))
-// CHECK-64-NEXT: (field name=noPayload offset=0
-// CHECK-64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
-// CHECK-64-NEXT: (field name=sillyNoPayload offset=0
-// CHECK-64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
-// CHECK-64-NEXT: (field name=singleton offset=8
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=singlePayload offset=16
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
-// CHECK-64-NEXT: (field name=Indirect offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=multiPayloadConcrete offset=24
-// CHECK-64-NEXT: (multi_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=Left offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=Right offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=multiPayloadGenericFixed offset=32
-// CHECK-64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=Left offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))
-// CHECK-64-NEXT: (field name=Right offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))
-// CHECK-64-NEXT: (field name=multiPayloadGenericDynamic offset=48
-// CHECK-64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=Left offset=0
-// CHECK-64-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=_value offset=0
-// CHECK-64-NEXT: (builtin size=1 alignment=1 stride=1 num_extra_inhabitants=0))))
-// CHECK-64-NEXT: (field name=Right offset=0
-// CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=_value offset=0
-// CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))))
-// CHECK-64-NEXT: (field name=optionalOptionalRef offset=64
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_2:2147483645|2046]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (reference kind=strong refcounting=native))))))
-// CHECK-64-NEXT: (field name=optionalOptionalPtr offset=72
-// CHECK-64-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
-// CHECK-64-NEXT: (field name=some offset=0
-// CHECK-64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=1
-// CHECK-64-NEXT: (field name=_rawValue offset=0
-// CHECK-64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1)))))))))
+// CHECK-x86_64: (struct TypeLowering.EnumStruct)
+// CHECK-x86_64-NEXT: (struct size=81 alignment=8 stride=88 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=empty offset=0
+// CHECK-x86_64-NEXT: (no_payload_enum size=0 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-x86_64-NEXT: (field name=noPayload offset=0
+// CHECK-x86_64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-x86_64-NEXT: (field name=sillyNoPayload offset=0
+// CHECK-x86_64-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-x86_64-NEXT: (field name=singleton offset=8
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=singlePayload offset=16
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-x86_64-NEXT: (field name=Indirect offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=multiPayloadConcrete offset=24
+// CHECK-x86_64-NEXT: (multi_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=Left offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=Right offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=multiPayloadGenericFixed offset=32
+// CHECK-x86_64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=Left offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))
+// CHECK-x86_64-NEXT: (field name=Right offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-x86_64-NEXT: (field name=multiPayloadGenericDynamic offset=48
+// CHECK-x86_64-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=Left offset=0
+// CHECK-x86_64-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=_value offset=0
+// CHECK-x86_64-NEXT: (builtin size=1 alignment=1 stride=1 num_extra_inhabitants=0))))
+// CHECK-x86_64-NEXT: (field name=Right offset=0
+// CHECK-x86_64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=_value offset=0
+// CHECK-x86_64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))))
+// CHECK-x86_64-NEXT: (field name=optionalOptionalRef offset=64
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_2:2147483645|2046]]
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-x86_64-NEXT: (field name=optionalOptionalPtr offset=72
+// CHECK-x86_64-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-x86_64-NEXT: (field name=some offset=0
+// CHECK-x86_64-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=1
+// CHECK-x86_64-NEXT: (field name=_rawValue offset=0
+// CHECK-x86_64-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1)))))))))
+// CHECK-s390x: (struct TypeLowering.EnumStruct)
+// CHECK-s390x-NEXT: (struct size=81 alignment=8 stride=88 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=empty offset=0
+// CHECK-s390x-NEXT: (no_payload_enum size=0 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-s390x-NEXT: (field name=noPayload offset=0
+// CHECK-s390x-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-s390x-NEXT: (field name=sillyNoPayload offset=0
+// CHECK-s390x-NEXT: (no_payload_enum size=1 alignment=0 stride=0 num_extra_inhabitants=0))
+// CHECK-s390x-NEXT: (field name=singleton offset=8
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=singlePayload offset=16
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-s390x-NEXT: (field name=Indirect offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=multiPayloadConcrete offset=24
+// CHECK-s390x-NEXT: (multi_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=Left offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=Right offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=multiPayloadGenericFixed offset=32
+// CHECK-s390x-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=Left offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))
+// CHECK-s390x-NEXT: (field name=Right offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))
+// CHECK-s390x-NEXT: (field name=multiPayloadGenericDynamic offset=48
+// CHECK-s390x-NEXT: (multi_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=Left offset=0
+// CHECK-s390x-NEXT: (struct size=1 alignment=1 stride=1 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=_value offset=0
+// CHECK-s390x-NEXT: (builtin size=1 alignment=1 stride=1 num_extra_inhabitants=0))))
+// CHECK-s390x-NEXT: (field name=Right offset=0
+// CHECK-s390x-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=_value offset=0
+// CHECK-s390x-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=0))))))
+// CHECK-s390x-NEXT: (field name=optionalOptionalRef offset=64
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_2_SUB_2:2147483645|4094]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=[[PTR_XI_SUB_1]]
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (reference kind=strong refcounting=native))))))
+// CHECK-s390x-NEXT: (field name=optionalOptionalPtr offset=72
+// CHECK-s390x-NEXT: (single_payload_enum size=9 alignment=8 stride=16 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (single_payload_enum size=8 alignment=8 stride=8 num_extra_inhabitants=0
+// CHECK-s390x-NEXT: (field name=some offset=0
+// CHECK-s390x-NEXT: (struct size=8 alignment=8 stride=8 num_extra_inhabitants=1
+// CHECK-s390x-NEXT: (field name=_rawValue offset=0
+// CHECK-s390x-NEXT: (builtin size=8 alignment=8 stride=8 num_extra_inhabitants=1)))))))))

Thanks
Raminder Sodhi

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev