Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Avoid raising a TODO in fir.boxproc rewrite when not needed (#…
…1560) The pass was raising TODOs when a function both had a fir.boxproc<> argument and a fir.type<> argument (even if the fir.type<> did not contain a fir.boxproc itself). Prevent the TODO from firing when a fir.type<> does not actually contain a fir.boxproc. Add the location for the remaining TODO (it will be needed when procedure pointer components are supported in lowering). FYI, I actually tried to just implement the TODO, but I there is a funny issue. When creating the new fir::RecordType, since the name and context are the same as the type being translated, fir::RecordType:get just returns the existing type, and there is no way to change it (finalize() does nothing since it is already finalized). So this will require to add the ability to mutate the existing type, and I am not sure what are the MLIR constraints here, so I escaped and left the TODO for that case. This patch is part of the upstreaming effort from fir-dev branch. Reviewed By: jeanPerier, PeteSteinfeld Differential Revision: https://reviews.llvm.org/D127633 Co-authored-by: Jean Perier <jperier@nvidia.com>
- Loading branch information
1 parent
c8a9afe
commit a370a4f
Showing
2 changed files
with
36 additions
and
10 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,14 @@ | ||
// Test fir.boxproc type conversion in the boxed-procedure pass. | ||
// RUN: fir-opt --boxed-procedure %s | FileCheck %s | ||
|
||
//CHECK-LABEL: func.func private @test1(!fir.type<a{x:i32,y:f64}>, () -> ()) -> none | ||
func.func private @test1(!fir.type<a{x:i32, y:f64}>, !fir.boxproc<() -> ()>) -> none | ||
|
||
//CHECK-LABEL: func.func private @test2((!fir.type<a{x:i32,y:f64}>) -> ()) -> none | ||
func.func private @test2(!fir.boxproc<(!fir.type<a{x:i32, y:f64}>) -> ()>) -> none | ||
|
||
//CHECK-LABEL: func.func private @test3(() -> !fir.type<a{x:i32,y:f64}>) -> none | ||
func.func private @test3(!fir.boxproc<() -> (!fir.type<a{x:i32, y:f64}>)>) -> none | ||
|
||
//CHECK-LABEL: func.func private @test5(((i32) -> f32) -> ()) | ||
func.func private @test5(!fir.boxproc<(!fir.boxproc<(i32) -> (f32)>) -> ()>) |