diff --git a/mlir/include/mlir/IR/Block.h b/mlir/include/mlir/IR/Block.h --- a/mlir/include/mlir/IR/Block.h +++ b/mlir/include/mlir/IR/Block.h @@ -107,10 +107,6 @@ void eraseArgument(unsigned index); /// Erases 'num' arguments from the index 'start'. void eraseArguments(unsigned start, unsigned num); - /// Erases the arguments listed in `argIndices` and removes them from the - /// argument list. - /// `argIndices` is allowed to have duplicates and can be in any order. - void eraseArguments(ArrayRef argIndices); /// Erases the arguments that have their corresponding bit set in /// `eraseIndices` and removes them from the argument list. void eraseArguments(const BitVector &eraseIndices); diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp --- a/mlir/lib/Dialect/SCF/IR/SCF.cpp +++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp @@ -3219,21 +3219,21 @@ // Collect results mapping, new terminator args and new result types. SmallVector newYields; SmallVector newInits; - SmallVector argsToErase; + llvm::BitVector argsToErase(op.getBeforeArguments().size()); for (const auto &it : llvm::enumerate(llvm::zip( op.getBeforeArguments(), yield.getOperands(), op.getInits()))) { Value beforeArg = std::get<0>(it.value()); Value yieldValue = std::get<1>(it.value()); Value initValue = std::get<2>(it.value()); if (beforeArg.use_empty()) { - argsToErase.push_back(it.index()); + argsToErase.set(it.index()); } else { newYields.emplace_back(yieldValue); newInits.emplace_back(initValue); } } - if (argsToErase.empty()) + if (argsToErase.none()) return failure(); rewriter.startRootUpdate(op); diff --git a/mlir/lib/IR/Block.cpp b/mlir/lib/IR/Block.cpp --- a/mlir/lib/IR/Block.cpp +++ b/mlir/lib/IR/Block.cpp @@ -195,13 +195,6 @@ arg.setArgNumber(start++); } -void Block::eraseArguments(ArrayRef argIndices) { - BitVector eraseIndices(getNumArguments()); - for (unsigned i : argIndices) - eraseIndices.set(i); - eraseArguments(eraseIndices); -} - void Block::eraseArguments(const BitVector &eraseIndices) { eraseArguments( [&](BlockArgument arg) { return eraseIndices.test(arg.getArgNumber()); });