[flang-commits] [flang] [Flang][MLIR] Add basic initial support for alloca and program address space handling in FIR->LLVMIR codegen (PR #77518)

via flang-commits flang-commits at lists.llvm.org
Mon Jan 15 14:52:58 PST 2024


agozillon wrote:

Would be good to get a review and approval from one of the previous reviewers (or creators) of the previous PR on Phabricator as well if possible @jeanPerier @kiranchandramohan, so if one of you has time it would be greatly appreciated (I know you're both incredibly busy so I apologies for requesting more of your time), thank you very much ahead of time. If you're happy with it as is that is also fine! 

As an aside this also seems to help fix a compiler crash when using transpose on a regular array inside of a target region, so it doesn't just apply to allocatables, but more broadly to cases where the fortran runtime injects alloca operations into the target region (and user code I'd imagine as well, although, I don't have the Fortran know-how to create a test case for that off the top of my head). After this PR lands, there is however, still a chance of some passes performing some breaking optimisations (executable will give incorrect results or segault) as we currently don't appropriately place these allocation in the entry block when we generate the target region. This happens in the case of scalar allocatable assignment currently, not had the chance to test it in this case just yet, only managed to confirm that this PR fixes the compiler crash so far. I'm having a look into raising the allocas into the entry block, but creating the simple fix I had in mind has proven harder than I expected so far. 

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


More information about the flang-commits mailing list