[SCF][MemRef] Enable SCF.Parallel Lowering to use Scope Op
authorWilliam S. Moses <gh@wsmoses.com>
Wed, 23 Feb 2022 19:08:51 +0000 (14:08 -0500)
committerWilliam S. Moses <gh@wsmoses.com>
Tue, 1 Mar 2022 18:25:09 +0000 (13:25 -0500)
commit78fb4f9d5dd95d26424919f2da184e1119ccb023
tree97a799ceb05c4be75c0773b15a87ab4592a7a6bf
parentb9d6e8c44150cf03261f41c445839fa5505fb280
[SCF][MemRef] Enable SCF.Parallel Lowering to use Scope Op

As discussed in https://reviews.llvm.org/D119743 scf.parallel would continuously stack allocate since the alloca op was placd in the wsloop rather than the omp.parallel. This PR is the second stage of the fix for that problem. Specifically, we now introduce an alloca scope around the inlined body of the scf.parallel and enable a canonicalization to hoist the allocations to the surrounding allocation scope (e.g. omp.parallel).

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D120423
mlir/include/mlir/Conversion/Passes.td
mlir/include/mlir/Dialect/MemRef/IR/MemRefOps.td
mlir/lib/Conversion/SCFToOpenMP/SCFToOpenMP.cpp
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
mlir/test/Conversion/SCFToOpenMP/reductions.mlir
mlir/test/Conversion/SCFToOpenMP/scf-to-openmp.mlir
mlir/test/Dialect/MemRef/canonicalize.mlir