[fir] Add affine demotion pass
authorRajan Walia <walrajan@gmail.com>
Fri, 8 Oct 2021 12:02:02 +0000 (14:02 +0200)
committerValentin Clement <clementval@gmail.com>
Fri, 8 Oct 2021 12:03:27 +0000 (14:03 +0200)
commit80c27abb2f74aa439ba381148186407ebae1793e
tree29ae48cef4f0de45190b3f330f89be1a0ad0c4be
parentb6426d52111cafdbd9114ead3855b861de0173d6
[fir] Add affine demotion pass

Add affine demotion pass.
Affine dialect's default lowering for loads and stores is different from
fir as it uses the `memref` type. The `memref` type is not compatible with
the Fortran runtime. Therefore, conversion of memory operations back to
`fir.load` and `fir.store` with `!fir.ref<?>` types is required.

This patch is part of the upstreaming effort from fir-dev branch.

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Rajan Walia <walrajan@gmail.com>
Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Co-authored-by: Valentin Clement <clementval@gmail.com>
Reviewed By: schweitz

Differential Revision: https://reviews.llvm.org/D111257
flang/include/flang/Optimizer/Transforms/Passes.h
flang/include/flang/Optimizer/Transforms/Passes.td
flang/lib/Optimizer/Transforms/AffineDemotion.cpp [new file with mode: 0644]
flang/lib/Optimizer/Transforms/CMakeLists.txt
flang/test/Fir/affine-demotion.fir [new file with mode: 0644]