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

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Mon Jul 13 05:20:27 PDT 2026


================
@@ -2631,6 +2700,21 @@ bool TargetOp::hasHostEvalTripCount() {
   return false;
 }
 
+/// 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 `targetInReductionCapturedBy` in
+/// OpenMPToLLVMIRTranslation.cpp so translation matches what the verifier
+/// accepts.
----------------
skatrak wrote:

```suggestion
/// 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. We can only enforce exact value identity for block arguments, which have no defining op, because Flang emits `hlfir.declare`#0 for
/// `in_reduction` operands and `hlfir.declare`#1 for `map` var_ptr.
```

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


More information about the flang-commits mailing list