forked from OSchip/llvm-project
[mlir] Fix -Wrange-loo-analysis warnings
for (const auto &x : llvm::zip(..., ...)) -> for (auto x : llvm::zip(..., ...)) The return type of zip() is a wrapper that wraps a tuple of references. > warning: loop variable 'p' is always a copy because the range of type 'detail::zippy<detail::zip_shortest, ArrayRef<long> &, ArrayRef<long> &>' does not return a reference [-Wrange-loop-analysis]
This commit is contained in:
parent
681b1be774
commit
eeef50b1fe
|
@ -375,7 +375,7 @@ LogicalResult createLaunchFromOp(OpTy rootForOp, ArrayRef<Value> numWorkGroups,
|
|||
|
||||
// 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 @@ void LoopToGpuConverter::createLaunch(OpTy rootForOp, OpTy innermostForOp,
|
|||
// 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);
|
||||
|
|
|
@ -151,7 +151,7 @@ static bool areCompatibleShapes(ArrayRef<int64_t> shape1,
|
|||
};
|
||||
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;
|
||||
|
|
|
@ -1349,7 +1349,7 @@ public:
|
|||
// Compute slice of vector mask region.
|
||||
SmallVector<int64_t, 4> 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);
|
||||
|
|
|
@ -55,7 +55,7 @@ LogicalResult mlir::verifyCompatibleShape(ArrayRef<int64_t> shape1,
|
|||
ArrayRef<int64_t> 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) &&
|
||||
|
|
|
@ -3766,7 +3766,7 @@ Operation *OperationParser::parseGenericOperation() {
|
|||
}
|
||||
|
||||
// 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<Value, 4> &operands = std::get<1>(succ);
|
||||
result.addSuccessor(successor, operands);
|
||||
|
@ -4176,7 +4176,7 @@ public:
|
|||
|
||||
SmallVector<std::pair<OperationParser::SSAUseInfo, Type>, 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,
|
||||
|
|
|
@ -409,7 +409,7 @@ LogicalResult ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
|
|||
// 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);
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
// 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();
|
||||
|
|
Loading…
Reference in New Issue