This is an archive of the discontinued LLVM Phabricator instance.

[flang][hlfir] `hlfir.char_extremum` lowering
ClosedPublic

Authored by cabreraam on Jun 8 2023, 3:21 PM.

Details

Summary

This patch implements the lowering for the hlfir.char_extremum operation.

Discussion for this patch can be found in the draft patch here. The reason
for not promoting this draft to a true patch for review was because I needed to separate the op
definition/codegen and lowering into two separate patches, as preferred by @jeanPerier.

Depends on D152474

Diff Detail

Event Timeline

cabreraam created this revision.Jun 8 2023, 3:21 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 8 2023, 3:21 PM
cabreraam requested review of this revision.Jun 8 2023, 3:21 PM

Thank you for working on this! There seems to be missing dependency on the patch that defines the operation.

flang/lib/Lower/ConvertCall.cpp
1369

Isn't Fortran::lower::convertToValue more suitable here?

cabreraam added a comment.EditedJun 8 2023, 8:46 PM

Thank you for working on this! There seems to be missing dependency on the patch that defines the operation.

Yes! Here is the patch that this current patch depends on.
Is there a better way to show the dependency of this patch on the other patch that I linked?

Just FYI, the buildbot fails on this patch because of the dependency of D152474.

Thank you for working on this! There seems to be missing dependency on the patch that defines the operation.

Yes! Here is the patch that this current patch depends on.
Is there a better way to show the dependency of this patch on the other patch that I linked?

Just FYI, the buildbot fails on this patch because of the dependency of D152474.

The easiest way to add the dependency is to put Depends on D#### into the summary above. Next time you can do it right at the creation of the new differential, so that the pre-commit testing kicks in with the right dependencies.

Alternatively, you will find Edit Related Revisions... at the top right.

cabreraam edited the summary of this revision. (Show Details)Jun 9 2023, 10:58 AM
cabreraam edited the summary of this revision. (Show Details)
tblah added a comment.Jun 12 2023, 2:18 AM

LGTM once other reviewers are happy

cabreraam added inline comments.Jun 15 2023, 7:48 PM
flang/lib/Lower/ConvertCall.cpp
1369

I see that convertToValue is used in a different place in ConvertCall.cpp, i.e., in genIntrinsicRefCore for a similar reason to what I'm doing here, so I take your point @vzakhari. My only thought is that this lambda function is expected to return SmallVector<mlir::Value> whereas convertToValue would necessitate SmallVector<fir::ExtendedValue> since convertToValue returns fir::ExtendedValue. @tblah or @jeanPerier, care to weigh in?

tblah added inline comments.Jun 19 2023, 2:46 AM
flang/lib/Lower/ConvertCall.cpp
1369

As of https://reviews.llvm.org/D153252, loadTrivialScalar will just be a convertToValue then converting it to an extended value. I think loadTrivialScalar is fine here.

jeanPerier accepted this revision.Jun 21 2023, 6:54 AM

Thanks, LGTM!

This revision is now accepted and ready to land.Jun 21 2023, 6:54 AM
This revision was automatically updated to reflect the committed changes.