[mlir][NFC] Use const reference for loop variables.
GitOrigin-RevId: 04d083b19e6eb80587cc27fa3996121c8c4bddbc
diff --git a/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp b/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp
index 61c4f8e..6a75398 100644
--- a/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp
+++ b/lib/Dialect/Linalg/ComprehensiveBufferize/BufferizableOpInterface.cpp
@@ -556,14 +556,14 @@
reifiedShapes = true;
OpResult resultValue = shapedValue.dyn_cast<OpResult>();
auto &shape = resultDims[resultValue.getResultNumber()];
- for (auto dim : enumerate(allocMemRefType.getShape()))
+ for (const auto &dim : enumerate(allocMemRefType.getShape()))
if (ShapedType::isDynamic(dim.value()))
dynShape.push_back(shape[dim.index()]);
}
}
if (!reifiedShapes) {
- for (auto dim : enumerate(allocMemRefType.getShape()))
+ for (const auto &dim : enumerate(allocMemRefType.getShape()))
if (ShapedType::isDynamic(dim.value())) {
assert((shapedValue.getType().isa<UnrankedMemRefType>() ||
shapedValue.getType().isa<MemRefType>()) &&
diff --git a/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp b/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
index 9ed8055..d24e7e8 100644
--- a/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
+++ b/lib/Dialect/Linalg/ComprehensiveBufferize/ModuleBufferization.cpp
@@ -370,7 +370,7 @@
SmallVector<Type> argumentTypes;
// Iterate on each function argument and check it it was marked with a
// desired layout.
- for (auto it : llvm::enumerate(funcOp.getType().getInputs())) {
+ for (const auto &it : llvm::enumerate(funcOp.getType().getInputs())) {
int argNumber = it.index();
Type inputType = it.value();
auto memrefType = inputType.dyn_cast<MemRefType>();