[fir] Add test for FIR types conversion
authorValentin Clement <clementval@gmail.com>
Mon, 8 Nov 2021 08:41:19 +0000 (09:41 +0100)
committerValentin Clement <clementval@gmail.com>
Mon, 8 Nov 2021 08:41:39 +0000 (09:41 +0100)
Add a separate file to test FIR types conversion to LLVM types.
Conversion comes from `flang/lib/Optimizer/CodeGen/TypeConverter.h`

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan, awarzynski

Differential Revision: https://reviews.llvm.org/D113283

flang/test/Fir/types-to-llvm.fir [new file with mode: 0644]

diff --git a/flang/test/Fir/types-to-llvm.fir b/flang/test/Fir/types-to-llvm.fir
new file mode 100644 (file)
index 0000000..5817b2c
--- /dev/null
@@ -0,0 +1,31 @@
+// Test FIR types conversion.
+
+// RUN: fir-opt --split-input-file --fir-to-llvm-ir %s | FileCheck %s
+
+
+// Test sequence types `!fir.array`
+
+func private @foo0(%arg0: !fir.array<10x10xi64>)
+// CHECK-LABEL: foo0 
+// CHECK-SAME: !llvm.array<10 x array<10 x i64>>
+func private @foo1(%arg0: !fir.array<?xf32>)
+// CHECK-LABEL: foo1
+// CHECK-SAME: !llvm.ptr<f32>
+func private @foo2(%arg0: !fir.array<?x?xf128>)
+// CHECK-LABEL: foo2 
+// CHECK-SAME: !llvm.ptr<f128>
+func private @foo3(%arg0: !fir.array<*:i32>)
+// CHECK-LABEL: foo3
+// CHECK-SAME: !llvm.ptr<i32>
+
+// -----
+
+// Test reference types `!fir.ref`
+
+func private @foo0(%arg0: !fir.ref<i32>)
+// CHECK-LABEL: foo0
+// CHECK-SAME: !llvm.ptr<i32>
+func private @foo1(%arg0: !fir.ref<!fir.array<10xf32>>)
+// CHECK-LABEL: foo1
+// CHECK-SAME: !llvm.ptr<array<10 x f32>>
+