Index: lld/COFF/InputFiles.cpp =================================================================== --- lld/COFF/InputFiles.cpp +++ lld/COFF/InputFiles.cpp @@ -124,7 +124,7 @@ std::vector getArchiveMembers(Archive *file) { std::vector v; Error err = Error::success(); - for (const ErrorOr &cOrErr : file->children(err)) { + for (ErrorOr cOrErr : file->children(err)) { Archive::Child c = CHECK(cOrErr, file->getFileName() + ": could not get the child of the archive"); Index: lld/ELF/Driver.cpp =================================================================== --- lld/ELF/Driver.cpp +++ lld/ELF/Driver.cpp @@ -165,7 +165,7 @@ std::vector> v; Error err = Error::success(); bool addToTar = file->isThin() && tar; - for (const ErrorOr &cOrErr : file->children(err)) { + for (ErrorOr cOrErr : file->children(err)) { Archive::Child c = CHECK(cOrErr, mb.getBufferIdentifier() + ": could not get the child of the archive"); Index: lld/ELF/Relocations.cpp =================================================================== --- lld/ELF/Relocations.cpp +++ lld/ELF/Relocations.cpp @@ -1619,7 +1619,7 @@ // those inserted in previous passes. Extract the Thunks created this // pass and order them in ascending outSecOff. std::vector newThunks; - for (const std::pair ts : isd->thunkSections) + for (std::pair ts : isd->thunkSections) if (ts.second == pass) newThunks.push_back(ts.first); llvm::stable_sort(newThunks, Index: lld/ELF/SyntheticSections.cpp =================================================================== --- lld/ELF/SyntheticSections.cpp +++ lld/ELF/SyntheticSections.cpp @@ -1055,7 +1055,7 @@ // Write VA to the primary GOT only. For secondary GOTs that // will be done by REL32 dynamic relocations. if (&g == &gots.front()) - for (const std::pair &p : g.global) + for (const std::pair &p : g.global) write(p.second, p.first, 0); for (const std::pair &p : g.relocs) write(p.second, p.first, 0); Index: lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp =================================================================== --- lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp +++ lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp @@ -1491,7 +1491,7 @@ void Util::fixLazyReferenceImm(const DefinedAtom *atom, uint32_t offset, NormalizedFile &file) { - for (const auto &ref : *atom) { + for (const auto *ref : *atom) { const DefinedAtom *da = dyn_cast(ref->target()); if (da == nullptr) return; Index: lld/wasm/Driver.cpp =================================================================== --- lld/wasm/Driver.cpp +++ lld/wasm/Driver.cpp @@ -197,7 +197,7 @@ std::vector v; Error err = Error::success(); - for (const ErrorOr &cOrErr : file->children(err)) { + for (ErrorOr cOrErr : file->children(err)) { Archive::Child c = CHECK(cOrErr, mb.getBufferIdentifier() + ": could not get the child of the archive"); Index: mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp =================================================================== --- mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp +++ mlir/lib/Conversion/LoopsToGPU/LoopsToGPU.cpp @@ -375,7 +375,7 @@ // Replace values that are used within the region of the launchOp but are // defined outside. They all are replaced with kernel arguments. - for (const auto &pair : + for (auto pair : llvm::zip_first(valuesToForward, launchOp.getKernelArguments())) { Value from = std::get<0>(pair); Value to = std::get<1>(pair); @@ -467,7 +467,7 @@ // Remap the values defined outside the body to use kernel arguments instead. // The list of kernel arguments also contains the lower bounds for loops at // trailing positions, make sure we don't touch those. - for (const auto &pair : + for (auto pair : llvm::zip_first(valuesToForward, launchOp.getKernelArguments())) { Value from = std::get<0>(pair); Value to = std::get<1>(pair); Index: mlir/lib/Dialect/Traits.cpp =================================================================== --- mlir/lib/Dialect/Traits.cpp +++ mlir/lib/Dialect/Traits.cpp @@ -151,7 +151,7 @@ }; if (shape1.size() != shape2.size()) return false; - for (const auto &p : llvm::zip(shape1, shape2)) + for (auto p : llvm::zip(shape1, shape2)) if (!isCompatible(std::get<0>(p), std::get<1>(p))) return false; return true; Index: mlir/lib/Dialect/VectorOps/VectorOps.cpp =================================================================== --- mlir/lib/Dialect/VectorOps/VectorOps.cpp +++ mlir/lib/Dialect/VectorOps/VectorOps.cpp @@ -1349,7 +1349,7 @@ // Compute slice of vector mask region. SmallVector sliceMaskDimSizes; assert(sliceOffsets.size() == maskDimSizes.size()); - for (const auto &it : llvm::zip(maskDimSizes, sliceOffsets, sliceSizes)) { + for (auto it : llvm::zip(maskDimSizes, sliceOffsets, sliceSizes)) { int64_t maskDimSize = std::get<0>(it); int64_t sliceOffset = std::get<1>(it); int64_t sliceSize = std::get<2>(it); Index: mlir/lib/IR/TypeUtilities.cpp =================================================================== --- mlir/lib/IR/TypeUtilities.cpp +++ mlir/lib/IR/TypeUtilities.cpp @@ -55,7 +55,7 @@ ArrayRef shape2) { if (shape1.size() != shape2.size()) return failure(); - for (const auto &dims : llvm::zip(shape1, shape2)) { + for (auto dims : llvm::zip(shape1, shape2)) { int64_t dim1 = std::get<0>(dims); int64_t dim2 = std::get<1>(dims); if (!ShapedType::isDynamic(dim1) && !ShapedType::isDynamic(dim2) && Index: mlir/lib/Parser/Parser.cpp =================================================================== --- mlir/lib/Parser/Parser.cpp +++ mlir/lib/Parser/Parser.cpp @@ -3766,7 +3766,7 @@ } // Add the successors, and their operands after the proper operands. - for (const auto &succ : llvm::zip(successors, successorOperands)) { + for (auto succ : llvm::zip(successors, successorOperands)) { Block *successor = std::get<0>(succ); const SmallVector &operands = std::get<1>(succ); result.addSuccessor(successor, operands); @@ -4176,7 +4176,7 @@ SmallVector, 2> regionArguments; - for (const auto &pair : llvm::zip(arguments, argTypes)) { + for (auto pair : llvm::zip(arguments, argTypes)) { const OperandType &operand = std::get<0>(pair); Type type = std::get<1>(pair); OperationParser::SSAUseInfo operandInfo = {operand.name, operand.number, Index: mlir/lib/Target/LLVMIR/ModuleTranslation.cpp =================================================================== --- mlir/lib/Target/LLVMIR/ModuleTranslation.cpp +++ mlir/lib/Target/LLVMIR/ModuleTranslation.cpp @@ -409,7 +409,7 @@ // Add function arguments to the value remapping table. // If there was noalias info then we decorate each argument accordingly. unsigned int argIdx = 0; - for (const auto &kvp : llvm::zip(func.getArguments(), llvmFunc->args())) { + for (auto kvp : llvm::zip(func.getArguments(), llvmFunc->args())) { llvm::Argument &llvmArg = std::get<1>(kvp); BlockArgument mlirArg = std::get<0>(kvp); Index: mlir/tools/mlir-tblgen/StructsGen.cpp =================================================================== --- mlir/tools/mlir-tblgen/StructsGen.cpp +++ mlir/tools/mlir-tblgen/StructsGen.cpp @@ -63,7 +63,7 @@ // namespace::storage TblgenStruct::field1() const; const char *fieldInfo = R"( {0} {1}() const; )"; - for (const auto field : fields) { + for (auto field : fields) { auto name = field.getName(); auto type = field.getType(); auto storage = type.getStorageType(); Index: polly/lib/Analysis/ScopGraphPrinter.cpp =================================================================== --- polly/lib/Analysis/ScopGraphPrinter.cpp +++ polly/lib/Analysis/ScopGraphPrinter.cpp @@ -178,7 +178,7 @@ RegionInfo *RI = R->getRegionInfo(); - for (const auto &BB : R->blocks()) + for (auto *BB : R->blocks()) if (RI->getRegionFor(BB) == R) O.indent(2 * (depth + 1)) << "Node"