Skip to content

Commit 6ac75fd

Browse files
committed
[fixup] Reduce auto usage, drop obsolete variable
Signed-off-by: Artem Gindinson <[email protected]>
1 parent bfb52df commit 6ac75fd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mlir/lib/Dialect/Utils/ReshapeOpsUtils.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,7 @@ findReassociationRangesForCollapse(ArrayRef<int64_t> sourceShape,
217217
int64_t targetSize = targetShape[targetDimIdx];
218218
// Simply check if there are any subsequent target dimensions left - if not,
219219
// the match must be made greedily.
220-
bool isLastTargetDim = targetDimIdx == numTargetDims - 1;
221-
bool shouldMatchGreedily = isLastTargetDim;
220+
bool shouldMatchGreedily = targetDimIdx == numTargetDims - 1;
222221
FailureOr<ReassociationIndexRange> sourceRange;
223222
if (targetSize == ShapedType::kDynamic) {
224223
sourceRange = findReassociationRangeForDynamicDim(
@@ -263,14 +262,15 @@ findReassociationRangesForCollapse(ArrayRef<int64_t> sourceShape,
263262
return findReassociationRangesForCollapse(sourceShape, targetShape);
264263
// FIXME: It would be preferable to avoid the expensive copies. At the moment,
265264
// this approach is chosen for readability of the main implementation.
266-
auto sourceToReverse = sourceShape.vec(), targetToReverse = targetShape.vec();
265+
std::vector<int64_t> sourceToReverse = sourceShape.vec(),
266+
targetToReverse = targetShape.vec();
267267
std::reverse(sourceToReverse.begin(), sourceToReverse.end());
268268
std::reverse(targetToReverse.begin(), targetToReverse.end());
269269
auto invertedRanges =
270270
findReassociationRangesForCollapse(sourceToReverse, targetToReverse);
271271
if (failed(invertedRanges))
272272
return failure();
273-
auto rangesToInvert = *invertedRanges;
273+
SmallVector<ReassociationIndexRange> &rangesToInvert = *invertedRanges;
274274
unsigned numSourceDims = sourceShape.size();
275275
// We have received the ranges for inverted shapes. Now we have to invert
276276
// the ranges back to correspond with the original source shape.
@@ -312,7 +312,7 @@ mlir::getReassociationIndicesForCollapse(ArrayRef<int64_t> sourceShape,
312312
findReassociationRangesForCollapse(sourceShape, targetShape);
313313
if (failed(maybeForwardRanges))
314314
return std::nullopt;
315-
auto &ranges = *maybeForwardRanges;
315+
SmallVector<ReassociationIndexRange> &ranges = *maybeForwardRanges;
316316
// Now do the same in reverse. We need to get another valid reassociation
317317
// through some other strategy, and then compare the results in order to
318318
// disambiguate mixed subshapes, such as:
@@ -328,7 +328,7 @@ mlir::getReassociationIndicesForCollapse(ArrayRef<int64_t> sourceShape,
328328
sourceShape, targetShape, /*iterateRightToLeft=*/true);
329329
if (failed(maybeReverseRanges))
330330
return std::nullopt;
331-
auto &reverseRanges = *maybeReverseRanges;
331+
SmallVector<ReassociationIndexRange> &reverseRanges = *maybeReverseRanges;
332332

333333
if (ranges.size() != numTargetDims || reverseRanges.size() != numTargetDims)
334334
return std::nullopt;
@@ -338,8 +338,8 @@ mlir::getReassociationIndicesForCollapse(ArrayRef<int64_t> sourceShape,
338338
SmallVector<ReassociationIndices> reassociationMap(numTargetDims);
339339
for (unsigned targetDimIdx = 0; targetDimIdx < numTargetDims;
340340
++targetDimIdx) {
341-
auto &range = ranges[targetDimIdx];
342-
auto &reverseRange = reverseRanges[targetDimIdx];
341+
ReassociationIndexRange &range = ranges[targetDimIdx];
342+
ReassociationIndexRange &reverseRange = reverseRanges[targetDimIdx];
343343
// Get non-overlapping indices between the ranges
344344
ReassociationIndices nonMatchingIndices =
345345
range.getNonOverlappingIndicesWith(reverseRange);

0 commit comments

Comments
 (0)