This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] support optional args for intrinsic ops
ClosedPublic

Authored by tblah on Jun 30 2023, 10:10 AM.

Details

Summary

This also adds support for allocatable non-optional arguments.

Of the transformational intrinsics which currently have their own hlfir
operations, all of the dynamically optional arguments are lowered as
boxes, so that is all that is implemented for now.

One alternative approach would have been to deal with the dynamically
optional arguments when lowering to FIR runtime calls. I decided not to
do this so that any passes working on the intrinsic operations would not
have to know about and handle the dynamically optional arguments.

Depends on D154235

Diff Detail

Event Timeline

tblah created this revision.Jun 30 2023, 10:10 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
tblah requested review of this revision.Jun 30 2023, 10:10 AM
vzakhari accepted this revision.Jun 30 2023, 2:38 PM

Looks good to me. Thank you!

This revision is now accepted and ready to land.Jun 30 2023, 2:38 PM
jeanPerier accepted this revision.Jul 4 2023, 12:17 AM

Looks good to me. If any of these ops get some custom rewrites/inlined implementation from HLFIR, it may be worth adding an explicit attribute on the operations to denote that the fir.box argument should be manipulated with care. But it is probably best to do that when and if these pass are added and the requirement is clearer.

This revision was automatically updated to reflect the committed changes.