[flang-commits] [flang] [Flang] Hoist concurrent-limit and concurrent-step expressions outsid… (PR #111665)
via flang-commits
flang-commits at lists.llvm.org
Wed Oct 16 15:35:33 PDT 2024
vdonaldson wrote:
f23 Constraint C1125 _A concurrent-limit or concurrent-step in a concurrent-control shall not contain a reference to any index-name in the concurrent-control-list in which it appears._
This constraint should allow moving all loop control expressions out of a multi-dimension loop body. But it doesn't in general allow those to be moved even higher, such as above the distinct outer loop in test function `sub2`. Doing that would require additional analysis.
Since this is a specific instance of loop invariant code motion, it is likely best to leave this to an optimization pass that does the analysis to not only address this case, but also other cases. Another example is calling a pure function in the control code of a non-doconcurrent loop nested inside an enclosing loop.
If there really is a good reason to do this early, the information needed to hoist control code to at most the top of a multiple-dimension loop is local to `genFIRIncrementLoopBegin`. The code should probably be local there.
https://github.com/llvm/llvm-project/pull/111665
More information about the flang-commits
mailing list