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

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Wed Jun 24 05:15:33 PDT 2026


https://github.com/skatrak commented:

Thank you for the quick update, there are some smaller details left. Otherwise, I think this is almost ready.

> For Flang-generated HLFIR, the in_reduction operand and the matching map.info var_ptr can come from different results of the same hlfir.declare: the in_reduction operand uses result 0, while the map.info var_ptr uses result 1. They are distinct SSA values at the OpenMP verifier point and only become the same underlying address after FIR/LLVM lowering.

I see... That's not great, because not being able to make a direct connection between an `in_reduction` and `map` value means we can produce broken MLIR that cannot be translated to LLVM IR. The best we can do at the moment is to check in the verifier that all `in_reduction` operands are produced by the same operation as the `var_ptr` of at least one of the `map_entries` of the same operation. And then, where you're currently making the "not yet implemented: in_reduction variable on omp.target must also be captured by a matching map_entries entry" check put an assert instead. That'd be my suggestion in this case.

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


More information about the flang-commits mailing list