[flang-commits] [PATCH] D116927: [flang] Add tests for converting arrays and refs to arrays. NFC

Diana Picus via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon Jan 10 07:05:33 PST 2022


rovka updated this revision to Diff 398620.
rovka added a comment.

- Cover more code paths (dynamic and fixed-length chars, ref<box>).
- Add a comment that we're switching between column-major and row-major, and also modify the first test in the file to show this (was 10x10, is now 10x12 so we can see the difference).

Thanks for the comments, let me know if I missed any other cases :)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116927/new/

https://reviews.llvm.org/D116927

Files:
  flang/test/Fir/types-to-llvm.fir


Index: flang/test/Fir/types-to-llvm.fir
===================================================================
--- flang/test/Fir/types-to-llvm.fir
+++ flang/test/Fir/types-to-llvm.fir
@@ -4,10 +4,11 @@
 
 
 // Test sequence types `!fir.array`
+// Note that we're switching from column-major to row-major here.
 
-func private @foo0(%arg0: !fir.array<10x10xi64>)
+func private @foo0(%arg0: !fir.array<10x12xi64>)
 // CHECK-LABEL: foo0
-// CHECK-SAME: !llvm.array<10 x array<10 x i64>>
+// CHECK-SAME: !llvm.array<12 x array<10 x i64>>
 func private @foo1(%arg0: !fir.array<?xf32>)
 // CHECK-LABEL: foo1
 // CHECK-SAME: !llvm.ptr<f32>
@@ -17,6 +18,21 @@
 func private @foo3(%arg0: !fir.array<*:i32>)
 // CHECK-LABEL: foo3
 // CHECK-SAME: !llvm.ptr<i32>
+func private @foo4(%arg0: !fir.array<3x?xi32>)
+// CHECK-LABEL: foo4
+// CHECK-SAME: !llvm.ptr<array<3 x i32>>
+func private @foo5(%arg0: !fir.array<?x6xi32>)
+// CHECK-LABEL: foo5
+// CHECK-SAME: !llvm.ptr<i32>
+func private @foo6(%arg0: !fir.array<2x?x3x?x4xi32>)
+// CHECK-LABEL: foo6
+// CHECK-SAME: !llvm.ptr<array<2 x i32>
+func private @foo7(%arg0: !fir.array<6x?x!fir.char<1,?>>)
+// CHECK-LABEL: foo7
+// CHECK-SAME: !llvm.ptr<i8>
+func private @foo8(%arg0: !fir.array<6x?x!fir.char<1,3>>)
+// CHECK-LABEL: foo8
+// CHECK-SAME: !llvm.ptr<array<6 x array<3 x i8>
 
 // -----
 
@@ -31,6 +47,21 @@
 func private @foo2(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.type<_QMs1Ta1{x:i32,y:f32}>>>>)
 // CHECK-LABEL: foo2
 // CHECK-SAME: !llvm.ptr<struct<(ptr<struct<"_QMs1Ta1", (i32, f32)>>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, ptr<i{{.*}}>, array<1 x i{{.*}}>)>>
+func private @foo3(%arg0: !fir.ref<!fir.array<10x?x11xf32>>)
+// CHECK-LABEL: foo3
+// CHECK-SAME: !llvm.ptr<f32>
+func private @foo4(%arg0: !fir.ref<!fir.array<10x11x?x?xf32>>)
+// CHECK-LABEL: foo4
+// CHECK-SAME: !llvm.ptr<array<11 x array<10 x f32>>>
+func private @foo5(%arg0: !fir.ref<!fir.array<10x!fir.char<1,?>>>)
+// CHECK-LABEL: foo5
+// CHECK-SAME: !llvm.ptr<i8>
+func private @foo6(%arg0: !fir.ref<!fir.array<10x!fir.char<2,8>>>)
+// CHECK-LABEL: foo6
+// CHECK-SAME: !llvm.ptr<array<10 x array<8 x i16>
+func private @foo7(%arg0: !fir.ref<!fir.box<!fir.array<?xf32>>>)
+// CHECK-LABEL: foo7
+// CHECK-SAME: !llvm.ptr<struct<(ptr<f32>, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<1 x array<3 x i{{.*}}>>)>>
 
 // -----
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116927.398620.patch
Type: text/x-patch
Size: 2380 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220110/f0324725/attachment.bin>


More information about the flang-commits mailing list