[Mlir-commits] [mlir] 9fa59e7 - [mlir] Use C++17 structured bindings instead of std::tie where applicable. NFCI
Benjamin Kramer
llvmlistbot at llvm.org
Tue Aug 9 04:37:43 PDT 2022
Author: Benjamin Kramer
Date: 2022-08-09T13:34:17+02:00
New Revision: 9fa59e7643d63bbc95c1e011c7403bbe1555c861
URL: https://github.com/llvm/llvm-project/commit/9fa59e7643d63bbc95c1e011c7403bbe1555c861
DIFF: https://github.com/llvm/llvm-project/commit/9fa59e7643d63bbc95c1e011c7403bbe1555c861.diff
LOG: [mlir] Use C++17 structured bindings instead of std::tie where applicable. NFCI
Added:
Modified:
mlir/include/mlir/ExecutionEngine/MemRefUtils.h
mlir/lib/Analysis/DataFlowFramework.cpp
mlir/lib/Analysis/Presburger/IntegerRelation.cpp
mlir/lib/Analysis/Presburger/Simplex.cpp
mlir/lib/AsmParser/DialectSymbolParser.cpp
mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
mlir/lib/Conversion/MemRefToLLVM/AllocLikeConversion.cpp
mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
mlir/lib/Dialect/Arithmetic/IR/InferIntRangeInterfaceImpls.cpp
mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
mlir/lib/Dialect/SCF/IR/SCF.cpp
mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
mlir/lib/Dialect/Shape/IR/Shape.cpp
mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
mlir/lib/Support/DebugCounter.cpp
mlir/lib/TableGen/Pattern.cpp
mlir/lib/Tools/PDLL/Parser/Parser.cpp
mlir/lib/Transforms/OpStats.cpp
mlir/lib/Transforms/Utils/DialectConversion.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
index 1231da565addb..be33aaf0ae9a9 100644
--- a/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
+++ b/mlir/include/mlir/ExecutionEngine/MemRefUtils.h
@@ -162,8 +162,7 @@ class OwningMemRef {
int64_t nElements = 1;
for (int64_t s : shapeAlloc)
nElements *= s;
- T *data, *alignedData;
- std::tie(data, alignedData) =
+ auto [data, alignedData] =
detail::allocAligned<T>(nElements, allocFun, alignment);
descriptor = detail::makeStridedMemRefDescriptor<Rank>(data, alignedData,
shape, shapeAlloc);
diff --git a/mlir/lib/Analysis/DataFlowFramework.cpp b/mlir/lib/Analysis/DataFlowFramework.cpp
index 18d9ba1bd5d60..9c8a8899d8c12 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -72,13 +72,10 @@ LogicalResult DataFlowSolver::initializeAndRun(Operation *top) {
}
// Run the analysis until fixpoint.
- ProgramPoint point;
- DataFlowAnalysis *analysis;
-
do {
// Exhaust the worklist.
while (!worklist.empty()) {
- std::tie(point, analysis) = worklist.front();
+ auto [point, analysis] = worklist.front();
worklist.pop();
DATAFLOW_DEBUG(llvm::dbgs() << "Invoking '" << analysis->debugName
diff --git a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
index cb1c13a69ab4f..3e19a4940f3a4 100644
--- a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
+++ b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
@@ -1108,8 +1108,7 @@ Optional<uint64_t> IntegerRelation::computeVolume() const {
bool hasUnboundedVar = false;
for (unsigned i = 0, e = getNumDimAndSymbolVars(); i < e; ++i) {
dim[i] = 1;
- MaybeOptimum<int64_t> min, max;
- std::tie(min, max) = simplex.computeIntegerBounds(dim);
+ auto [min, max] = simplex.computeIntegerBounds(dim);
dim[i] = 0;
assert((!min.isEmpty() && !max.isEmpty()) &&
diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index 61e8761cad153..67fb608ddf827 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -1990,9 +1990,7 @@ Optional<SmallVector<int64_t, 8>> Simplex::findIntegerSample() {
llvm::to_vector<8>(basis.getRow(level));
basisCoeffs.emplace_back(0);
- MaybeOptimum<int64_t> minRoundedUp, maxRoundedDown;
- std::tie(minRoundedUp, maxRoundedDown) =
- computeIntegerBounds(basisCoeffs);
+ auto [minRoundedUp, maxRoundedDown] = computeIntegerBounds(basisCoeffs);
// We don't have any integer values in the range.
// Pop the stack and return up a level.
diff --git a/mlir/lib/AsmParser/DialectSymbolParser.cpp b/mlir/lib/AsmParser/DialectSymbolParser.cpp
index f38ce43748a19..8f1d69b4966ad 100644
--- a/mlir/lib/AsmParser/DialectSymbolParser.cpp
+++ b/mlir/lib/AsmParser/DialectSymbolParser.cpp
@@ -160,9 +160,7 @@ static Symbol parseExtendedSymbol(Parser &p, SymbolAliasMap &aliases,
p.consumeToken();
// Check to see if this is a pretty name.
- StringRef dialectName;
- StringRef symbolData;
- std::tie(dialectName, symbolData) = identifier.split('.');
+ auto [dialectName, symbolData] = identifier.split('.');
bool isPrettyName = !symbolData.empty() || identifier.back() == '.';
// Check to see if the symbol has trailing data, i.e. has an immediately
diff --git a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
index 53da615981c3f..039a5fd6a378c 100644
--- a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
+++ b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
@@ -131,9 +131,7 @@ static void wrapForExternalCallers(OpBuilder &rewriter, Location loc,
SmallVector<NamedAttribute, 4> attributes;
filterFuncAttributes(funcOp->getAttrs(), /*filterArgAndResAttrs=*/false,
attributes);
- Type wrapperFuncType;
- bool resultIsNowArg;
- std::tie(wrapperFuncType, resultIsNowArg) =
+ auto [wrapperFuncType, resultIsNowArg] =
typeConverter.convertFunctionTypeCWrapper(type);
if (resultIsNowArg)
prependResAttrsToArgAttrs(rewriter, attributes, funcOp.getNumArguments());
@@ -189,9 +187,7 @@ static void wrapExternalFunction(OpBuilder &builder, Location loc,
LLVM::LLVMFuncOp newFuncOp) {
OpBuilder::InsertionGuard guard(builder);
- Type wrapperType;
- bool resultIsNowArg;
- std::tie(wrapperType, resultIsNowArg) =
+ auto [wrapperType, resultIsNowArg] =
typeConverter.convertFunctionTypeCWrapper(funcOp.getFunctionType());
// This conversion can only fail if it could not convert one of the argument
// types. But since it has been applied to a non-wrapper function before, it
diff --git a/mlir/lib/Conversion/MemRefToLLVM/AllocLikeConversion.cpp b/mlir/lib/Conversion/MemRefToLLVM/AllocLikeConversion.cpp
index fa32f8f77f3b2..d2778b785be02 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/AllocLikeConversion.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/AllocLikeConversion.cpp
@@ -39,9 +39,7 @@ LogicalResult AllocLikeOpLLVMLowering::matchAndRewrite(
strides, sizeBytes);
// Allocate the underlying buffer.
- Value allocatedPtr;
- Value alignedPtr;
- std::tie(allocatedPtr, alignedPtr) =
+ auto [allocatedPtr, alignedPtr] =
this->allocateBuffer(rewriter, loc, sizeBytes, op);
// Create the MemRef descriptor.
diff --git a/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp b/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
index 68f8e1b2afeb4..8bdf68354daa6 100644
--- a/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
+++ b/mlir/lib/Conversion/SCFToControlFlow/SCFToControlFlow.cpp
@@ -458,11 +458,9 @@ ParallelLowering::matchAndRewrite(ParallelOp parallelOp,
ivs.reserve(parallelOp.getNumLoops());
bool first = true;
SmallVector<Value, 4> loopResults(iterArgs);
- for (auto loopOperands :
+ for (auto [iv, lower, upper, step] :
llvm::zip(parallelOp.getInductionVars(), parallelOp.getLowerBound(),
parallelOp.getUpperBound(), parallelOp.getStep())) {
- Value iv, lower, upper, step;
- std::tie(iv, lower, upper, step) = loopOperands;
ForOp forOp = rewriter.create<ForOp>(loc, lower, upper, step, iterArgs);
ivs.push_back(forOp.getInductionVar());
auto iterRange = forOp.getRegionIterArgs();
diff --git a/mlir/lib/Dialect/Arithmetic/IR/InferIntRangeInterfaceImpls.cpp b/mlir/lib/Dialect/Arithmetic/IR/InferIntRangeInterfaceImpls.cpp
index 2a877e37b7341..0c887e81894f4 100644
--- a/mlir/lib/Dialect/Arithmetic/IR/InferIntRangeInterfaceImpls.cpp
+++ b/mlir/lib/Dialect/Arithmetic/IR/InferIntRangeInterfaceImpls.cpp
@@ -368,9 +368,8 @@ widenBitwiseBounds(const ConstantIntRanges &bound) {
void arith::AndIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
SetIntRangeFn setResultRange) {
- APInt lhsZeros, lhsOnes, rhsZeros, rhsOnes;
- std::tie(lhsZeros, lhsOnes) = widenBitwiseBounds(argRanges[0]);
- std::tie(rhsZeros, rhsOnes) = widenBitwiseBounds(argRanges[1]);
+ auto [lhsZeros, lhsOnes] = widenBitwiseBounds(argRanges[0]);
+ auto [rhsZeros, rhsOnes] = widenBitwiseBounds(argRanges[1]);
auto andi = [](const APInt &a, const APInt &b) -> Optional<APInt> {
return a & b;
};
@@ -385,9 +384,8 @@ void arith::AndIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
void arith::OrIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
SetIntRangeFn setResultRange) {
- APInt lhsZeros, lhsOnes, rhsZeros, rhsOnes;
- std::tie(lhsZeros, lhsOnes) = widenBitwiseBounds(argRanges[0]);
- std::tie(rhsZeros, rhsOnes) = widenBitwiseBounds(argRanges[1]);
+ auto [lhsZeros, lhsOnes] = widenBitwiseBounds(argRanges[0]);
+ auto [rhsZeros, rhsOnes] = widenBitwiseBounds(argRanges[1]);
auto ori = [](const APInt &a, const APInt &b) -> Optional<APInt> {
return a | b;
};
@@ -402,9 +400,8 @@ void arith::OrIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
void arith::XOrIOp::inferResultRanges(ArrayRef<ConstantIntRanges> argRanges,
SetIntRangeFn setResultRange) {
- APInt lhsZeros, lhsOnes, rhsZeros, rhsOnes;
- std::tie(lhsZeros, lhsOnes) = widenBitwiseBounds(argRanges[0]);
- std::tie(rhsZeros, rhsOnes) = widenBitwiseBounds(argRanges[1]);
+ auto [lhsZeros, lhsOnes] = widenBitwiseBounds(argRanges[0]);
+ auto [rhsZeros, rhsOnes] = widenBitwiseBounds(argRanges[1]);
auto xori = [](const APInt &a, const APInt &b) -> Optional<APInt> {
return a ^ b;
};
diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index 833164a2add41..d102dbe1a37ea 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -1040,9 +1040,7 @@ LogicalResult gpu::ReturnOp::verify() {
for (const auto &pair : llvm::enumerate(
llvm::zip(function.getFunctionType().getResults(), operands()))) {
- Type type;
- Value operand;
- std::tie(type, operand) = pair.value();
+ auto [type, operand] = pair.value();
if (type != operand.getType())
return emitOpError() << "unexpected type `" << operand.getType()
<< "' for operand #" << pair.index();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
index dc836f8924a5d..ddcc3470c9dcf 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
@@ -415,9 +415,7 @@ tileLinalgOpImpl(RewriterBase &b, LinalgOp op, ArrayRef<OpFoldResult> tileSizes,
if (!shapeSizesToLoopsMap)
return failure();
- SmallVector<Range, 4> loopRanges;
- LoopIndexToRangeIndexMap loopIndexToRangeIndex;
- std::tie(loopRanges, loopIndexToRangeIndex) = makeTiledLoopRanges(
+ auto [loopRanges, loopIndexToRangeIndex] = makeTiledLoopRanges(
b, op.getLoc(), shapeSizesToLoopsMap, allShapeSizes, tileSizes);
SmallVector<Attribute, 4> iteratorTypes;
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 62804980cd0d5..607811aa2a801 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -1741,11 +1741,9 @@ struct ReplaceIfYieldWithConditionOrValue : public OpRewritePattern<IfOp> {
op.getOperation()->getIterator());
bool changed = false;
Type i1Ty = rewriter.getI1Type();
- for (auto tup : llvm::zip(trueYield.getResults(), falseYield.getResults(),
- op.getResults())) {
- Value trueResult, falseResult, opResult;
- std::tie(trueResult, falseResult, opResult) = tup;
-
+ for (auto [trueResult, falseResult, opResult] :
+ llvm::zip(trueYield.getResults(), falseYield.getResults(),
+ op.getResults())) {
if (trueResult == falseResult) {
if (!opResult.use_empty()) {
opResult.replaceAllUsesWith(trueResult);
@@ -2315,10 +2313,9 @@ struct CollapseSingleIterationLoops : public OpRewritePattern<ParallelOp> {
newLowerBounds.reserve(op.getLowerBound().size());
newUpperBounds.reserve(op.getUpperBound().size());
newSteps.reserve(op.getStep().size());
- for (auto dim : llvm::zip(op.getLowerBound(), op.getUpperBound(),
- op.getStep(), op.getInductionVars())) {
- Value lowerBound, upperBound, step, iv;
- std::tie(lowerBound, upperBound, step, iv) = dim;
+ for (auto [lowerBound, upperBound, step, iv] :
+ llvm::zip(op.getLowerBound(), op.getUpperBound(), op.getStep(),
+ op.getInductionVars())) {
// Collect the statically known loop bounds.
auto lowerBoundConstant =
dyn_cast_or_null<arith::ConstantIndexOp>(lowerBound.getDefiningOp());
@@ -2823,8 +2820,7 @@ struct RemoveLoopInvariantArgsFromBeforeBlock
for (const auto &it :
llvm::enumerate(llvm::zip(op.getOperands(), yieldOpArgs))) {
auto index = static_cast<unsigned>(it.index());
- Value initVal, yieldOpArg;
- std::tie(initVal, yieldOpArg) = it.value();
+ auto [initVal, yieldOpArg] = it.value();
// If i-th yield operand is equal to the i-th operand of the scf.while,
// the i-th before block argument is a loop invariant.
if (yieldOpArg == initVal) {
@@ -2855,8 +2851,7 @@ struct RemoveLoopInvariantArgsFromBeforeBlock
for (const auto &it :
llvm::enumerate(llvm::zip(op.getOperands(), yieldOpArgs))) {
auto index = static_cast<unsigned>(it.index());
- Value initVal, yieldOpArg;
- std::tie(initVal, yieldOpArg) = it.value();
+ auto [initVal, yieldOpArg] = it.value();
// If i-th yield operand is equal to the i-th operand of the scf.while,
// the i-th before block argument is a loop invariant.
diff --git a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
index c39d3afae25ce..355049de9d02b 100644
--- a/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/ParallelLoopTiling.cpp
@@ -89,12 +89,10 @@ mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes,
SmallVector<Value, 2> newBounds;
newBounds.reserve(op.getUpperBound().size());
bool needInboundCheck = false;
- for (auto dim :
+ for (auto [lowerBound, upperBound, newStep, iv, step, tileSizeConstant] :
llvm::zip(outerLoop.getLowerBound(), outerLoop.getUpperBound(),
outerLoop.getStep(), outerLoop.getInductionVars(),
op.getStep(), tileSizeConstants)) {
- Value lowerBound, upperBound, newStep, iv, step, tileSizeConstant;
- std::tie(lowerBound, upperBound, newStep, iv, step, tileSizeConstant) = dim;
// Collect the statically known loop bounds
auto lowerBoundConstant =
dyn_cast_or_null<arith::ConstantIndexOp>(lowerBound.getDefiningOp());
@@ -139,11 +137,9 @@ mlir::scf::tileParallelLoop(ParallelOp op, ArrayRef<int64_t> tileSizes,
// Insert in-bound check
Value inbound =
b.create<arith::ConstantIntOp>(op.getLoc(), 1, b.getIntegerType(1));
- for (auto dim :
+ for (auto [outerUpperBound, outerIV, innerIV, innerStep] :
llvm::zip(outerLoop.getUpperBound(), outerLoop.getInductionVars(),
innerLoop.getInductionVars(), innerLoop.getStep())) {
- Value outerUpperBound, outerIV, innerIV, innerStep;
- std::tie(outerUpperBound, outerIV, innerIV, innerStep) = dim;
// %in_bound = %in_bound &&
// (%inner_iv * %inner_step + %outer_iv < %outer_upper_bound)
Value index = b.create<arith::AddIOp>(
diff --git a/mlir/lib/Dialect/Shape/IR/Shape.cpp b/mlir/lib/Dialect/Shape/IR/Shape.cpp
index 0369a5589335b..ce1767ba8413e 100644
--- a/mlir/lib/Dialect/Shape/IR/Shape.cpp
+++ b/mlir/lib/Dialect/Shape/IR/Shape.cpp
@@ -292,9 +292,8 @@ struct AssumingOpRemoveUnusedResults : public OpRewritePattern<AssumingOp> {
// Find used values.
SmallVector<Value, 4> newYieldOperands;
- Value opResult, yieldOperand;
- for (auto it : llvm::zip(op.getResults(), yieldOp.getOperands())) {
- std::tie(opResult, yieldOperand) = it;
+ for (auto [opResult, yieldOperand] :
+ llvm::zip(op.getResults(), yieldOp.getOperands())) {
if (!opResult.getUses().empty()) {
newYieldOperands.push_back(yieldOperand);
}
diff --git a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
index b979033ab4716..112a6517cc187 100644
--- a/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
+++ b/mlir/lib/Dialect/Vector/Utils/VectorUtils.cpp
@@ -83,10 +83,8 @@ Optional<SmallVector<int64_t, 4>> mlir::shapeRatio(ArrayRef<int64_t> superShape,
// Starting from the end, compute the integer divisors.
std::vector<int64_t> result;
result.reserve(superShape.size());
- int64_t superSize = 0, subSize = 0;
- for (auto it :
+ for (auto [superSize, subSize] :
llvm::zip(llvm::reverse(superShape), llvm::reverse(subShape))) {
- std::tie(superSize, subSize) = it;
assert(superSize > 0 && "superSize must be > 0");
assert(subSize > 0 && "subSize must be > 0");
diff --git a/mlir/lib/Support/DebugCounter.cpp b/mlir/lib/Support/DebugCounter.cpp
index cf33fcc09b96e..44bcdf4ce1b75 100644
--- a/mlir/lib/Support/DebugCounter.cpp
+++ b/mlir/lib/Support/DebugCounter.cpp
@@ -122,8 +122,7 @@ void DebugCounter::applyCLOptions() {
continue;
// Debug counter arguments are expected to be in the form: `counter=value`.
- StringRef counterName, counterValueStr;
- std::tie(counterName, counterValueStr) = arg.split('=');
+ auto [counterName, counterValueStr] = arg.split('=');
if (counterValueStr.empty()) {
llvm::errs() << "error: expected DebugCounter argument to have an `=` "
"separating the counter name and value, but the provided "
diff --git a/mlir/lib/TableGen/Pattern.cpp b/mlir/lib/TableGen/Pattern.cpp
index d833de5100cc3..e8dc607e713b9 100644
--- a/mlir/lib/TableGen/Pattern.cpp
+++ b/mlir/lib/TableGen/Pattern.cpp
@@ -203,9 +203,8 @@ void DagNode::print(raw_ostream &os) const {
//===----------------------------------------------------------------------===//
StringRef SymbolInfoMap::getValuePackName(StringRef symbol, int *index) {
- StringRef name, indexStr;
int idx = -1;
- std::tie(name, indexStr) = symbol.rsplit("__");
+ auto [name, indexStr] = symbol.rsplit("__");
if (indexStr.consumeInteger(10, idx)) {
// The second part is not an index; we return the whole symbol as-is.
diff --git a/mlir/lib/Tools/PDLL/Parser/Parser.cpp b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
index 55b1e3947f3bc..78bd9a8e1f0ef 100644
--- a/mlir/lib/Tools/PDLL/Parser/Parser.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
@@ -846,9 +846,7 @@ void Parser::processTdIncludeRecords(llvm::RecordKeeper &tdRecords,
bool supportsResultTypeInferrence =
op.getTrait("::mlir::InferTypeOpInterface::Trait");
- bool inserted = false;
- ods::Operation *odsOp = nullptr;
- std::tie(odsOp, inserted) = odsContext.insertOperation(
+ auto [odsOp, inserted] = odsContext.insertOperation(
op.getOperationName(), processDoc(op.getSummary()),
processAndFormatDoc(op.getDescription()), op.getQualCppClassName(),
supportsResultTypeInferrence, op.getLoc().front());
diff --git a/mlir/lib/Transforms/OpStats.cpp b/mlir/lib/Transforms/OpStats.cpp
index b5d8f3e3dfbca..d02cb8a3c8952 100644
--- a/mlir/lib/Transforms/OpStats.cpp
+++ b/mlir/lib/Transforms/OpStats.cpp
@@ -66,16 +66,15 @@ void PrintOpStatsPass::printSummary() {
};
// Compute the largest dialect and operation name.
- StringRef dialectName, opName;
size_t maxLenOpName = 0, maxLenDialect = 0;
for (const auto &key : sorted) {
- std::tie(dialectName, opName) = splitOperationName(key);
+ auto [dialectName, opName] = splitOperationName(key);
maxLenDialect = std::max(maxLenDialect, dialectName.size());
maxLenOpName = std::max(maxLenOpName, opName.size());
}
for (const auto &key : sorted) {
- std::tie(dialectName, opName) = splitOperationName(key);
+ auto [dialectName, opName] = splitOperationName(key);
// Left-align the names (aligning on the dialect) and right-align the count
// below. The alignment is for readability and does not affect CSV/FileCheck
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index d82264b631e8c..f2184d20d1a69 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -1407,9 +1407,7 @@ void ConversionPatternRewriterImpl::notifyOpReplaced(Operation *op,
bool resultChanged = false;
// Create mappings for each of the new result values.
- Value newValue, result;
- for (auto it : llvm::zip(newValues, op->getResults())) {
- std::tie(newValue, result) = it;
+ for (auto [newValue, result] : llvm::zip(newValues, op->getResults())) {
if (!newValue) {
resultChanged = true;
continue;
@@ -2554,9 +2552,7 @@ replaceMaterialization(ConversionPatternRewriterImpl &rewriterImpl,
// For each of the materialization results, update the inverse mappings to
// point to the replacement values.
- for (auto it : llvm::zip(matResults, values)) {
- Value matResult, newValue;
- std::tie(matResult, newValue) = it;
+ for (auto [matResult, newValue] : llvm::zip(matResults, values)) {
auto inverseMapIt = inverseMapping.find(matResult);
if (inverseMapIt == inverseMapping.end())
continue;
More information about the Mlir-commits
mailing list