This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Update Values to use new casting infra
ClosedPublic

Authored by nkreeger on Oct 13 2022, 5:21 AM.

Details

Summary

This allows for using the llvm namespace cast methods instead of the ones on the Value class. The Value class method are kept for now, but we'll want to remove these eventually (with a really long lead time).

Related change: https://reviews.llvm.org/D134327

Diff Detail

Event Timeline

nkreeger created this revision.Oct 13 2022, 5:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2022, 5:21 AM
nkreeger requested review of this revision.Oct 13 2022, 5:21 AM
lattner accepted this revision.Oct 13 2022, 8:17 AM
lattner added a subscriber: lattner.

Awesome!! Please adopt this in a few places just to exercise the new logic. a wholesale swapover can be done in a separate patch, but it is good to show that the new syntax works.

This revision is now accepted and ready to land.Oct 13 2022, 8:17 AM
nkreeger updated this revision to Diff 467667.Oct 13 2022, 8:00 PM

Updated to include a few internal use-cases. Deferring wholesale changes to a later date (like the other MLIR casting changes).

nkreeger updated this revision to Diff 467676.Oct 13 2022, 8:50 PM
rriddle accepted this revision.Oct 13 2022, 8:55 PM
rriddle added inline comments.
mlir/include/mlir/IR/Value.h
568–574

This comment doesn't look applicable here. Values don't cast using TypeID.

lattner accepted this revision.Oct 13 2022, 9:10 PM

awesome, thank you!

bzcheeseman accepted this revision.Oct 13 2022, 10:45 PM

LGTM with river's comment applied about the code comment. Thanks nick!

nkreeger updated this revision to Diff 467742.Oct 14 2022, 4:55 AM

Updated comment to clarify Value uses getKind() instead of getTypeID() inside of Value::classof.

nkreeger marked an inline comment as done.Oct 14 2022, 4:55 AM
nkreeger added inline comments.
mlir/include/mlir/IR/Value.h
568–574

This comment doesn't look applicable here. Values don't cast using TypeID.

ack - done

This revision was automatically updated to reflect the committed changes.