Skip to content

[mlir] Remove unused local variables (NFC) #138481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mlir/lib/Dialect/AMDGPU/Transforms/TransferReadToLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ struct TransferReadLowering final : OpRewritePattern<vector::TransferReadOp> {
// It computes the multiplied sizes of all dimensions instead of taking
// the maximum of each dimension size * stride.
SmallVector<AffineExpr> productExpressions;
SmallVector<Value> productResults;
unsigned sourceRank = cast<ShapedType>(src.getType()).getRank();

SmallVector<AffineExpr> symbols(2 * sourceRank);
Expand Down
6 changes: 0 additions & 6 deletions mlir/lib/Dialect/Affine/Analysis/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,12 +1356,6 @@ std::optional<int64_t> MemRefRegion::getRegionSize() {
return false;
}

// Indices to use for the DmaStart op.
// Indices for the original memref being DMAed from/to.
SmallVector<Value, 4> memIndices;
// Indices for the faster buffer being DMAed into/from.
SmallVector<Value, 4> bufIndices;

// Compute the extents of the buffer.
std::optional<int64_t> numElements = getConstantBoundingSizeAndShape();
if (!numElements) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ SimplifyBoundedAffineOpsOp::apply(transform::TransformRewriter &rewriter,
}
targets.push_back(target);
}
SmallVector<Operation *> transformed;
RewritePatternSet patterns(getContext());
// Canonicalization patterns are needed so that affine.apply ops are composed
// with the remaining affine.min/max ops.
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/Affine/Utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1808,7 +1808,6 @@ mlir::affine::normalizeMemRef(memref::ReinterpretCastOp reinterpretCastOp) {
ArrayRef<int64_t> oldShape = memrefType.getShape();
ValueRange oldSizes = reinterpretCastOp.getSizes();
unsigned idx = 0;
SmallVector<int64_t> newStaticSizes;
OpBuilder b(reinterpretCastOp);
// Collect the map operands which will be used to compute the new normalized
// memref shape.
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/Affine/Utils/ViewLikeInterfaceUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ LogicalResult mlir::affine::mergeOffsetsSizesAndStrides(
combinedStrides[i] = producerStrides[i];
continue;
}
SmallVector<OpFoldResult> offsetSymbols, strideSymbols;
// The combined offset is computed as
// producer_offset + consumer_offset * producer_strides.
combinedOffsets[i] = makeComposedFoldedAffineApply(
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/EmitC/IR/EmitC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@ ParseResult ForOp::parse(OpAsmParser &parser, OperationState &result) {

// Parse the optional initial iteration arguments.
SmallVector<OpAsmParser::Argument, 4> regionArgs;
SmallVector<OpAsmParser::UnresolvedOperand, 4> operands;
regionArgs.push_back(inductionVariable);

// Parse optional type, else assume Index.
Expand Down
3 changes: 0 additions & 3 deletions mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,9 +936,6 @@ ParseResult LaunchOp::parse(OpAsmParser &parser, OperationState &result) {
SmallVector<OpAsmParser::UnresolvedOperand, LaunchOp::kNumConfigOperands>
sizes(LaunchOp::kNumConfigOperands);

// Actual (data) operands passed to the kernel.
SmallVector<OpAsmParser::UnresolvedOperand, 4> dataOperands;

// Region arguments to be created.
SmallVector<OpAsmParser::UnresolvedOperand, 16> regionArgs(
LaunchOp::kNumConfigRegionAttributes);
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,6 @@ static void addBodyWithPayloadOp(OpAsmParser &parser, OperationState &result,
Region *body = result.addRegion();
Block &block = body->emplaceBlock();
b.setInsertionPointToStart(&block);
SmallVector<Value> bbArgs;
for (auto &operand : operands) {
block.addArgument(
llvm::cast<ShapedType>(operand.getType()).getElementType(),
Expand Down
2 changes: 0 additions & 2 deletions mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2288,7 +2288,6 @@ transform::ScalarizeOp::applyToOne(transform::TransformRewriter &rewriter,
}
return tileSizes;
});
SmallVector<int64_t> emptyTileSizes;
rewriter.setInsertionPoint(target);
FailureOr<scf::SCFTilingResult> maybeTilingResult = tileUsingSCF(
rewriter, cast<TilingInterface>(target.getOperation()), tilingOptions);
Expand Down Expand Up @@ -2347,7 +2346,6 @@ transform::RewriteInDestinationPassingStyleOp::applyToOne(
transform::TransformRewriter &rewriter, Operation *target,
transform::ApplyToEachResultList &results,
transform::TransformState &state) {
SmallVector<Operation *> res;
rewriter.setInsertionPoint(target);
FailureOr<Operation *> maybeResult =
TypeSwitch<Operation *, FailureOr<Operation *>>(target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ fuseWithReshapeByExpansion(LinalgOp linalgOp, Operation *reshapeOp,
"preconditions for fuse operation failed");

Location loc = linalgOp.getLoc();
SmallVector<OpFoldResult> expandedShape, collapsedShape;
SmallVector<OpFoldResult> expandedShape;
SmallVector<AffineMap, 4> reassociationIndices;
Value src;
if (auto expandingReshapeOp = dyn_cast<tensor::ExpandShapeOp>(reshapeOp)) {
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ getShapeDefiningLoopRange(LinalgOp op, unsigned loopDepth,
<< opOperand.getOperandNumber() << "\n");
LLVM_DEBUG(llvm::dbgs()
<< "getShapeDefiningLoopRange map: " << map << "\n");
SmallVector<Value, 8> shapeRanges(map.getNumResults(), nullptr);
for (const auto &en : llvm::enumerate(map.getResults())) {
auto dimExpr = dyn_cast<AffineDimExpr>(en.value());
if (!dimExpr)
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ FailureOr<PromotionInfo> mlir::linalg::promoteSubviewAsNewBuffer(
partialSizes.push_back(
b.createOrFold<memref::DimOp>(loc, subView, resultDimIdx++));
}
SmallVector<int64_t, 4> dynSizes(fullSizes.size(), ShapedType::kDynamic);
// If a callback is not specified, then use the default implementation for
// allocating the promoted buffer.
std::optional<Value> fullLocalView =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,6 @@ struct UnPackOpTiling
loc, unPackOp.getDest(), outputOffsets, outputSizes, strides);
tiledOperands.push_back(extractDestSlice);

SmallVector<OpFoldResult> inputOffsets, inputSizes;
strides.append(unPackOp.getSourceRank() - outputRank, oneAttr);
// Create slice of the source operand.
auto extractSourceSlice = b.create<tensor::ExtractSliceOp>(
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Type mlir::memref::getTensorTypeFromMemRefType(Type type) {
OpFoldResult memref::getMixedSize(OpBuilder &builder, Location loc, Value value,
int64_t dim) {
auto memrefType = llvm::cast<MemRefType>(value.getType());
SmallVector<OpFoldResult> result;
if (memrefType.isDynamicDim(dim))
return builder.createOrFold<memref::DimOp>(loc, value, dim);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,6 @@ getCollapsedStride(memref::CollapseShapeOp collapseShape, OpBuilder &builder,

auto [strides, offset] = sourceType.getStridesAndOffset();

SmallVector<OpFoldResult> groupStrides;
ArrayRef<int64_t> srcShape = sourceType.getShape();

OpFoldResult lastValidStride = nullptr;
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ resolveSourceIndicesCollapseShape(Location loc, PatternRewriter &rewriter,
ValueRange indices,
SmallVectorImpl<Value> &sourceIndices) {
int64_t cnt = 0;
SmallVector<Value> tmp(indices.size());
SmallVector<OpFoldResult> dynamicIndices;
for (ArrayRef<int64_t> groups : collapseShapeOp.getReassociationIndices()) {
assert(!groups.empty() && "association indices groups cannot be empty");
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ MeshSharding getSharding(OpResult result, const ShardingOption &shardingOption,

// process the split axes
for (auto it : llvm::enumerate(map.getResults())) {
SmallVector<MeshAxis> tmp_axes;
AffineExpr expr = it.value();
// `expr` must be an `AffineDimExpr` because `map` is verified by
// isProjectedPermutation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ struct IndexSwitchOpInterface
int64_t resultNum = cast<OpResult>(value).getResultNumber();

// Helper function to get buffer type of a case.
SmallVector<BaseMemRefType> yieldedTypes;
auto getYieldedBufferType = [&](Block &b) -> FailureOr<BaseMemRefType> {
auto yieldOp = cast<scf::YieldOp>(b.getTerminator());
Value yieldedValue = yieldOp->getOperand(resultNum);
Expand Down
4 changes: 0 additions & 4 deletions mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,6 @@ static LogicalResult generateLoopNestUsingForallOp(
assert(loopRanges.size() == tileSizes.size() &&
"expected as many tile sizes as loop ranges");
OpBuilder::InsertionGuard guard(rewriter);
SmallVector<OpFoldResult> offsets(loopRanges.size()),
sizes(loopRanges.size());

std::optional<ArrayAttr> mappingAttr;
if (!mappingVector.empty())
Expand Down Expand Up @@ -865,7 +863,6 @@ FailureOr<LoopLikeOpInterface> yieldTiledValuesAndReplaceLoop(
static LogicalResult addInitOperandsToLoopNest(
RewriterBase &rewriter, MutableArrayRef<LoopLikeOpInterface> loops,
ValueRange newInitValues, YieldTiledValuesFn getNewTiledYieldsFn) {
SmallVector<scf::ForOp> newLoops;
if (loops.empty())
return success();
OpBuilder::InsertionGuard g(rewriter);
Expand Down Expand Up @@ -1535,7 +1532,6 @@ mlir::scf::tileConsumerAndFuseProducersUsingSCF(

// 1. First tile the consumer.
SetVector<Operation *> fusedProducers, tiledAndFusedOps;
llvm::SmallDenseMap<Value, size_t> origProducerToLoopResultNum;

FailureOr<scf::SCFTilingResult> tilingResult =
tileUsingSCF(rewriter, consumer, options.tilingOptions);
Expand Down
2 changes: 0 additions & 2 deletions mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,6 @@ void spirv::EntryPointOp::build(OpBuilder &builder, OperationState &state,
ParseResult spirv::EntryPointOp::parse(OpAsmParser &parser,
OperationState &result) {
spirv::ExecutionModel execModel;
SmallVector<OpAsmParser::UnresolvedOperand, 0> identifiers;
SmallVector<Type, 0> idTypes;
SmallVector<Attribute, 4> interfaceVars;

FlatSymbolRefAttr fn;
Expand Down
1 change: 0 additions & 1 deletion mlir/lib/Dialect/SPIRV/IR/SPIRVParsingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ ParseResult
parseEnumKeywordAttr(EnumClass &value, ParserType &parser,
StringRef attrName = spirv::attributeName<EnumClass>()) {
StringRef keyword;
SmallVector<NamedAttribute, 1> attr;
auto loc = parser.getCurrentLocation();
if (parser.parseKeyword(&keyword))
return failure();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,6 @@ static LogicalResult rewrite2To4SpMM(PatternRewriter &rewriter,
.getAsyncToken();
token = rewriter.create<gpu::DestroyDnTensorOp>(loc, tokenTp, token, dnC)
.getAsyncToken();
SmallVector<Value> newDynamicSizes;
token = genDeallocMemRef(rewriter, loc, buffer1, token);
token = genDeallocMemRef(rewriter, loc, buffer2, token);
token = genDeallocMemRef(rewriter, loc, buffer3, token);
Expand Down
2 changes: 0 additions & 2 deletions mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ Operation *TensorDialect::materializeConstant(OpBuilder &builder,
OpFoldResult tensor::getMixedSize(OpBuilder &builder, Location loc, Value value,
int64_t dim) {
auto tensorType = llvm::cast<RankedTensorType>(value.getType());
SmallVector<OpFoldResult> result;
if (tensorType.isDynamicDim(dim))
return builder.createOrFold<tensor::DimOp>(loc, value, dim);

Expand Down Expand Up @@ -1703,7 +1702,6 @@ OpFoldResult ReshapeOp::fold(FoldAdaptor adaptor) {
if (auto dimOp = element.getDefiningOp<tensor::DimOp>()) {
dynamicNoop &= dimOp.getSource() == source;

APSInt dim;
auto cst = getConstantIntValue(dimOp.getIndex());
dynamicNoop &=
cst.has_value() && cst.value() == static_cast<int64_t>(id);
Expand Down