[flang-commits] [flang] [flang][OpenMP] Add lowering of subroutine calls in custom reduction combiners (PR #169808)

Jan Leyonberg via flang-commits flang-commits at lists.llvm.org
Fri Nov 28 05:27:37 PST 2025


================
@@ -3586,19 +3587,32 @@ processReductionCombiner(lower::AbstractConverter &converter,
   const parser::OmpStylizedInstance::Instance &instance =
       std::get<parser::OmpStylizedInstance::Instance>(combinerInstance.t);
 
-  const auto *as = std::get_if<parser::AssignmentStmt>(&instance.u);
-  if (!as) {
-    TODO(converter.getCurrentLocation(),
-         "A combiner that is a subroutine call is not yet supported");
+  std::optional<semantics::SomeExpr> evalExprOpt;
+  if (const auto *as = std::get_if<parser::AssignmentStmt>(&instance.u)) {
+    auto &expr = std::get<parser::Expr>(as->t);
+    evalExprOpt = makeExpr(expr, semaCtx);
+  } else if (const auto *call = std::get_if<parser::CallStmt>(&instance.u)) {
+    if (call->typedCall) {
+      const auto &procRef = *call->typedCall;
+      evalExprOpt = semantics::SomeExpr{procRef};
+    } else {
+      TODO(converter.getCurrentLocation(),
+           "CallStmt without typedCall is not yet supported");
----------------
jsjodin wrote:

I wasn't quite sure about this, but it is possible in the in declare reduction to list multiple types and maybe if you do the typed call won't be filled. We limit this today, so perhaps we can simplify the code and assume it is there.

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


More information about the flang-commits mailing list