[flang-commits] [flang] [flang][HLFIR] Enable inlining of allocatable array assignments (PR #197814)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Mon May 18 21:00:40 PDT 2026


vzakhari wrote:

The change looks good to me, but I think conceptually there is no need to pair this with InlineHLFIRAssign. As I understand, you care about separating the potential re-allocation of the LHS from the actual assignment (even if it is done via the runtime call). If it is the case, then shouldn't we just have a separate pass that transforms an `hlfir.assign ... realloc` into `hlfir.assign <w/o realloc>` where the new LHS is a conditionally [re-]allocated original LHS?

The new pass may even run at `-O0` whereas InlineHLFIRAssign is supposed to run at higher opt levels.

P.S. We may need to improve FIR AA to figure out the source of the conditionally [re-]allocated LHS so that the original InlineHLFIRAssign can work after the new pass.

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


More information about the flang-commits mailing list