[llvm-branch-commits] [flang] [Flang] KIND De-templatization (PR #216960)

Tom Eccles via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 17 05:29:35 PDT 2026


================
@@ -1224,9 +1272,11 @@ Expr<T> RewriteSpecificMINorMAX(
   intrinsic.characteristics.value().functionResult.value().SetType(*resultType);
   auto insertConversion{[&](const auto &x) -> Expr<T> {
     using TR = ResultType<decltype(x)>;
+    const int kind{x.kind()};
     FunctionRef<TR> maxRef{
-        ProcedureDesignator{funcRef.proc()}, ActualArguments{args}};
-    return Fold(context, ConvertToType<T>(AsCategoryExpr(std::move(maxRef))));
+        kind, ProcedureDesignator{funcRef.proc()}, ActualArguments{args}};
+    return Fold(
+        context, ConvertToType<T>(kind, AsCategoryExpr(std::move(maxRef))));
----------------
tblah wrote:

I think this convert should use the kind from the `funcRef` not from the arguments. Codex gave me two cases where these don't necessarily match: `amax0(1_8,2_8)`, `max1(1.0_8,2.0_8)` (and from my reading of the standard, the same applies for `amin0`, `min1`)

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


More information about the llvm-branch-commits mailing list