This is an archive of the discontinued LLVM Phabricator instance.

[flang] Remove obsolete TODO
ClosedPublic

Authored by unterumarmung on Jul 22 2022, 9:00 AM.

Details

Summary

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.

Diff Detail

Event Timeline

unterumarmung created this revision.Jul 22 2022, 9:00 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJul 22 2022, 9:00 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
unterumarmung requested review of this revision.Jul 22 2022, 9:00 AM

I think there should be a test case that covers that code at least lowers from pre-fir-tree to FIR with some of operations that contain function type with abstract result in fir.global successfully. But I'm having a hard time coming up with the test case for the moment. Because I can imagine only 2 scenarios when we have the operations we need in fir.global:

  1. Initialization of a procedure pointer with PARAMETER attribute. The procedure pointer are not supported yet, so it fails earlier than the deleted TODO.
  2. I do not know how to describe it, just attach a code snippet below. The polymorphic types are not supported yet, so it fails earlier than the deleted TODO.
module a
    type f
    contains
        procedure foo
    end type f
contains
    function foo(obj) result(bar)
        class(f) :: obj
        character(len=:), allocatable :: bar
        if (.TRUE.) then
            bar = "true"
        else
            bar = "false"
        endif
    end function foo
end module a

Is there any other way to test it?

I think there should be a test case that covers that code at least lowers from pre-fir-tree to FIR with some of operations that contain function type with abstract result in fir.global successfully. But I'm having a hard time coming up [...]
Is there any other way to test it?

You can have a test that does not hit the polymorphic TODO if you go with something similar to your option 2., but with a procedure, nopass so that you do not need the class(f) argument.

Rebased & added the test

I think there should be a test case that covers that code at least lowers from pre-fir-tree to FIR with some of operations that contain function type with abstract result in fir.global successfully. But I'm having a hard time coming up [...]
Is there any other way to test it?

You can have a test that does not hit the polymorphic TODO if you go with something similar to your option 2., but with a procedure, nopass so that you do not need the class(f) argument.

Yes, this is a good idea, thank you! Totally forgot about nopass.
Added the test

This revision is now accepted and ready to land.Aug 23 2022, 12:02 AM
This revision was automatically updated to reflect the committed changes.