[flang-commits] [flang] [Flang] Compute elemental character MIN/MAX result length in HLFIR (PR #189464)

via flang-commits flang-commits at lists.llvm.org
Wed Apr 1 04:21:34 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- flang/lib/Lower/ConvertCall.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Lower/ConvertCall.cpp b/flang/lib/Lower/ConvertCall.cpp
index c6a5d7e8f..ea65a4935 100644
--- a/flang/lib/Lower/ConvertCall.cpp
+++ b/flang/lib/Lower/ConvertCall.cpp
@@ -2778,18 +2778,17 @@ public:
         mlir::Value zero = builder.createIntegerConstant(loc, idxTy, 0);
         mlir::Value isPresent = preparedActual->getIsPresent();
         auto &capture = *preparedActual;
-        argLen = builder
-                     .genIfOp(loc, {idxTy}, isPresent,
-                              /*withElseRegion=*/true)
-                     .genThen([&]() {
-                       mlir::Value len = capture.genCharLength(loc, builder);
-                       len = builder.createConvert(loc, idxTy, len);
-                       fir::ResultOp::create(builder, loc, len);
-                     })
-                     .genElse([&]() {
-                       fir::ResultOp::create(builder, loc, zero);
-                     })
-                     .getResults()[0];
+        argLen =
+            builder
+                .genIfOp(loc, {idxTy}, isPresent,
+                         /*withElseRegion=*/true)
+                .genThen([&]() {
+                  mlir::Value len = capture.genCharLength(loc, builder);
+                  len = builder.createConvert(loc, idxTy, len);
+                  fir::ResultOp::create(builder, loc, len);
+                })
+                .genElse([&]() { fir::ResultOp::create(builder, loc, zero); })
+                .getResults()[0];
       } else {
         argLen = preparedActual->genCharLength(loc, builder);
         argLen = builder.createConvert(loc, idxTy, argLen);

``````````

</details>


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


More information about the flang-commits mailing list