[flang-commits] [flang] 29abf2a - [fir] Add test for FIR types conversion

Valentin Clement via flang-commits flang-commits at lists.llvm.org
Mon Nov 8 00:41:44 PST 2021


Author: Valentin Clement
Date: 2021-11-08T09:41:39+01:00
New Revision: 29abf2a4a488629888411f9e1abdc3b47b8f84f0

URL: https://github.com/llvm/llvm-project/commit/29abf2a4a488629888411f9e1abdc3b47b8f84f0
DIFF: https://github.com/llvm/llvm-project/commit/29abf2a4a488629888411f9e1abdc3b47b8f84f0.diff

LOG: [fir] Add test for FIR types conversion

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

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

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/flang/test/Fir/types-to-llvm.fir b/flang/test/Fir/types-to-llvm.fir
new file mode 100644
index 0000000000000..5817b2cce90b0
--- /dev/null
+++ b/flang/test/Fir/types-to-llvm.fir
@@ -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>>
+


        


More information about the flang-commits mailing list