[flang-commits] [flang] [flang][OpenMP] Support reduction of allocatable variables (PR #88392)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Mon Apr 22 09:22:19 PDT 2024


tblah wrote:

> LGTM. Nice work Tom.
> 
> There was some effort to centralize code for deallocations. #67003 There are also functions like `genIsAllocatedOrAssociatedTest` that could be helpful.

Thanks for the recommendation. Using these APIs would require wrapping everything in a `fir::MutableBoxValue`. I didn't like that approach for a few reasons:
1) I feel it unnecessarily obfuscates what is being done in this case. I already use standard helpers to determine if the pointer is null. E.g. all that `genIsAllocatedOrAssociated` does is get the address and use the same helper to see if it is null.
2) It will make the code structure here more complex because only the allocatable boxes can be a `MutableBoxValue`
3) I want control of the generated fir::IfOp

A lot of the added complexity in the MutableBox code is for running finalizers etc. We only support trivial types here.

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


More information about the flang-commits mailing list