[flang-commits] [flang] [Flang][OpenMP] Create MLIR optimization pass to push index allocations into loop body and remove them if redundant (PR #67010)

Sergio Afonso via flang-commits flang-commits at lists.llvm.org
Thu Sep 28 03:48:33 PDT 2023


skatrak wrote:

I've got an update on this. I made a few changes (< 100 lines) in the OpenMP dialect to LLVM IR translation pass to detect allocas for primitive types which are only used inside of the region associated to OpenMP loop operations (`omp.wsloop` and `omp.simdloop`), and to add `llvm.lifetime.start` and `llvm.lifetime.end` markers for them around the entry and exit points of the associated basic block(s).

These markers later allow the `CodeExtractor` to sink the allocas for index variables (and potentially others) into the outlined function created for the loop body, rather than passing them as arguments. The outlining would be implemented by the `OpenMPIRBuilder` after the new RTL functions mentioned by Dominik were available.

My idea was to wait until at least the PRs adding these other functions were up before creating one for my changes, since it wouldn't make much of a real difference on its own, but I wanted to check whether it would be a good idea to still create it now so we can discuss whether that or a change to the MLIR representation of the OpenMP loop operations would be a better solution.

https://github.com/llvm/llvm-project/pull/67010


More information about the flang-commits mailing list