[Mlir-commits] [mlir] a91ade0 - [mlir] Apply ClangTidy performance fixes (NFC)
Adrian Kuegel
llvmlistbot at llvm.org
Mon Feb 28 04:18:22 PST 2022
Author: Adrian Kuegel
Date: 2022-02-28T13:18:10+01:00
New Revision: a91ade0ba6da9abefbb712656340975df6099ea1
URL: https://github.com/llvm/llvm-project/commit/a91ade0ba6da9abefbb712656340975df6099ea1
DIFF: https://github.com/llvm/llvm-project/commit/a91ade0ba6da9abefbb712656340975df6099ea1.diff
LOG: [mlir] Apply ClangTidy performance fixes (NFC)
Added:
Modified:
mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
index 3493f4e3c7598..26baea0f16c24 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp
@@ -1205,14 +1205,14 @@ static bool isDimSequencePreserved(AffineMap indexingMap,
sequenceElements.insert(dimSequence.begin(), dimSequence.end());
unsigned dimSequenceStart = dimSequence[0];
- for (auto expr : enumerate(indexingMap.getResults())) {
+ for (const auto &expr : enumerate(indexingMap.getResults())) {
unsigned dimInMapStart = expr.value().cast<AffineDimExpr>().getPosition();
// 1. Check if this start of the sequence.
if (dimInMapStart == dimSequenceStart) {
if (expr.index() + dimSequence.size() > indexingMap.getNumResults())
return false;
// 1a. Check if sequence is preserved.
- for (auto dimInSequence : enumerate(dimSequence)) {
+ for (const auto &dimInSequence : enumerate(dimSequence)) {
unsigned dimInMap =
indexingMap.getResult(expr.index() + dimInSequence.index())
.cast<AffineDimExpr>()
@@ -1289,7 +1289,7 @@ class CollapsingInfo {
public:
CollapsingInfo(SmallVector<ReassociationIndices> &&reassociation) {
iterationReassociation = std::move(reassociation);
- for (auto foldedIterDims : enumerate(iterationReassociation)) {
+ for (const auto &foldedIterDims : enumerate(iterationReassociation)) {
foldedDimStartToSequenceMap[foldedIterDims.value()[0]] =
foldedIterDims.index();
}
@@ -1534,7 +1534,7 @@ fuseWithReshapeByCollapsing(GenericOp genericOp, Operation *reshapeOp,
// Insert expanding reshape for the result to get back the original result
// type.
SmallVector<Value> results;
- for (auto originalResult : llvm::enumerate(genericOp->getResults())) {
+ for (const auto &originalResult : llvm::enumerate(genericOp->getResults())) {
Value collapsedOpResult =
collapsedGenericOp->getResult(originalResult.index());
auto originalResultType =
More information about the Mlir-commits
mailing list