[flang-commits] [flang] [flang][hlfir] Add hlfir.maxval intrinsic (PR #65705)

via flang-commits flang-commits at lists.llvm.org
Mon Sep 11 03:54:17 PDT 2023


================
@@ -227,6 +228,17 @@ HlfirTransformationalIntrinsic::computeResultType(mlir::Value argArray,
     mlir::Type elementType = array.getEleTy();
     return hlfir::ExprType::get(builder.getContext(), resultShape, elementType,
                                 /*polymorphic=*/false);
+  } else if (auto resCharType =
+                 mlir::dyn_cast<fir::CharacterType>(stmtResultType)) {
+    if (!resCharType.hasConstantLen()) {
+      auto argCharType = mlir::dyn_cast<fir::CharacterType>(
+          hlfir::getFortranElementType(argArray.getType()));
+      if (argCharType && argCharType.hasConstantLen())
+        resCharType = fir::CharacterType::get(
+            builder.getContext(), resCharType.getFKind(), argCharType.getLen());
----------------
jeanPerier wrote:

Thanks for the review on this patch, I just merged it, so you should just be able to remove the part dealing with the constant length.

https://github.com/llvm/llvm-project/pull/65705


More information about the flang-commits mailing list