This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] Lower char length inquiry via hlfir.get_length.
ClosedPublic

Authored by vzakhari on Jul 5 2023, 8:01 PM.

Details

Summary

ApplyOp provides the type parameters in its argument, so we can
take it from there. For hlfir.expr block arguments (such as with
user-defined assignments) we use hlfir.get_length in lowering.

Depends on D154561

Diff Detail

Event Timeline

vzakhari created this revision.Jul 5 2023, 8:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 5 2023, 8:01 PM
vzakhari requested review of this revision.Jul 5 2023, 8:01 PM
jeanPerier accepted this revision.Jul 6 2023, 12:31 AM

Thanks!

flang/lib/Optimizer/Builder/HLFIRTools.cpp
618

nit: although this is not functionally needed here, so far all the ops are spelled out with hlfir:: in the builder.create.

This revision is now accepted and ready to land.Jul 6 2023, 12:31 AM
tblah added inline comments.Jul 6 2023, 2:40 AM
flang/test/Lower/HLFIR/elemental-array-ops.f90
155

This doesn't generate a hlfir.get_length operation so it isn't immediately clear what is being tested here. Please could you add a comment explaining this test.

vzakhari added inline comments.Jul 6 2023, 8:14 AM
flang/test/Lower/HLFIR/elemental-array-ops.f90
155

I will add a comment. Basically, the test makes sure the length is taken from the ApplyOp (note the return inserted in flang/lib/Optimizer/Builder/HLFIRTools.cpp:615).

vzakhari updated this revision to Diff 537792.Jul 6 2023, 10:52 AM

Addressed review comments.