diff options
author | Kareem Ergawy <kareem.ergawy@amd.com> | 2025-04-16 06:14:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-16 06:14:38 +0200 |
commit | 04b87e15e40f8857e29ade8321b8b67691545a50 (patch) | |
tree | 39e2f254f7cdcdd1374f11e8faa37a2a74ede814 /clang/lib/AST/ByteCode/Program.cpp | |
parent | b07c88563febdb62b82daad0480d7b6131bc54d4 (diff) | |
download | llvm-04b87e15e40f8857e29ade8321b8b67691545a50.zip llvm-04b87e15e40f8857e29ade8321b8b67691545a50.tar.gz llvm-04b87e15e40f8857e29ade8321b8b67691545a50.tar.bz2 |
[flang][fir] Lower `do concurrent` loop nests to `fir.do_concurrent` (#132904)
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 'clang/lib/AST/ByteCode/Program.cpp')
0 files changed, 0 insertions, 0 deletions