This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Add `Block::eraseArguments` that erases a subrange
ClosedPublic

Authored by Mogball on Aug 29 2022, 2:37 PM.

Details

Summary

This patch adds a an eraseArguments function that erases a subrange of
a block's arguments. This can be used inplace of the terrible pattern

block->eraseArguments(llvm::to_vector(llvm::seq(...)));

Diff Detail

Event Timeline

Mogball created this revision.Aug 29 2022, 2:37 PM
Mogball requested review of this revision.Aug 29 2022, 2:37 PM
Mogball edited the summary of this revision. (Show Details)Aug 29 2022, 2:38 PM
rriddle accepted this revision.Aug 29 2022, 2:44 PM
rriddle added inline comments.
mlir/include/mlir/IR/Block.h
110–113

Is this one used anywhere? Kind of sad that we are growing so many different ways to erase arguments. I wonder if it'd be better to just have an erase method on BlockArgument and drop some of these overloads. Maybe also having a custom BlockArgumentList that has some utility erase methods as well (for batch erasing ranges).

This revision is now accepted and ready to land.Aug 29 2022, 2:44 PM
Mogball added inline comments.Aug 29 2022, 2:58 PM
mlir/include/mlir/IR/Block.h
110–113

This one has exactly one use that could probably be removed in favour of the BitVector one.

This revision was landed with ongoing or failed builds.Aug 29 2022, 3:34 PM
This revision was automatically updated to reflect the committed changes.