Non-global variable which can be in threadprivate directive must be one
variable in main program, and it has implicit SAVE attribute. Take it as
with SAVE attribute, so to create GlobalOp for it to simplify the
translation to LLVM IR.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks for the patch. I have a few comments and questions.
flang/lib/Lower/OpenMP.cpp | ||
---|---|---|
1681 | Won't something like the following work: mlir::Region ®ion = global.getRegion(); mlir::Block &block = region.back(); firOpBuilder.setInsertionPointToEnd(&block); genInit(firOpBuilder); | |
1681 | Maybe std::function<mlir::Value (fir::FirOpBuilder &)> genInit could be considered. Then a return box or a return undef could allow to take b.create<fir::HasValueOp>(currentLocation, ...); outside genInit (since the operation is anyway common). | |
flang/test/Lower/OpenMP/threadprivate-non-global.f90 | ||
28 | Is the intent of keeping duplicate instances of w, a, and b to check if multiple instances to same instances is threadprivatized once? If so, do we need to check behaviour of the following: integer, target :: x integer, pointer :: a a => x | |
30 | Have we skipped FIR checks for this call? I don't suppose we need to check for the same, but confirming once anyway. |
flang/lib/Lower/OpenMP.cpp | ||
---|---|---|
1681 | I think no. There may be no block when instantiating the variables. | |
1681 | Well, what you are proposing is the code style problem. This is following FIR lowering (flang/lib/Lower/ConvertVariable.cpp). I think it's better to keep the same style as FIR lowering. | |
flang/test/Lower/OpenMP/threadprivate-non-global.f90 | ||
28 | Good catch. It's definitely a typo. Will remove it. | |
30 | No. This call is not for FIR checking. Instead, it is for handling unassociated pointer (a) and unallocated allocatable (b). Printing an unassociated pointer or unallocated allocatable may cause one segfault in some cases if someone try to test execution of this test case. So, add one external call to handle it. Anyway, what I would like to do is to keep the test case simple and clean, but still meaningful in fortran. |
flang/lib/Lower/OpenMP.cpp | ||
---|---|---|
1681 | Will remove this lambda and reuse the function in ConvertVariable.cpp on next update. |
flang/test/Lower/OpenMP/threadprivate-non-global.f90 | ||
---|---|---|
30 | This makes sense. Thank you. |
Won't something like the following work: