This is an archive of the discontinued LLVM Phabricator instance.

[fir] Add fir.save_result op
ClosedPublic

Authored by clementval on Sep 24 2021, 5:45 AM.

Details

Summary

Add the fir.save_result operation. It is use to save an
array, box, or record function result SSA-value to a memory location

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>

Diff Detail

Event Timeline

clementval created this revision.Sep 24 2021, 5:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2021, 5:45 AM
Herald added a subscriber: mehdi_amini. · View Herald Transcript
clementval requested review of this revision.Sep 24 2021, 5:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2021, 5:45 AM
jeanPerier accepted this revision.Sep 24 2021, 8:05 AM
This revision is now accepted and ready to land.Sep 24 2021, 8:05 AM
mehdi_amini added inline comments.Sep 24 2021, 9:48 AM
flang/lib/Optimizer/Dialect/FIROps.cpp
1369

Nit: The naming resultType confused me, because this is the input value to the operation and not its result (there aren't any results for this op)

1377

Side note: this is the kind of constraint that could be put in TableGen: right now you declare the value as AnyType but you can define another TypeConstraint there as well. Flang already defines similar constraints like def AnyEmboxArg : Type<AnyEmboxLike.predicate, "embox argument type">;

clementval added inline comments.Sep 25 2021, 6:57 AM
flang/lib/Optimizer/Dialect/FIROps.cpp
1369

It the resultType of the function as mentioned in the description. I'm not sure we can have a better name for that maybe valueType?

mehdi_amini added inline comments.Sep 25 2021, 11:04 AM
flang/lib/Optimizer/Dialect/FIROps.cpp
1369

I guess the op being named "SaveResult" it is doomed to such collision with the usual "result" in the context of operation. Don't sweat it, that's fine as is.

Address review comments

clementval marked 3 inline comments as done.Sep 28 2021, 1:54 AM
This revision was automatically updated to reflect the committed changes.