The current return type sometimes leads to code like
to_vector<2>(ValueRange(loop.getInductionIvs())). It would be nice to
shorten it. Users who need access to Block::BlockArgListType (if there
are any), can always call getBody()->getArguments(); if needed.
Also remove getNumInductionVars(), since there is getNumLoops().
Differential Revision: https://reviews.llvm.org/D77526
let extraClassDeclaration = [{
Block *getBody() { return ®ion().front(); }
- unsigned getNumInductionVars() {
- return getBody()->getNumArguments();
- }
- Block::BlockArgListType getInductionVars() {
+ ValueRange getInductionVars() {
return getBody()->getArguments();
}
unsigned getNumLoops() { return step().size(); }
MLIRContext *ctx = parallelOp.getContext();
Builder b(ctx);
SmallVector<ParallelLoopDimMapping, 4> attrs;
- attrs.reserve(parallelOp.getNumInductionVars());
- for (int i = 0, e = parallelOp.getNumInductionVars(); i < e; ++i) {
+ attrs.reserve(parallelOp.getNumLoops());
+ for (int i = 0, e = parallelOp.getNumLoops(); i < e; ++i) {
attrs.push_back(getParallelLoopDimMappingAttr(
getHardwareIdForMapping(mappingLevel, i), b.getDimIdentityMap(),
b.getDimIdentityMap()));