[flang-commits] [PATCH] D151110: [flang][hlfir] Hoist forall bounds computation when possible

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Mon May 22 08:34:31 PDT 2023


jeanPerier created this revision.
jeanPerier added reviewers: tblah, vzakhari, clementval.
jeanPerier added a project: Flang.
Herald added subscribers: sunshaoce, mehdi_amini, jdoerfert.
Herald added a project: All.
jeanPerier requested review of this revision.

When inner forall bound computations do not depend on previous
forall indices, they can be hoisted.
This is possible because:

- bound computation are required to be pure (so evaluating them only once is possible).
- If the bound computation depends on a value previously assigned, the forall scheduling analysis created different run for it: the assignment impacting the bounds value is not part of the current loop nest.

The reason this optimization is done at that point and not as part of
generic loop hoisting optimization is that having the all the loop
bound computation hoisted will allow allocating simple temporary
storages. The number of iteration can be pre-computed and used as the
extent for the temporary.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151110

Files:
  flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
  flang/test/HLFIR/order_assignments/forall-codegen-no-conflict.fir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151110.524326.patch
Type: text/x-patch
Size: 11874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20230522/dbe084c2/attachment-0001.bin>


More information about the flang-commits mailing list