[PATCH] D113658: [fir] Add !fir.len type conversion

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 02:27:52 PST 2021


clementval updated this revision to Diff 386461.
clementval added a comment.

Rebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113658

Files:
  flang/lib/Optimizer/CodeGen/TypeConverter.h
  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
@@ -203,3 +203,11 @@
 func private @foo16(%arg0: !fir.vector<2:!fir.real<16>>)
 // CHECK-LABEL: foo16
 // CHECK-SAME: vector<2xf128>
+
+// -----
+
+// Test `!fir.len` conversion.
+
+func private @foo0(%arg0: !fir.len)
+// CHECK-LABEL: foo0
+// CHECK-SAME: i32
Index: flang/lib/Optimizer/CodeGen/TypeConverter.h
===================================================================
--- flang/lib/Optimizer/CodeGen/TypeConverter.h
+++ flang/lib/Optimizer/CodeGen/TypeConverter.h
@@ -60,6 +60,9 @@
         [&](fir::PointerType pointer) { return convertPointerLike(pointer); });
     addConversion(
         [&](fir::RecordType derived) { return convertRecordType(derived); });
+    addConversion([&](fir::LenType field) {
+      return mlir::IntegerType::get(field.getContext(), 32);
+    });
     addConversion(
         [&](fir::ComplexType cmplx) { return convertComplexType(cmplx); });
     addConversion(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113658.386461.patch
Type: text/x-patch
Size: 1088 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211111/2990e48e/attachment.bin>


More information about the llvm-commits mailing list