This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Change Operation::create() methods to use Value/Type/Block ranges.
ClosedPublic

Authored by jurahul on Sep 1 2020, 3:41 PM.

Details

Summary
  • Change Operation::create() methods to use TypeRange for result types, ValueRange for operands and SuccessorRange for successors.
  • Extend SuccessorRange to be able to represent a range of blocks from BlockOperands or from an array of Block pointers.

Diff Detail

Event Timeline

jurahul created this revision.Sep 1 2020, 3:41 PM
Herald added a project: Restricted Project. · View Herald Transcript
jurahul requested review of this revision.Sep 1 2020, 3:41 PM

Thanks!

mlir/include/mlir/IR/BlockSupport.h
58

I would not do this for SuccessorRange. It is intended to have the same limited scope that OperandRange and ResultRange have. If we want something general I would suggest adding a BlockRange instead.

jurahul added inline comments.Sep 1 2020, 4:14 PM
mlir/include/mlir/IR/BlockSupport.h
58

Thanks. I looked into how ResultRange, OperandRange and ValueRange are layered. So I guess your suggestion is to keep SuccessorRange as is, and add a new BlockRange which can work with either a SuccessorRange or an ArrayRef<Block *>, right? And then the Operation::create() functions would use a BlockRange argument for successors.

rriddle added inline comments.Sep 1 2020, 4:21 PM
mlir/include/mlir/IR/BlockSupport.h
58

Yes, exactly.

jurahul updated this revision to Diff 289554.Sep 2 2020, 1:24 PM

Review feedback

bondhugula added inline comments.
mlir/include/mlir/IR/BlockSupport.h
93

Missing doc comment.

jurahul updated this revision to Diff 289591.Sep 2 2020, 3:33 PM

Add comment for BlockRange

jurahul marked an inline comment as done.Sep 2 2020, 3:33 PM
jurahul retitled this revision from [MLIR] Change Operation::create() methods to use Value/Type/Successor ranges. to [MLIR] Change Operation::create() methods to use Value/Type/Block ranges..
rriddle accepted this revision.Sep 7 2020, 2:59 PM

Thanks!

This revision is now accepted and ready to land.Sep 7 2020, 2:59 PM
This revision was landed with ongoing or failed builds.Sep 8 2020, 2:19 PM
This revision was automatically updated to reflect the committed changes.