Page MenuHomePhabricator

[mlir] NFC - Rename OpFoldResult -> ValueOrAttr
Needs ReviewPublic

Authored by nicolasvasilache on Feb 16 2021, 2:06 AM.

Details

Summary

ValueOrAttr is more generally informative: this type is useful beyond folding.

Diff Detail

Event Timeline

nicolasvasilache requested review of this revision.Feb 16 2021, 2:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 16 2021, 2:06 AM
ftynse added inline comments.Feb 16 2021, 2:14 AM
mlir/include/mlir/IR/OpDefinition.h
218

Please update the documentation.

I would also consider moving this into a separate file. I suppose we don't want Attribute.h to depend on Value.h or vice versa, neither do we want to include OpDefinition.h in files that are not defining ops but just want to use this utility.

silvas added inline comments.Feb 16 2021, 10:49 AM
mlir/include/mlir/IR/OpDefinition.h
218

Is the plan here that this is just a dumb union, or that it carries semantics: either a Value or an attr that needs to be materialized with an appropriate constant materialization hook (from which dialect??) into a Value.

I don't know about changing the name just because the elements the type has makes it useful in other context. In this case the name is quite descriptive for me: these are potential results from folding. E.g., IntPair vs SliceStartAndEnd, both could be a std::pair of ints, but I wouldn't rename the latter to the former to enable reuse with, say, LineAndColPair.