From 867a0c233cbb4a4eab68784bfedacf8054961b96 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 5 May 2025 11:35:02 -0700 Subject: [PATCH] [mlir] Remove unused local variables (NFC) --- mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp | 1 - mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp | 1 - .../lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp | 4 ---- mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp | 1 - mlir/lib/Dialect/Vector/IR/VectorOps.cpp | 1 - mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp | 2 -- mlir/lib/IR/Verifier.cpp | 1 - mlir/lib/Interfaces/DataLayoutInterfaces.cpp | 1 - mlir/lib/Transforms/Utils/InliningUtils.cpp | 1 - mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp | 1 - mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp | 1 - mlir/tools/mlir-tblgen/RewriterGen.cpp | 1 - mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp | 3 +-- 13 files changed, 1 insertion(+), 18 deletions(-) diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp index ba05a5a000cb9..5275c63eee7f9 100644 --- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp +++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp @@ -784,7 +784,6 @@ createNonLdMatrixLoads(RewriterBase &rewriter, vector::TransferReadOp op, } Value laneId = rewriter.create(loc, /*upperBound=*/nullptr); - SmallVector elements; // This is the individual element type. Type loadedElType = regInfo->registerLLVMType; diff --git a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp index f58385a7777db..59cfce28e07e1 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp @@ -188,7 +188,6 @@ struct ConvertMemRefAllocation final : OpConversionPattern { Location loc = op.getLoc(); OpFoldResult zero = rewriter.getIndexAttr(0); - SmallVector indices(currentType.getRank(), zero); // Get linearized type. int srcBits = currentType.getElementType().getIntOrFloatBitWidth(); diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp index 6e816dc0661a1..a2c6314d2a61e 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp @@ -955,10 +955,6 @@ std::pair sparse_tensor::genCoIteration( // Generates loop body. builder.setInsertionPointToStart(after); ValueRange aArgs = after->getArguments(); - // Since some LoopCondKind might need extra checks to filter out invalid - // iterations, we maintains another array to hold the iteration arguments to - // yield if the checks fails. - SmallVector nextArgs(aArgs.begin(), aArgs.end()); for (SparseIterator *it : spIters) { aArgs = it->linkNewScope(aArgs); diff --git a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp index c0230e0d11e64..10aaf35be2ab7 100644 --- a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp +++ b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp @@ -1659,7 +1659,6 @@ void transform::detail::getPotentialTopLevelEffects( if (!iface) continue; - SmallVector nestedEffects; iface.getEffects(effects); } return; diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp index 0f96442bc3756..f9c7fb7799eb0 100644 --- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp +++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp @@ -1136,7 +1136,6 @@ void ContractionOp::getIterationBounds( auto lhsShape = getLhsType().getShape(); auto resVectorType = llvm::dyn_cast(getResultType()); SmallVector indexingMaps(getIndexingMapsArray()); - SmallVector iterationShape; for (const auto &it : llvm::enumerate(getIteratorTypes())) { // Search lhs/rhs map results for 'targetExpr'. auto targetExpr = getAffineDimExpr(it.index(), getContext()); diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp index 19f408ad1b570..f8a9b399d9209 100644 --- a/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp @@ -878,8 +878,6 @@ struct WarpOpForwardOperand : public WarpDistributionPattern { using Base::Base; LogicalResult matchAndRewrite(WarpExecuteOnLane0Op warpOp, PatternRewriter &rewriter) const override { - SmallVector resultTypes; - SmallVector yieldValues; auto yield = cast( warpOp.getBodyRegion().getBlocks().begin()->getTerminator()); Value valForwarded; diff --git a/mlir/lib/IR/Verifier.cpp b/mlir/lib/IR/Verifier.cpp index 7fe1f54b7c3b1..3ced663a87be1 100644 --- a/mlir/lib/IR/Verifier.cpp +++ b/mlir/lib/IR/Verifier.cpp @@ -179,7 +179,6 @@ LogicalResult OperationVerifier::verifyOnEntrance(Operation &op) { if (!numRegions) return success(); auto kindInterface = dyn_cast(&op); - SmallVector opsWithIsolatedRegions; // Verify that all child regions are ok. MutableArrayRef regions = op.getRegions(); for (unsigned i = 0; i < numRegions; ++i) { diff --git a/mlir/lib/Interfaces/DataLayoutInterfaces.cpp b/mlir/lib/Interfaces/DataLayoutInterfaces.cpp index 9b9bb0c500380..4ac66c3107384 100644 --- a/mlir/lib/Interfaces/DataLayoutInterfaces.cpp +++ b/mlir/lib/Interfaces/DataLayoutInterfaces.cpp @@ -402,7 +402,6 @@ static DataLayoutSpecInterface getCombinedDataLayout(Operation *leaf) { assert((isa(leaf)) && "expected an op with data layout spec"); - SmallVector opsWithLayout; SmallVector specs; collectParentLayouts(leaf, specs); diff --git a/mlir/lib/Transforms/Utils/InliningUtils.cpp b/mlir/lib/Transforms/Utils/InliningUtils.cpp index f654e962d631f..8594136570a76 100644 --- a/mlir/lib/Transforms/Utils/InliningUtils.cpp +++ b/mlir/lib/Transforms/Utils/InliningUtils.cpp @@ -248,7 +248,6 @@ static void handleResultImpl(InlinerInterface &interface, OpBuilder &builder, } // Run the result attribute handler for the given result and attribute. - SmallVector resultAttributes; for (auto [result, resAttr] : llvm::zip(results, resAttrs)) { // Store the original result users before running the handler. DenseSet resultUsers(llvm::from_range, result.getUsers()); diff --git a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp index c32bd24014215..f26058f30ad7b 100644 --- a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp +++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp @@ -239,7 +239,6 @@ void VectorizerTestPass::testVecAffineLoopNest(llvm::raw_ostream &outs) { strategy.vectorSizes.push_back(4 /*vectorization factor*/); strategy.loopToVectorDim[outermostLoop] = 0; - ReductionLoopMap reductionLoops; SmallVector reductions; if (!isLoopParallel(outermostLoop, &reductions)) { outs << "Outermost loop cannot be parallel\n"; diff --git a/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp b/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp index b4f3fa30f8ab5..9eade75ac3163 100644 --- a/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp +++ b/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp @@ -41,7 +41,6 @@ struct TestSCFForUtilsPass void runOnOperation() override { func::FuncOp func = getOperation(); - SmallVector toErase; if (testReplaceWithNewYields) { func.walk([&](scf::ForOp forOp) { diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp index 68772e9a78a1c..58abcc2bee895 100644 --- a/mlir/tools/mlir-tblgen/RewriterGen.cpp +++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp @@ -1847,7 +1847,6 @@ void PatternEmitter::createAggregateLocalVarsForOpArgs( const auto *operand = cast(resultOp.getArg(argIndex)); - std::string varName; if (operand->isVariadic()) { ++numVariadic; std::string range; diff --git a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp index cc0146f9ad0b8..72567057fc5d4 100644 --- a/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp +++ b/mlir/tools/mlir-tblgen/SPIRVUtilsGen.cpp @@ -1180,8 +1180,7 @@ static bool emitSerializationFns(const RecordKeeper &records, raw_ostream &os) { llvm::emitSourceFileHeader("SPIR-V Serialization Utilities/Functions", os, records); - std::string dSerFnString, dDesFnString, serFnString, deserFnString, - utilsString; + std::string dSerFnString, dDesFnString, serFnString, deserFnString; raw_string_ostream dSerFn(dSerFnString), dDesFn(dDesFnString), serFn(serFnString), deserFn(deserFnString); const Record *attrClass = records.getClass("Attr");