This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Support passing polymorphic expr for non-polymorphic dummy.
ClosedPublic

Authored by vzakhari on Aug 8 2023, 6:02 PM.

Details

Summary

The actual polymorphic expression argument that is passed to a non-polymorphic
contiguous dummy has to be made a contiguous entity with the dynamic type
matching the declared type of the dummy argument.
The solution is to associate the expression with a temporary of the dynamic
type of the expression, then rebox the temporary to the declared type
of the dummy argument, and then, if necessary, make copy-in into another
temporary that is, finally, a contiguous entity with the required dynamic type.

With this change a single prepared argument may have up to two associated
clean-ups, so I had to change the clean-ups handling.

Diff Detail

Event Timeline

vzakhari created this revision.Aug 8 2023, 6:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 8 2023, 6:02 PM
vzakhari requested review of this revision.Aug 8 2023, 6:02 PM
tblah accepted this revision.Aug 9 2023, 3:02 AM

LGTM, thanks for this!

This revision is now accepted and ready to land.Aug 9 2023, 3:02 AM