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);
}
// 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
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()) &&
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.
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
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());
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
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.
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();
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;
};
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;
};
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;
};
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();
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;
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);
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());
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) {
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.
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());
// 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>(
// 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);
}
// 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");
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 "
//===----------------------------------------------------------------------===//
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.
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());
};
// 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
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;
// 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;