[all-commits] [llvm/llvm-project] 8c258f: [ADT][mlir][NFCI] Do not use non-const lvalue-refs...

Jakub Kuderski via All-commits all-commits at lists.llvm.org
Wed Mar 15 07:48:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8c258fda1f9b33fc847cfff9c2ee33ce4615ff0b
      https://github.com/llvm/llvm-project/commit/8c258fda1f9b33fc847cfff9c2ee33ce4615ff0b
  Author: Jakub Kuderski <kubak at google.com>
  Date:   2023-03-15 (Wed, 15 Mar 2023)

  Changed paths:
    M mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
    M mlir/lib/Bytecode/Writer/IRNumbering.cpp
    M mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
    M mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
    M mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
    M mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp
    M mlir/lib/Dialect/Affine/Analysis/Utils.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    M mlir/lib/Dialect/Linalg/Transforms/SplitReduction.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
    M mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
    M mlir/lib/Dialect/SCF/IR/SCF.cpp
    M mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp
    M mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
    M mlir/lib/Dialect/Transform/IR/TransformInterfaces.cpp
    M mlir/lib/Dialect/Vector/Transforms/VectorDistribute.cpp
    M mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp
    M mlir/lib/Dialect/X86Vector/Transforms/AVXTranspose.cpp
    M mlir/lib/ExecutionEngine/ExecutionEngine.cpp
    M mlir/lib/IR/AsmPrinter.cpp
    M mlir/lib/Pass/PassStatistics.cpp
    M mlir/lib/TableGen/Operator.cpp
    M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
    M mlir/lib/Transforms/TopologicalSort.cpp
    M mlir/lib/Transforms/Utils/ControlFlowSinkUtils.cpp
    M mlir/test/lib/Analysis/DataFlow/TestDenseDataFlowAnalysis.cpp
    M mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
    M mlir/tools/mlir-tblgen/EnumsGen.cpp
    M mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [ADT][mlir][NFCI] Do not use non-const lvalue-refs with enumerate

Replace references to enumerate results with either result_pairs
(reference wrapper type) or structured bindings. I did not use
structured bindings everywhere as it wasn't clear to me it would
improve readability.

This is in preparation to the switch to zip semantics which won't
support non-const lvalue reference to elements:
https://reviews.llvm.org/D144503.

I chose to use values instead of const lvalue-refs because MLIR is
biased towards avoiding `const` local variables. This won't degrade
performance because currently `result_pair` is cheap to copy (size_t
+ iterator), and in the future, the enumerator iterator dereference
will return temporaries anyway.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D146006




More information about the All-commits mailing list