This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] add hlfir.get_extent
ClosedPublic

Authored by tblah on Apr 13 2023, 5:50 AM.

Details

Summary

This operation fetches an extent value from a fir.shape. The operation
could just as easily live in the fir namespace, but is only needed for
hlfir lowering so I put it here.

This operation is required to allow one to defer getting the extents of a shape
generated by hlfir.get_shape until after that shape has been resolved
(after bufferization of the hlfir.expr).

This operation will be lowered to FIR as an arith.constant created using
the definition of the fir.shape argument.

Depends On: D146830

Diff Detail

Event Timeline

tblah created this revision.Apr 13 2023, 5:50 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 13 2023, 5:50 AM
tblah requested review of this revision.Apr 13 2023, 5:50 AM
jeanPerier accepted this revision.Apr 13 2023, 7:15 AM

Thanks a lot for filling the HLFIR gaps here! (the dependency was not set properly for the bot, I think you need to write "Depends on" instead of "Depends On:" in the message to get it set automatically. I added it manually and relaunched the build).

This revision is now accepted and ready to land.Apr 13 2023, 7:15 AM
jeanPerier added inline comments.Apr 13 2023, 7:20 AM
flang/include/flang/Optimizer/HLFIR/HLFIROps.td
796

While I am here, I started adding side effect in my sandbox so that we can leverage some of MLIR analysis. You probably want to add Pure here (it has no memory side effect and is speculatable (can be executed as soon as its operand is ready)).

tblah updated this revision to Diff 513538.Apr 14 2023, 4:23 AM

Add the Pure attribute to the operation definition

tblah marked an inline comment as done.Apr 14 2023, 5:51 AM
jeanPerier accepted this revision.Apr 14 2023, 6:43 AM
This revision was automatically updated to reflect the committed changes.