This is an archive of the discontinued LLVM Phabricator instance.

[flang][NFC] centralize FreeMemOp generation in IntrinsicCall.cpp
ClosedPublic

Authored by jeanPerier on Jan 13 2023, 1:50 AM.

Details

Summary

The current intrinsic call lowering contains a lot of repetitive
patterns when it comes to dealing with temporary allocatable
results allocated by the runtime that need to be dereferenced and
for which a clean-up (free) must be scheduled in the StatementContext.

For HLFIR lowering, I will need to deal with the clean-up in a different
way since the results will be "moved" into expression nodes and
the clean-up will be inserted in bufferization after the last hlfir.expr
usage. Centralizing the clean-up code will make that easier, and is
regardless of this motivation a quality improvement.

Some static helpers had to be moved to IntrinsicBuilder method so that
they could call the readAndAddCleanUp code.

Diff Detail

Event Timeline

jeanPerier created this revision.Jan 13 2023, 1:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2023, 1:50 AM
jeanPerier requested review of this revision.Jan 13 2023, 1:50 AM
This revision is now accepted and ready to land.Jan 13 2023, 2:07 AM
PeteSteinfeld accepted this revision.Jan 13 2023, 7:33 AM

All builds and tests correctly and looks good.

Thanks for the clean up!