Skip to content

Commit dc477a8

Browse files
author
Daniil Dudkin
committed
[flang] Remove obsolete TODO
As the comment tells, the TODO was added because there was no conversion for abstract results in function types inside GlobalOps. Since the conversion was added, this TODO is obsolete, so it is removed. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D130369
1 parent 555e09c commit dc477a8

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

flang/lib/Lower/ConvertExpr.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,13 +917,6 @@ class ScalarExprLowering {
917917
std::string name = converter.mangleName(*symbol);
918918
mlir::func::FuncOp func =
919919
Fortran::lower::getOrDeclareFunction(name, proc, converter);
920-
// Abstract results require later rewrite of the function type.
921-
// This currently does not happen inside GloalOps, causing LLVM
922-
// IR verification failure. This helper is only here to catch these
923-
// cases and emit a TODOs for now.
924-
if (inInitializer && fir::hasAbstractResult(func.getFunctionType()))
925-
TODO(converter.genLocation(symbol->name()),
926-
"static description of non trivial procedure bindings");
927920
funcPtr = builder.create<fir::AddrOfOp>(loc, func.getFunctionType(),
928921
builder.getSymbolRefAttr(name));
929922
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
! RUN: %flang_fc1 -emit-mlir %s -o - | FileCheck %s --check-prefix=BEFORE
2+
! RUN: %flang_fc1 -emit-mlir %s -o - | fir-opt --abstract-result-on-global-opt | FileCheck %s --check-prefix=AFTER
3+
module a
4+
type f
5+
contains
6+
! BEFORE: fir.address_of(@_QMaPfoo) : (!fir.ref<!fir.type<_QMaTf>>) -> !fir.box<!fir.heap<!fir.char<1,?>>>
7+
! AFTER: [[ADDRESS:%.*]] = fir.address_of(@_QMaPfoo) : (!fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>, !fir.ref<!fir.type<_QMaTf>>) -> ()
8+
! AFTER: fir.convert [[ADDRESS]] : ((!fir.ref<!fir.box<!fir.heap<!fir.char<1,?>>>>, !fir.ref<!fir.type<_QMaTf>>) -> ()) -> ((!fir.ref<!fir.type<_QMaTf>>) -> !fir.box<!fir.heap<!fir.char<1,?>>>)
9+
! AFTER-NOT: fir.address_of(@_QMaPfoo) : (!fir.ref<!fir.type<_QMaTf>>) -> !fir.box<!fir.heap<!fir.char<1,?>>>
10+
procedure, nopass :: foo
11+
end type f
12+
contains
13+
function foo(obj) result(bar)
14+
type(f) :: obj
15+
character(len=:), allocatable :: bar
16+
17+
if (.TRUE.) then
18+
bar = "true"
19+
else
20+
bar = "false"
21+
endif
22+
end function foo
23+
end module a
24+
25+
program main
26+
use a
27+
28+
type(f) :: obj
29+
print *, obj%foo(obj)
30+
end program

0 commit comments

Comments
 (0)