[all-commits] [llvm/llvm-project] 96a003: [flang][hlfir] Hoist forall bounds computation whe...

jeanPerier via All-commits all-commits at lists.llvm.org
Tue May 23 00:19:35 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 96a003b9bf79f22ead65173ae44943df640c5431
      https://github.com/llvm/llvm-project/commit/96a003b9bf79f22ead65173ae44943df640c5431
  Author: Jean Perier <jperier at nvidia.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

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

  Log Message:
  -----------
  [flang][hlfir] Hoist forall bounds computation when possible

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.

Differential Revision: https://reviews.llvm.org/D151110




More information about the All-commits mailing list