This is an archive of the discontinued LLVM Phabricator instance.

[flang] Lower assumed length character allocatable and pointer arguments
ClosedPublic

Authored by jpenix-quic on Oct 7 2022, 12:38 PM.

Details

Summary

I think the needed functionality was already implemented for host associations,
so turn that code into a function and move it into a (hopefully appropriate)
common location and reuse it.

Diff Detail

Event Timeline

jpenix-quic created this revision.Oct 7 2022, 12:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 7 2022, 12:38 PM
jpenix-quic requested review of this revision.Oct 7 2022, 12:38 PM

Thanks for working on this and identifying the opportunity to re-use some code (I had completely forgotten this was here) !

flang/include/flang/Optimizer/Builder/Character.h
229 ↗(On Diff #466155)

the "Optimizer" part does not depend on semantics (the rational being that it is meant to work from FIR files that will not include any semantics data structures any more).

In this case, I think you can just move the helper to https://github.com/llvm/llvm-project/blob/main/flang/include/flang/Lower/Allocatable.h and its cpp files (where it is OK to depends on semantics).

Move helper function to Allocatable.h/cpp. Also add lines to pointer tests to check we are reading from the argument to match the allocatable tests.

jpenix-quic marked an inline comment as done.Oct 10 2022, 10:29 AM
jpenix-quic added inline comments.
flang/include/flang/Optimizer/Builder/Character.h
229 ↗(On Diff #466155)

Got it, thanks! The helper has been moved.

Thanks for looking over this!

jeanPerier accepted this revision.Oct 13 2022, 2:24 AM

Thanks, looks great to me.

This revision is now accepted and ready to land.Oct 13 2022, 2:24 AM
This revision was automatically updated to reflect the committed changes.
jpenix-quic marked an inline comment as done.