[flang-commits] [flang] [Flang][OpenMP] Permit THREADPRIVATE variables in EQUIVALENCE statements (PR #186696)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Mon Mar 16 05:23:12 PDT 2026
https://github.com/tblah commented:
Thank you for implementing this.
I think a few more changes are needed for this to work. See the reproducer in https://github.com/llvm/llvm-project/issues/122825, which currently crashes lowering this commit. The crash is because of equivalence variables use `!fir.ptr<>`, but we don't currently have lowering for copyprivate with `!fir.ptr<>`.
I have a downstream implementation [here](https://github.com/arm/arm-toolchain/pull/755/commits/ae32bed8ca5f882050cbbed73ab656adfc92f8cf). I updated the copy function generation to accept `!fir.ptr<>` in addition to `fir.ref<>` and modified the name of the function to reflect the differing types (in `ClauseProcessor.cpp`). Changing the function name unfortunately led to a lot of test fallout. If you would like to use my approach please feel free to re-use as many of my changes as you like. I'm happy to see another sensible approach too. (I prefer your approach of propagating the flang to the equivalence set in semantics so no need to copy *all* of the changes above).
There can also be limitations in MLIR to LLVM code generation. For example see
```
program tp1
real, save :: eq_a, eq_b
equivalence(eq_a, eq_b)
!$omp threadprivate(eq_a)
end program tp1
```
In this case a GEP operation is generated, which is not currently handled by `convertOmpThreadprivate` in `OpenMPToLLVMIRTranslation.cpp` (which needs to be able to look through the GEP to find the global variable).
https://github.com/llvm/llvm-project/pull/186696
More information about the flang-commits
mailing list