diff options
author | Kareem Ergawy <kareem.ergawy@amd.com> | 2025-05-07 12:52:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-07 12:52:25 +0200 |
commit | 2fb288d4b8e0fb6c08a1a72b64cbf6a0752fdac7 (patch) | |
tree | 0133d5adb4317d160218088dea7665aa89c1c2d3 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | c3ce5684a8b408220eed983d065edba0e6ed5016 (diff) | |
download | llvm-2fb288d4b8e0fb6c08a1a72b64cbf6a0752fdac7.zip llvm-2fb288d4b8e0fb6c08a1a72b64cbf6a0752fdac7.tar.gz llvm-2fb288d4b8e0fb6c08a1a72b64cbf6a0752fdac7.tar.bz2 |
[flang][fir] Lower `do concurrent` loop nests to `fir.do_concurrent` (#137928)
Adds support for lowering `do concurrent` nests from PFT to the new
`fir.do_concurrent` MLIR op as well as its special terminator
`fir.do_concurrent.loop` which models the actual loop nest.
To that end, this PR emits the allocations for the iteration variables
within the block of the `fir.do_concurrent` op and creates a region for
the `fir.do_concurrent.loop` op that accepts arguments equal in number
to the number of the input `do concurrent` iteration ranges.
For example, given the following input:
```fortran
do concurrent(i=1:10, j=11:20)
end do
```
the changes in this PR emit the following MLIR:
```mlir
fir.do_concurrent {
%22 = fir.alloca i32 {bindc_name = "i"}
%23:2 = hlfir.declare %22 {uniq_name = "_QFsub1Ei"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
%24 = fir.alloca i32 {bindc_name = "j"}
%25:2 = hlfir.declare %24 {uniq_name = "_QFsub1Ej"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
fir.do_concurrent.loop (%arg1, %arg2) = (%18, %20) to (%19, %21) step (%c1, %c1_0) {
%26 = fir.convert %arg1 : (index) -> i32
fir.store %26 to %23#0 : !fir.ref<i32>
%27 = fir.convert %arg2 : (index) -> i32
fir.store %27 to %25#0 : !fir.ref<i32>
}
}
```
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
0 files changed, 0 insertions, 0 deletions