[Mlir-commits] [mlir] 0a0aff2 - fix unused variable warnings in conditionals
Mikhail Goncharov
llvmlistbot at llvm.org
Wed Aug 30 10:10:53 PDT 2023
Author: Mikhail Goncharov
Date: 2023-08-30T19:09:27+02:00
New Revision: 0a0aff2d24518b1931a1a333c32a13028a0f88f6
URL: https://github.com/llvm/llvm-project/commit/0a0aff2d24518b1931a1a333c32a13028a0f88f6
DIFF: https://github.com/llvm/llvm-project/commit/0a0aff2d24518b1931a1a333c32a13028a0f88f6.diff
LOG: fix unused variable warnings in conditionals
warning was updated in 92023b15099012a657da07ebf49dd7d94a260f84
Added:
Modified:
mlir/include/mlir/IR/Operation.h
mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Dialect/Affine/IR/AffineOps.cpp
mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
mlir/lib/Dialect/Arith/Utils/Utils.cpp
mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
mlir/lib/IR/Builders.cpp
mlir/lib/IR/BuiltinAttributes.cpp
mlir/lib/IR/BuiltinTypes.cpp
mlir/lib/IR/Diagnostics.cpp
mlir/lib/IR/Operation.cpp
mlir/lib/Parser/Parser.cpp
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/lib/Tools/PDLL/Parser/Parser.cpp
mlir/lib/Transforms/Inliner.cpp
mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
mlir/tools/mlir-tblgen/OpFormatGen.cpp
mlir/tools/mlir-tblgen/RewriterGen.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h
index fbded011645c76..79e493022e0dbd 100644
--- a/mlir/include/mlir/IR/Operation.h
+++ b/mlir/include/mlir/IR/Operation.h
@@ -542,7 +542,7 @@ class alignas(8) Operation final
/// value. Otherwise, add a new attribute with the specified name/value.
void setAttr(StringAttr name, Attribute value) {
if (getPropertiesStorageSize()) {
- if (std::optional<Attribute> inherentAttr = getInherentAttr(name)) {
+ if (getInherentAttr(name)) {
setInherentAttr(name, value);
return;
}
diff --git a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
index 2d2a2bff7013c6..522e6d548722c8 100644
--- a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
@@ -613,7 +613,7 @@ LLVMTypeConverter::promoteOperands(Location loc, ValueRange opOperands,
if (useBarePtrCallConv) {
// For the bare-ptr calling convention, we only have to extract the
// aligned pointer of a memref.
- if (auto memrefType = dyn_cast<MemRefType>(operand.getType())) {
+ if (dyn_cast<MemRefType>(operand.getType())) {
MemRefDescriptor desc(llvmOperand);
llvmOperand = desc.alignedPtr(builder, loc);
} else if (isa<UnrankedMemRefType>(operand.getType())) {
diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
index 9bd0797a5ccb79..ddf96c60962a5b 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
@@ -826,7 +826,7 @@ struct RankOpLowering : public ConvertOpToLLVMPattern<memref::RankOp> {
ConversionPatternRewriter &rewriter) const override {
Location loc = op.getLoc();
Type operandType = op.getMemref().getType();
- if (auto unrankedMemRefType = dyn_cast<UnrankedMemRefType>(operandType)) {
+ if (dyn_cast<UnrankedMemRefType>(operandType)) {
UnrankedMemRefDescriptor desc(adaptor.getMemref());
rewriter.replaceOp(op, {desc.rank(rewriter, loc)});
return success();
diff --git a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
index 9d7b8f371a26c6..9d262c7c204e6d 100644
--- a/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
+++ b/mlir/lib/Dialect/Affine/IR/AffineOps.cpp
@@ -2170,7 +2170,7 @@ static void printBound(AffineMapAttr boundMap,
// Print bound that consists of a single SSA symbol if the map is over a
// single symbol.
if (map.getNumDims() == 0 && map.getNumSymbols() == 1) {
- if (auto symExpr = expr.dyn_cast<AffineSymbolExpr>()) {
+ if (expr.dyn_cast<AffineSymbolExpr>()) {
p.printOperand(*boundOperands.begin());
return;
}
diff --git a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
index 2a9416f39f2fda..d85dfc3e25c4e3 100644
--- a/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/LoopFusion.cpp
@@ -240,7 +240,7 @@ bool MemRefDependenceGraph::init() {
DenseMap<Operation *, unsigned> forToNodeMap;
for (Operation &op : block) {
- if (auto forOp = dyn_cast<AffineForOp>(op)) {
+ if (dyn_cast<AffineForOp>(op)) {
// Create graph node 'id' to represent top-level 'forOp' and record
// all loads and store accesses it contains.
LoopNestStateCollector collector;
@@ -262,14 +262,14 @@ bool MemRefDependenceGraph::init() {
}
forToNodeMap[&op] = node.id;
nodes.insert({node.id, node});
- } else if (auto loadOp = dyn_cast<AffineReadOpInterface>(op)) {
+ } else if (dyn_cast<AffineReadOpInterface>(op)) {
// Create graph node for top-level load op.
Node node(nextNodeId++, &op);
node.loads.push_back(&op);
auto memref = cast<AffineReadOpInterface>(op).getMemRef();
memrefAccesses[memref].insert(node.id);
nodes.insert({node.id, node});
- } else if (auto storeOp = dyn_cast<AffineWriteOpInterface>(op)) {
+ } else if (dyn_cast<AffineWriteOpInterface>(op)) {
// Create graph node for top-level store op.
Node node(nextNodeId++, &op);
node.stores.push_back(&op);
diff --git a/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
index 4a4b6eee24a587..70aba4cedc7f30 100644
--- a/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
+++ b/mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp
@@ -605,7 +605,7 @@ bool mlir::affine::getFusionComputeCost(AffineForOp srcForOp,
// 'insertPointParent'.
for (Value memref : storeMemrefs) {
for (auto *user : memref.getUsers()) {
- if (auto loadOp = dyn_cast<AffineReadOpInterface>(user)) {
+ if (dyn_cast<AffineReadOpInterface>(user)) {
SmallVector<AffineForOp, 4> loops;
// Check if any loop in loop nest surrounding 'user' is
// 'insertPointParent'.
diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
index 1a50b4ad5598f6..9e783c51c63d1d 100644
--- a/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
@@ -63,7 +63,7 @@ static Value createScalarOrSplatConstant(ConversionPatternRewriter &rewriter,
Location loc, Type type,
const APInt &value) {
TypedAttr attr;
- if (auto intTy = dyn_cast<IntegerType>(type)) {
+ if (dyn_cast<IntegerType>(type)) {
attr = rewriter.getIntegerAttr(type, value);
} else {
auto vecTy = cast<VectorType>(type);
diff --git a/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp b/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
index f7303a479449b7..906c13a6579f15 100644
--- a/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
@@ -81,7 +81,7 @@ struct NarrowingPattern : OpRewritePattern<SourceOp> {
return newElemTy;
if (auto shapedTy = dyn_cast<ShapedType>(origTy))
- if (auto elemTy = dyn_cast<IntegerType>(shapedTy.getElementType()))
+ if (dyn_cast<IntegerType>(shapedTy.getElementType()))
return shapedTy.clone(shapedTy.getShape(), newElemTy);
return failure();
@@ -113,9 +113,9 @@ class ExtensionOp {
/// wrapper when `op` is either `arith.extsi` or `arith.extui`, and failure
/// otherwise.
static FailureOr<ExtensionOp> from(Operation *op) {
- if (auto sext = dyn_cast_or_null<arith::ExtSIOp>(op))
+ if (dyn_cast_or_null<arith::ExtSIOp>(op))
return ExtensionOp{op, ExtensionKind::Sign};
- if (auto zext = dyn_cast_or_null<arith::ExtUIOp>(op))
+ if (dyn_cast_or_null<arith::ExtUIOp>(op))
return ExtensionOp{op, ExtensionKind::Zero};
return failure();
diff --git a/mlir/lib/Dialect/Arith/Utils/Utils.cpp b/mlir/lib/Dialect/Arith/Utils/Utils.cpp
index d5d337a6aa35ee..0f39c24fb917d8 100644
--- a/mlir/lib/Dialect/Arith/Utils/Utils.cpp
+++ b/mlir/lib/Dialect/Arith/Utils/Utils.cpp
@@ -134,7 +134,7 @@ static Value convertScalarToComplexDtype(ImplicitLocOpBuilder &b, Value operand,
}
}
- if (auto fromFpType = dyn_cast<FloatType>(operand.getType())) {
+ if (dyn_cast<FloatType>(operand.getType())) {
FloatType toFpTy = cast<FloatType>(targetType.getElementType());
auto toBitwidth = toFpTy.getIntOrFloatBitWidth();
Value from = operand;
@@ -149,7 +149,7 @@ static Value convertScalarToComplexDtype(ImplicitLocOpBuilder &b, Value operand,
return b.create<complex::CreateOp>(targetType, from, zero);
}
- if (auto fromIntType = dyn_cast<IntegerType>(operand.getType())) {
+ if (dyn_cast<IntegerType>(operand.getType())) {
FloatType toFpTy = cast<FloatType>(targetType.getElementType());
Value from = operand;
if (isUnsigned) {
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
index 04f131ec51cb48..5cc30b629aef47 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncRuntimeRefCounting.cpp
@@ -533,15 +533,15 @@ void AsyncRuntimePolicyBasedRefCountingPass::initializeDefaultPolicy() {
bool isValue = isa<ValueType>(type);
// Drop reference after async token or group error check (coro await).
- if (auto await = dyn_cast<RuntimeIsErrorOp>(op))
+ if (dyn_cast<RuntimeIsErrorOp>(op))
return (isToken || isGroup) ? -1 : 0;
// Drop reference after async value load.
- if (auto load = dyn_cast<RuntimeLoadOp>(op))
+ if (dyn_cast<RuntimeLoadOp>(op))
return isValue ? -1 : 0;
// Drop reference after async token added to the group.
- if (auto add = dyn_cast<RuntimeAddToGroupOp>(op))
+ if (dyn_cast<RuntimeAddToGroupOp>(op))
return isToken ? -1 : 0;
return 0;
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
index afac36fa9c6d71..568dde6919471c 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/FuncBufferizableOpInterfaceImpl.cpp
@@ -347,7 +347,7 @@ struct FuncOpInterface
SmallVector<Type> argTypes;
for (const auto &it : llvm::enumerate(funcType.getInputs())) {
Type argType = it.value();
- if (auto tensorType = dyn_cast<TensorType>(argType)) {
+ if (dyn_cast<TensorType>(argType)) {
argTypes.push_back(
getBufferizedFunctionArgType(funcOp, it.index(), options));
continue;
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
index 0426d5dcb25e38..3ee54249e8c393 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
@@ -763,7 +763,7 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
return handleByValArgument(builder, callable, argument, elementType,
requestedAlignment);
}
- if (std::optional<NamedAttribute> attr =
+ if ([[maybe_unused]] std::optional<NamedAttribute> attr =
argumentAttrs.getNamed(LLVM::LLVMDialect::getNoAliasAttrName())) {
if (argument.use_empty())
return argument;
diff --git a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
index 68b72eff8c9738..5b789da37aa7a2 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/IndependenceTransforms.cpp
@@ -152,7 +152,7 @@ static void replaceAndPropagateMemRefType(RewriterBase &rewriter,
// This may have to be revised in the future; e.g., there may be ops that
// do not support non-identity layout maps.
for (OpOperand &operand : user->getOpOperands()) {
- if (auto castOp =
+ if ([[maybe_unused]] auto castOp =
operand.get().getDefiningOp<UnrealizedConversionCastOp>()) {
rewriter.updateRootInPlace(
user, [&]() { operand.set(conversion->getOperand(0)); });
diff --git a/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp b/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp
index 5ee53eaad58506..408701f80444a1 100644
--- a/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp
+++ b/mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp
@@ -36,7 +36,7 @@ Type ExpressedToQuantizedConverter::convert(QuantizedType elementalType) const {
assert(expressedType && "convert() on unsupported conversion");
if (auto tensorType = dyn_cast<RankedTensorType>(inputType))
return RankedTensorType::get(tensorType.getShape(), elementalType);
- if (auto tensorType = dyn_cast<UnrankedTensorType>(inputType))
+ if (dyn_cast<UnrankedTensorType>(inputType))
return UnrankedTensorType::get(elementalType);
if (auto vectorType = dyn_cast<VectorType>(inputType))
return VectorType::get(vectorType.getShape(), elementalType);
diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
index 614f39b5d29190..5c90e7e7599ef8 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
@@ -3712,7 +3712,7 @@ bool areTilesAndTiledDimsAllConstant(OpTy op) {
}
Speculation::Speculatability PackOp::getSpeculatability() {
- if (auto paddingValue = getPaddingValue())
+ if (getPaddingValue())
return Speculation::Speculatable;
// The verifier rejects already operations if we can statically prove that the
diff --git a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
index a1451fbf7f31d3..467a521f9eada9 100644
--- a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
+++ b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
@@ -165,7 +165,7 @@ static SetVector<Operation *> getParentsOfType(Block *block) {
SetVector<Operation *> res;
auto *current = block->getParentOp();
while (current) {
- if (auto typedParent = dyn_cast<T>(current)) {
+ if ([[maybe_unused]] auto typedParent = dyn_cast<T>(current)) {
assert(res.count(current) == 0 && "Already inserted");
res.insert(current);
}
diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp
index b8a98eddfd784d..ab20f4863e11c2 100644
--- a/mlir/lib/IR/Builders.cpp
+++ b/mlir/lib/IR/Builders.cpp
@@ -333,7 +333,7 @@ TypedAttr Builder::getZeroAttr(Type type) {
return getFloatAttr(type, 0.0);
if (llvm::isa<IndexType>(type))
return getIndexAttr(0);
- if (auto integerType = llvm::dyn_cast<IntegerType>(type))
+ if (llvm::dyn_cast<IntegerType>(type))
return getIntegerAttr(type,
APInt(llvm::cast<IntegerType>(type).getWidth(), 0));
if (llvm::isa<RankedTensorType, VectorType>(type)) {
diff --git a/mlir/lib/IR/BuiltinAttributes.cpp b/mlir/lib/IR/BuiltinAttributes.cpp
index 7328fccfdcfe6f..ddbebe779766d2 100644
--- a/mlir/lib/IR/BuiltinAttributes.cpp
+++ b/mlir/lib/IR/BuiltinAttributes.cpp
@@ -607,7 +607,7 @@ DenseElementsAttr::AttributeElementIterator::AttributeElementIterator(
Attribute DenseElementsAttr::AttributeElementIterator::operator*() const {
auto owner = llvm::cast<DenseElementsAttr>(getFromOpaquePointer(base));
Type eltTy = owner.getElementType();
- if (auto intEltTy = llvm::dyn_cast<IntegerType>(eltTy))
+ if (llvm::dyn_cast<IntegerType>(eltTy))
return IntegerAttr::get(eltTy, *IntElementIterator(owner, index));
if (llvm::isa<IndexType>(eltTy))
return IntegerAttr::get(eltTy, *IntElementIterator(owner, index));
diff --git a/mlir/lib/IR/BuiltinTypes.cpp b/mlir/lib/IR/BuiltinTypes.cpp
index 60cff9d223d4b4..e034f67f438733 100644
--- a/mlir/lib/IR/BuiltinTypes.cpp
+++ b/mlir/lib/IR/BuiltinTypes.cpp
@@ -283,7 +283,7 @@ ArrayRef<int64_t> TensorType::getShape() const {
TensorType TensorType::cloneWith(std::optional<ArrayRef<int64_t>> shape,
Type elementType) const {
- if (auto unrankedTy = llvm::dyn_cast<UnrankedTensorType>(*this)) {
+ if (llvm::dyn_cast<UnrankedTensorType>(*this)) {
if (shape)
return RankedTensorType::get(*shape, elementType);
return UnrankedTensorType::get(elementType);
@@ -370,7 +370,7 @@ ArrayRef<int64_t> BaseMemRefType::getShape() const {
BaseMemRefType BaseMemRefType::cloneWith(std::optional<ArrayRef<int64_t>> shape,
Type elementType) const {
- if (auto unrankedTy = llvm::dyn_cast<UnrankedMemRefType>(*this)) {
+ if (llvm::dyn_cast<UnrankedMemRefType>(*this)) {
if (!shape)
return UnrankedMemRefType::get(elementType, getMemorySpace());
MemRefType::Builder builder(*shape, elementType);
diff --git a/mlir/lib/IR/Diagnostics.cpp b/mlir/lib/IR/Diagnostics.cpp
index 6788660d878285..6b311a90e0de59 100644
--- a/mlir/lib/IR/Diagnostics.cpp
+++ b/mlir/lib/IR/Diagnostics.cpp
@@ -392,11 +392,11 @@ struct SourceMgrDiagnosticHandlerImpl {
/// Return a processable CallSiteLoc from the given location.
static std::optional<CallSiteLoc> getCallSiteLoc(Location loc) {
- if (auto nameLoc = dyn_cast<NameLoc>(loc))
+ if (dyn_cast<NameLoc>(loc))
return getCallSiteLoc(cast<NameLoc>(loc).getChildLoc());
if (auto callLoc = dyn_cast<CallSiteLoc>(loc))
return callLoc;
- if (auto fusedLoc = dyn_cast<FusedLoc>(loc)) {
+ if (dyn_cast<FusedLoc>(loc)) {
for (auto subLoc : cast<FusedLoc>(loc).getLocations()) {
if (auto callLoc = getCallSiteLoc(subLoc)) {
return callLoc;
diff --git a/mlir/lib/IR/Operation.cpp b/mlir/lib/IR/Operation.cpp
index 3453f9d1640674..888c146f49539f 100644
--- a/mlir/lib/IR/Operation.cpp
+++ b/mlir/lib/IR/Operation.cpp
@@ -309,8 +309,7 @@ void Operation::setAttrs(DictionaryAttr newAttrs) {
SmallVector<NamedAttribute> discardableAttrs;
discardableAttrs.reserve(newAttrs.size());
for (NamedAttribute attr : newAttrs) {
- if (std::optional<Attribute> inherentAttr =
- getInherentAttr(attr.getName()))
+ if (getInherentAttr(attr.getName()))
setInherentAttr(attr.getName(), attr.getValue());
else
discardableAttrs.push_back(attr);
@@ -327,8 +326,7 @@ void Operation::setAttrs(ArrayRef<NamedAttribute> newAttrs) {
SmallVector<NamedAttribute> discardableAttrs;
discardableAttrs.reserve(newAttrs.size());
for (NamedAttribute attr : newAttrs) {
- if (std::optional<Attribute> inherentAttr =
- getInherentAttr(attr.getName()))
+ if (getInherentAttr(attr.getName()))
setInherentAttr(attr.getName(), attr.getValue());
else
discardableAttrs.push_back(attr);
diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp
index 6f8f46f30281f8..ef028f9978b74b 100644
--- a/mlir/lib/Parser/Parser.cpp
+++ b/mlir/lib/Parser/Parser.cpp
@@ -62,7 +62,7 @@ static LogicalResult loadSourceFileBuffer(llvm::StringRef filename,
"only main buffer parsed at the moment");
}
auto fileOrErr = llvm::MemoryBuffer::getFileOrSTDIN(filename);
- if (std::error_code error = fileOrErr.getError())
+ if (fileOrErr.getError())
return emitError(mlir::UnknownLoc::get(ctx),
"could not open input file " + filename);
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index a8115ef468c4df..8b38cf761273f9 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -912,9 +912,9 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
if (std::optional<StringRef> section = func.getSection())
llvmFunc->setSection(*section);
- if (auto armStreaming = func.getArmStreaming())
+ if (func.getArmStreaming())
llvmFunc->addFnAttr("aarch64_pstate_sm_enabled");
- else if (auto armLocallyStreaming = func.getArmLocallyStreaming())
+ else if (func.getArmLocallyStreaming())
llvmFunc->addFnAttr("aarch64_pstate_sm_body");
// First, create all blocks so we can jump to them.
diff --git a/mlir/lib/Tools/PDLL/Parser/Parser.cpp b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
index 044aa612b67fbb..fa8bc082af86f9 100644
--- a/mlir/lib/Tools/PDLL/Parser/Parser.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
@@ -2342,7 +2342,7 @@ FailureOr<ast::LetStmt *> Parser::parseLetStmt() {
TypeSwitch<const ast::Node *, LogicalResult>(constraint.constraint)
.Case<ast::AttrConstraintDecl, ast::ValueConstraintDecl,
ast::ValueRangeConstraintDecl>([&](const auto *cst) {
- if (auto *typeConstraintExpr = cst->getTypeExpr()) {
+ if (cst->getTypeExpr()) {
return this->emitError(
constraint.referenceLoc,
"type constraints are not permitted on variables with "
diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp
index e6eb483e234000..b32b0fc28c78b0 100644
--- a/mlir/lib/Transforms/Inliner.cpp
+++ b/mlir/lib/Transforms/Inliner.cpp
@@ -373,7 +373,7 @@ static void collectCallOps(iterator_range<Region::iterator> blocks,
#ifndef NDEBUG
static std::string getNodeName(CallOpInterface op) {
- if (auto sym = llvm::dyn_cast_if_present<SymbolRefAttr>(op.getCallableForCallee()))
+ if (llvm::dyn_cast_if_present<SymbolRefAttr>(op.getCallableForCallee()))
return debugString(op);
return "_unnamed_callee_";
}
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 93fd106610dd13..3d4767d838059d 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -2865,7 +2865,8 @@ void OpEmitter::buildParamList(SmallVectorImpl<MethodParameter> ¶mList,
operand->isOptional());
continue;
}
- if (const auto *operand = llvm::dyn_cast_if_present<NamedProperty *>(arg)) {
+ if ([[maybe_unused]] const auto *operand =
+ llvm::dyn_cast_if_present<NamedProperty *>(arg)) {
// TODO
continue;
}
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index c0ba58dd2b15f4..3f65aba21fa628 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -1395,7 +1395,7 @@ void OperationFormat::genElementParser(FormatElement *element, MethodBody &body,
}
body.unindent() << "}\n";
body.unindent();
- } else if (auto *attrDict = dyn_cast<PropDictDirective>(element)) {
+ } else if (dyn_cast<PropDictDirective>(element)) {
body << " if (parseProperties(parser, result))\n"
<< " return ::mlir::failure();\n";
} else if (auto *customDir = dyn_cast<CustomDirective>(element)) {
@@ -2189,7 +2189,7 @@ void OperationFormat::genElementPrinter(FormatElement *element,
}
// Emit the attribute dictionary.
- if (auto *propDict = dyn_cast<PropDictDirective>(element)) {
+ if (dyn_cast<PropDictDirective>(element)) {
genPropDictPrinter(*this, op, body);
lastWasPunctuation = false;
return;
diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index 875f5b71de7f3c..6bb79fb4b4cbe6 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -517,7 +517,7 @@ void PatternEmitter::emitNativeCodeMatch(DagNode tree, StringRef opName,
std::string argName = capture[i];
// Handle nested DAG construct first
- if (DagNode argTree = tree.getArgAsNestedDag(i)) {
+ if (tree.getArgAsNestedDag(i)) {
PrintFatalError(
loc, formatv("Matching nested tree in NativeCodecall not support for "
"{0} as arg {1}",
More information about the Mlir-commits
mailing list