[flang-commits] [flang] [flang] Fixed MemAlloc/Free effects handling in FIR ModRef. (PR #177728)

via flang-commits flang-commits at lists.llvm.org
Mon Jan 26 06:27:49 PST 2026


https://github.com/jeanPerier approved this pull request.

The fir_FreeMemOp looks good to me, it is unclear to me why freeing something should not be considered as a modification.
I guess it depends of the use cases, and looking at the current usages we are making of it (LICM and OptimizedBufferization), I do not see any issues with your changes.

What I am worried about is someone doing a transformation that would move a read after a freemem. I do not have a good example as I do not see in what kind of optimization you would want to delay a read. But If I implemented it, I would probably think that having getModRef telling me there is no modification on the address is enough between the old and new insertion point is enough.

I guess the answer to that is to be very clear in the getModRef declaration that alloc/free effect are ignored.

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


More information about the flang-commits mailing list