This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] lower hlfir.sum into fir runtime call
ClosedPublic

Authored by tblah on Feb 7 2023, 9:18 AM.

Details

Summary

This duplicates some argument lowering and return value processing from
flang/lib/Lower/ConvertCall.cpp. The existing code in CovertCall lowers
directly into the fir.call (without the hlfir transformational intrinsic
operation), and it is too tied to the lowering code to move into
flang/lib/Optimizer to allow for more complete re-use here.

Diff Detail

Event Timeline

tblah created this revision.Feb 7 2023, 9:18 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 7 2023, 9:18 AM
tblah requested review of this revision.Feb 7 2023, 9:18 AM

Thanks, it's great to see this coming along!

flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
608

resultEntity->isVariable() will be more accurate to test that this is a variable.

631

I am surprised you need to do this. Isn't the pattern rewritter driver setting the insertion point of the rewritter to sum already ?

634

Default kinds are set by the front end and could technically change. It is best to avoid hard coding it here, you can get it here via the kind map: builder.getKindMap().defaultLogicalKind().

647–648

mlir::Type scalarResultType = hlfir::getFortranElementType(sum.getType()); should just work given there is only one result.

tblah updated this revision to Diff 496109.Feb 9 2023, 6:27 AM
tblah marked 4 inline comments as done.

Thanks for reviewing this

Changes:

  • Fix review nits
  • Add tests
tblah retitled this revision from WIP: [flang][hlfir] lower hlfir.sum into fir runtime call to [flang][hlfir] lower hlfir.sum into fir runtime call.Feb 9 2023, 6:27 AM
tblah edited the summary of this revision. (Show Details)
jeanPerier accepted this revision.Feb 10 2023, 12:41 AM

Looks great

This revision is now accepted and ready to land.Feb 10 2023, 12:41 AM
This revision was automatically updated to reflect the committed changes.