/// Erase the argument at 'index' and remove it from the argument list.
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.
rewriter.create<scf::YieldOp>(yield.getLoc(), yield.getInputs());
rewriter.eraseOp(yield);
- headBlock->eraseArguments(
- llvm::to_vector<4>(llvm::seq<unsigned>(0, headBlock->getNumArguments())));
+ headBlock->eraseArguments(0, headBlock->getNumArguments());
}
static void inlineWhileCase(Region &srcRegion, Region &dstRegion,
// "main" induction variable whenc coming from a non-parallel for.
unsigned numIVs = 1;
yieldOp->setOperands(reducedValues);
- newPloop.getBody()->eraseArguments(
- llvm::to_vector<4>(llvm::seq<unsigned>(numIVs, numReductions + numIVs)));
+ newPloop.getBody()->eraseArguments(numIVs, numReductions);
forOp.erase();
return success();
thenBlock.getArgument(ivs.index())
.replaceAllUsesExcept(newIndex, newIndex);
}
- thenBlock.eraseArguments(llvm::to_vector<4>(
- llvm::seq((unsigned)0, thenBlock.getNumArguments())));
+ thenBlock.eraseArguments(0, thenBlock.getNumArguments());
} else {
innerLoop.getRegion().takeBody(op.getRegion());
b.setInsertionPointToStart(innerLoop.getBody());
arg.setArgNumber(index++);
}
+void Block::eraseArguments(unsigned start, unsigned num) {
+ assert(start + num <= arguments.size());
+ for (unsigned i = 0; i < num; ++i)
+ arguments[start + i].destroy();
+ arguments.erase(arguments.begin() + start, arguments.begin() + start + num);
+ for (BlockArgument arg : llvm::drop_begin(arguments, start))
+ arg.setArgNumber(start++);
+}
+
void Block::eraseArguments(ArrayRef<unsigned> argIndices) {
BitVector eraseIndices(getNumArguments());
for (unsigned i : argIndices)