This patch adds the !fir.len type conversion. The type is converted
to the a 32 bits integer.
This patch is part of the upstreaming effort from fir-dev branch.
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D113658
// 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(
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