[Mlir-commits] [flang] [mlir] [RFC][Draft][flang][FIR] Model implict box allocations in side effects (PR #178412)
Tom Eccles
llvmlistbot at llvm.org
Fri Jan 30 07:01:30 PST 2026
tblah wrote:
> Hi Tom, thank you for working on this!
>
> I am not 100% comfortable with modifying FIR dialect operations just yet. Can the problem be solved for OpenMP specifically by making sure that `!fir.box` SSA values are made firstprivate for `task`, etc.? I suppose you can think about `!fir.box` as an aggregate of scalar values (and one pointer), so if it is natural to treat regular scalar values as firstprivate, then it should be the same for `!fir.box`.
The problem is that this isn't modelled in the IR at all until after FIR is lowered to LLVM-IR. Sure we can make the original box firstprivate (and in the issue, the variable passed to the write is in fact made implicitly firstprivate). But the temporary box created by the embox operation is not modelled at all so we can't mark it for privatisation. And actually by the time that temporary is even created by FIR->LLVM, the embox already got removed by CSE.
Anyway thank you both for your input. I'm away next week and will think about alternate solutions when I get back.
https://github.com/llvm/llvm-project/pull/178412
More information about the Mlir-commits
mailing list