mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 12:39:19 +00:00
[MLIR] Change return type of ParallelOp::getInductionVars to ValueRange.
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
This commit is contained in:
parent
6000478f39
commit
c2d03e4ef1
@ -312,10 +312,7 @@ def ParallelOp : Loop_Op<"parallel",
|
||||
|
||||
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(); }
|
||||
|
@ -130,8 +130,8 @@ static void mapParallelOp(ParallelOp parallelOp,
|
||||
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()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user