[flang-commits] [flang] [llvm] [mlir] [flang][OpenMP] Lower target in_reduction (PR #199967)

Sairudra More via flang-commits flang-commits at lists.llvm.org
Mon Jul 13 07:51:19 PDT 2026


================
@@ -8435,6 +8458,20 @@ getDynGroupprivateFallbackType(omp::FallbackModifierAttr fallbackAttr) {
   llvm_unreachable("unexpected dyn_groupprivate fallback type");
 }
 
+/// An `omp.target` `in_reduction` operand is captured by a `map_entries` entry
+/// when the entry's `MapInfoOp` var_ptr is the same SSA value, or another
+/// result of the same defining op (block arguments, which have no defining op,
+/// match only by exact identity). Flang emits `hlfir.declare`#0 for the
+/// `in_reduction` operand and `hlfir.declare`#1 for the map var_ptr. Keep this
+/// predicate in sync with `omp::TargetOp::verify()` in OpenMPDialect.cpp so
+/// translation matches exactly what the verifier accepts.
+static bool targetInReductionCapturedBy(Value inReductionVar, Value mapVarPtr) {
----------------
Saieiei wrote:

Done!

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


More information about the flang-commits mailing list