Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang][codegen] Add a conversion for
fir.coordinate_of
- part 2
This patch extends the `FIRToLLVMLowering` pass in Flang by extending the hook to transform `fir.coordinate_of` into a sequence of LLVM MLIR instructions (i.e. `CoordinateOpConversion::doRewrite`). The following case is added: 3.1 the input object is inside `!fir.ref` (e.g. `!fir.ref<!fir.array>` or `!fir.ref<!fir.type>`). 3.2 the input object is inside `!fir.ptr` (e.g. `!fir.ptr<!fir.array>` or `!fir.ptr<!fir.type>`). From the point of view of the conversion, 3.1 and 3.2 are currently identical. This is part of the upstreaming effort from the `fir-dev` branch in [1]. [1] https://github.com/flang-compiler/f18-llvm-project Originally written by: Co-authored-by: Jean Perier <jperier@nvidia.com> Co-authored-by: Eric Schweitz <eschweitz@nvidia.com> Co-authored-by: V Donaldson <vdonaldson@nvidia.com> Depends on: D114159 Differential Revision: https://reviews.llvm.org/D115333
- Loading branch information
1 parent
5675b61
commit 6d655ad
Showing
6 changed files
with
333 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s | ||
|
||
// CHECK: unsupported combination of coordinate operands | ||
func @test_coordinate_of(%arr : !fir.ref<!fir.array<2 x !fir.char<10, 2>>>, %arg1: index) { | ||
%1 = arith.constant 10 : i32 | ||
%2 = fir.coordinate_of %arr, %arg1, %1 : (!fir.ref<!fir.array<2 x !fir.char<10, 2>>>, index, i32) -> !fir.ref<!fir.char<1,10>> | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// RUN: %not_todo_cmd fir-opt --fir-to-llvm-ir="target=x86_64-unknown-linux-gnu" %s 2>&1 | FileCheck %s | ||
|
||
// CHECK: unsupported combination of coordinate operands | ||
|
||
func @test_coordinate_of(%arr : !fir.ref<!fir.array<2 x i32>>, %arg1: index) { | ||
%2 = fir.coordinate_of %arr, %arg1, %arg1 : (!fir.ref<!fir.array<2 x i32>>, index, index) -> !fir.ref<i32> | ||
return | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.