This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Lower actual TARGET for dummy POINTER.
ClosedPublic

Authored by vzakhari on Jul 2 2023, 3:36 PM.

Details

Summary

This patch implements HLFIR lowering for associating an actual
TARGET argument to a dummy POINTER argument.

Diff Detail

Event Timeline

vzakhari created this revision.Jul 2 2023, 3:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 2 2023, 3:36 PM
vzakhari requested review of this revision.Jul 2 2023, 3:36 PM
tblah added a comment.Jul 3 2023, 3:16 AM

Thanks for this. Just a couple of small nits

flang/lib/Lower/ConvertCall.cpp
1155

Could you use hlfir::convertToAddress (HLFIRTools.h) here? It avoids the use of callContext.stmtCtx, which I believe @jeanPerier intends to remove.

flang/test/Lower/HLFIR/actual_target_for_dummy_pointer.f90
43

From the naming I would expect this to be class(*), pointer, intent(in) :: p(:)

70

This too

vzakhari added inline comments.Jul 3 2023, 9:37 AM
flang/lib/Lower/ConvertCall.cpp
1155

Yes, I could use it. This would require handling the generic clean-up returned as hlfir::CleanupFunction via the CallCleanUp that we use in genUserCall.

Note that there is existing use of Fortran::lower::convertToAddress in genIntrinsicRefCore, and there are more uses the statement context. I suppose it is only used for handling the clean-ups.

I think switching to hlfir::convertToAddress here should be done when we get rid of the statement context usage and handle the clean-ups uniformly.

flang/test/Lower/HLFIR/actual_target_for_dummy_pointer.f90
43

Thank you! I will fix it.

70

Thanks!

tblah added inline comments.Jul 3 2023, 9:54 AM
flang/lib/Lower/ConvertCall.cpp
1155

+1

vzakhari updated this revision to Diff 536828.Jul 3 2023, 10:15 AM

Fixed the LIT test.

jeanPerier accepted this revision.Jul 4 2023, 12:31 AM

Looks great!

This revision is now accepted and ready to land.Jul 4 2023, 12:31 AM
tblah accepted this revision.Jul 4 2023, 2:14 AM

Thanks for the fix

This revision was automatically updated to reflect the committed changes.