[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
Loading
Please sign in to comment