[flang-commits] [flang] [Flang][Alias analysis] Fix alias analysis for omp private allocatable item (PR #120243)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Tue Dec 17 10:16:29 PST 2024


tblah wrote:

Thanks for looking into this bug. I think the real problem here is that all of the regions inside of the private op are being inspected. If I understand correctly, the intention is for `getPrivateArg` to find the allocation for this private argument. But as it is written now it is checking all of the regions looking for a Yield operation and so it will also look at `dealloc` and `copy` regions (as well as the `alloc` region that I think was the intention). I think the iteration order over regions inside of an mlir operation is not defined.

I think the correct solution is to only look for yield operations inside of the `alloc` region. This is [guaranteed](https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp#L2833) to yield a value.

Please also change the code so that it detects multiple `omp.yield` operations yielding different values. If there are multiple possible values yielded then we cannot know which one will happen at runtime (assuming no dead code).

Or maybe even some simpler logic is possible. I don't think the descriptor for a private value can alias with anything. I think the value of the private value can't alias with anything else unless it is POINTER or TARGET.

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


More information about the flang-commits mailing list