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

Yusuke MINATO via flang-commits flang-commits at lists.llvm.org
Mon Sep 11 02:08:53 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());
----------------
yus3710-fj wrote:

Thank you for your comment. It's very helpful for me.
After applying your patch #65771 to my branch, it seemed that my implementation for length information came to be unnecessary.
Should I remove this? If so, is the TODO comment still needed?

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


More information about the flang-commits mailing list