continue;
// Update terminator `successor` block to `refCountingBlock`.
- for (auto pair : llvm::enumerate(terminator->getSuccessors()))
+ for (const auto &pair : llvm::enumerate(terminator->getSuccessors()))
if (pair.value() == successor)
terminator->setSuccessor(refCountingBlock, pair.index());
}
auto offsets = delinearize(strides, i);
SmallVector<Value> extracted(expandedOperands.size());
- for (auto tuple : llvm::enumerate(expandedOperands))
+ for (const auto &tuple : llvm::enumerate(expandedOperands))
extracted[tuple.index()] =
builder.create<vector::ExtractOp>(tuple.value(), offsets);
// Convert function arguments using the provided TypeConverter.
TypeConverter::SignatureConversion conversion(functionType.getNumInputs());
- for (auto argType : llvm::enumerate(functionType.getInputs())) {
+ for (const auto &argType : llvm::enumerate(functionType.getInputs())) {
SmallVector<Type, 2> decomposedTypes;
if (failed(typeConverter->convertType(argType.value(), decomposedTypes)))
return failure();
if (resultKnowledge.size() != yieldOp.getNumOperands())
return failure();
- for (auto it : llvm::enumerate(yieldOp.getOperands())) {
+ for (const auto &it : llvm::enumerate(yieldOp.getOperands())) {
int32_t index = it.index();
auto meet = ValueKnowledge::meet(
resultKnowledge[index],
if (resultKnowledge.size() != yieldOp.getNumOperands())
return failure();
- for (auto it : llvm::enumerate(yieldOp.getOperands())) {
+ for (const auto &it : llvm::enumerate(yieldOp.getOperands())) {
int32_t index = it.index();
if (auto meet = ValueKnowledge::meet(
resultKnowledge[index],
}
for (auto yieldOp : yieldOps) {
- for (auto it : llvm::enumerate(yieldOp.getOperands())) {
+ for (const auto &it : llvm::enumerate(yieldOp.getOperands())) {
auto newKnowledge =
ValueKnowledge::getKnowledgeFromType(it.value().getType());
yieldTypeInfo[it.index()] =
return true;
unsigned nDims = reassociation[0].getNumDims();
unsigned nextExpectedDim = 0;
- for (auto it : llvm::enumerate(reassociation)) {
+ for (const auto &it : llvm::enumerate(reassociation)) {
auto m = it.value();
if (m.getNumDims() != nDims || m.getNumSymbols() != 0) {
if (invalidIndex)
if (failed(shapedOp.reifyReturnTypeShapes(b, op->getOperands(), shapes)) ||
!llvm::hasSingleElement(shapes))
return;
- for (auto it : llvm::enumerate(shapes)) {
+ for (const auto &it : llvm::enumerate(shapes)) {
op->emitRemark() << "value " << it.index() << ": "
<< it.value().getDefiningOp();
}
// Print information about the user of each of the result.
llvm::outs() << "Has " << op->getNumResults() << " results:\n";
- for (auto indexedResult : llvm::enumerate(op->getResults())) {
+ for (const auto &indexedResult : llvm::enumerate(op->getResults())) {
Value result = indexedResult.value();
llvm::outs() << " - Result " << indexedResult.index();
if (result.use_empty()) {
builder.create<FuncOp>(loc, clonedFuncOpName, parentFuncOp.getType());
BlockAndValueMapping mapper;
builder.setInsertionPointToEnd(clonedFuncOp.addEntryBlock());
- for (auto arg : enumerate(parentFuncOp.getArguments()))
+ for (const auto &arg : enumerate(parentFuncOp.getArguments()))
mapper.map(arg.value(), clonedFuncOp.getArgument(arg.index()));
SetVector<Operation *> slice;
getBackwardSlice(op, &slice);
static Optional<int>
findTensorDefArgIndex(StringRef name, SmallVectorImpl<LinalgOperandDef> &args) {
- for (auto it : llvm::enumerate(args)) {
+ for (const auto &it : llvm::enumerate(args)) {
if (it.value().name == name)
return it.index();
}
return std::string("helper.getFloat64Type()");
// Search all argument types.
- for (auto it : llvm::enumerate(args)) {
+ for (const auto &it : llvm::enumerate(args)) {
if (it.value().typeVar == typeVar)
return llvm::formatv("block.getArgument({0}).getType()", it.index())
.str();
MethodParameter("const KeyTy &", "tblgenKey"));
if (!def.hasStorageCustomConstructor()) {
auto &body = construct->body().indent();
- for (auto it : llvm::enumerate(params)) {
+ for (const auto &it : llvm::enumerate(params)) {
body << formatv("auto {0} = std::get<{1}>(tblgenKey);\n",
it.value().getName(), it.index());
}
/// Collect all of the attribute's or type's parameters.
SmallVector<std::unique_ptr<Element>> vars;
/// Ensure that none of the parameters have already been captured.
- for (auto it : llvm::enumerate(def.getParameters())) {
+ for (const auto &it : llvm::enumerate(def.getParameters())) {
if (seenParams.test(it.index())) {
return emitError("`params` captures duplicate parameter: " +
it.value().getName());
const char *listName) {
auto results = record.getValueAsListOfDefs(listName);
IndicesTy overloadedOps(results.size());
- for (auto r : llvm::enumerate(results)) {
+ for (const auto &r : llvm::enumerate(results)) {
llvm::MVT::SimpleValueType vt = getValueType(r.value());
switch (vt) {
case llvm::MVT::iAny:
body << " {\n unsigned index = 0; (void)index;\n";
- for (auto staticValue : llvm::enumerate(values)) {
+ for (const auto &staticValue : llvm::enumerate(values)) {
const NamedTypeConstraint &value = staticValue.value();
bool hasPredicate = value.hasPredicate();
return;
body << " {\n unsigned index = 0; (void)index;\n";
- for (auto it : llvm::enumerate(regions)) {
+ for (const auto &it : llvm::enumerate(regions)) {
const auto ®ion = it.value();
if (canSkip(region))
continue;
os << "\nSyntax:\n\n```\n!" << def.getDialect().getName() << "."
<< def.getMnemonic() << "<\n";
- for (auto it : llvm::enumerate(parameters)) {
+ for (const auto &it : llvm::enumerate(parameters)) {
const AttrOrTypeParameter ¶m = it.value();
os << " " << param.getSyntax();
if (it.index() < (parameters.size() - 1))
/// Emits named accessors to regions.
static void emitRegionAccessors(const Operator &op, raw_ostream &os) {
- for (auto en : llvm::enumerate(op.getRegions())) {
+ for (const auto &en : llvm::enumerate(op.getRegions())) {
const NamedRegion ®ion = en.value();
if (region.name.empty())
continue;