[mlir] Apply ClangTidyPerformance findings (NFC)

This commit is contained in:
Adrian Kuegel 2022-07-25 10:49:14 +02:00
parent efe1527e28
commit 07628a94e8
2 changed files with 5 additions and 5 deletions

View File

@ -117,7 +117,7 @@ SmallVector<OpFoldResult> permuteValues(ArrayRef<OpFoldResult> values,
AffineMap map) {
assert(map.isPermutation());
SmallVector<OpFoldResult> permutedValues(values.size());
for (auto position :
for (const auto &position :
llvm::enumerate(llvm::map_range(map.getResults(), [](AffineExpr expr) {
return expr.cast<AffineDimExpr>().getPosition();
})))
@ -334,7 +334,7 @@ DecomposeLinalgOp::matchAndRewrite(GenericOp genericOp,
/// In the split operations, replace block arguments uses that refer to
/// original operation to the block arguments of the newly created operation.
unsigned origNumInputs = genericOp.getNumInputs();
for (auto inputBlockArg :
for (const auto &inputBlockArg :
llvm::enumerate(genericOp.getBody()->getArguments())) {
Value residualOpReplacementArg =
residualGenericOpBody->getArgument(inputBlockArg.index());
@ -356,7 +356,7 @@ DecomposeLinalgOp::matchAndRewrite(GenericOp genericOp,
/// corresponding result have to be remapped to result of the generic op for
/// the peeled operation.
SmallVector<Value> replacements;
for (auto yieldValue : llvm::enumerate(yieldOp->getOperands())) {
for (const auto &yieldValue : llvm::enumerate(yieldOp->getOperands())) {
OpResult opr = yieldValue.value().dyn_cast<OpResult>();
if (!opr || opr.getOwner() != peeledScalarOperation)
replacements.push_back(residualGenericOp.getResult(yieldValue.index()));

View File

@ -160,12 +160,12 @@ struct LinalgOpTilingInterface
if (!indexingMap.isPermutation()) {
SmallVector<Range> iterationDomain =
tilingInterfaceOp.getIterationDomain(b);
for (auto range : llvm::enumerate(iterationDomain)) {
for (const auto &range : llvm::enumerate(iterationDomain)) {
iterationTileOffsets[range.index()] = range.value().offset;
iterationTileSizes[range.index()] = range.value().size;
}
}
for (auto resultExpr : llvm::enumerate(indexingMap.getResults())) {
for (const auto &resultExpr : llvm::enumerate(indexingMap.getResults())) {
unsigned dimPosition =
resultExpr.value().cast<AffineDimExpr>().getPosition();
iterationTileOffsets[dimPosition] = offsets[resultExpr.index()];