[PATCH] D88706: [OpenMP][MLIR] WIP : Fix for nested parallel region

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 5 16:26:18 PDT 2020


jdoerfert added a comment.

In D88706#2313091 <https://reviews.llvm.org/D88706#2313091>, @schweitz wrote:

> `fir.alloca` ops should be hoisted to the entry block.  Because Fortran is pass-by-reference, correctness will often simply require stack allocations. However, that said, in cases where alloca ops can be promoted to registers, they will be although that is disabled at the moment.

I guess this is "often" correct but that is beyond the point. The OpenMP-IR-Builder introduces the allocas in question and they cannot go into the function entry block. That is simply not sound.
The allocas need to be placed at the last alloca point provided by the OpenMP-IR-Builder since those points will become the entry blocks of new functions and those entry blocks might be executed by more threads making "pass-by-reference" reuse unsound.

That said, I doubt that the allocas caused by "user Fortran code" can *always* go into the function entry either, though that is a discussion for another day.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88706/new/

https://reviews.llvm.org/D88706



More information about the llvm-commits mailing list