[PATCH] D113658: [fir] Add !fir.len type conversion
Valentin Clement via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 15 01:18:34 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6c8eecd6769d: [fir] Add !fir.len type conversion (authored by clementval).
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
@@ -293,3 +293,11 @@
func private @foo0(%arg0: !fir.field)
// CHECK-LABEL: foo0
// CHECK-SAME: i32
+
+// -----
+
+// Test `!fir.len` conversion.
+
+func private @foo0(%arg0: !fir.len)
+// CHECK-LABEL: foo0
+// CHECK-SAME: i64
Index: flang/lib/Optimizer/CodeGen/TypeConverter.h
===================================================================
--- flang/lib/Optimizer/CodeGen/TypeConverter.h
+++ flang/lib/Optimizer/CodeGen/TypeConverter.h
@@ -73,6 +73,11 @@
// Convert to i32 because of LLVM GEP indexing restriction.
return mlir::IntegerType::get(field.getContext(), 32);
});
+ addConversion([&](fir::LenType field) {
+ // Get size of len paramter from the descriptor.
+ return getModel<Fortran::runtime::typeInfo::TypeParameterValue>()(
+ &getContext());
+ });
addConversion(
[&](fir::ComplexType cmplx) { return convertComplexType(cmplx); });
addConversion(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113658.387170.patch
Type: text/x-patch
Size: 1111 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211115/be743e95/attachment.bin>
More information about the llvm-commits
mailing list