[PATCH] D146694: [NFC] Fix auto usage to avoid copies

Akshay Khadse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 23 04:46:39 PDT 2023


akshaykhadse updated this revision to Diff 507698.
akshaykhadse marked an inline comment as done.
akshaykhadse added a comment.

Avoid using references for enumerate


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146694/new/

https://reviews.llvm.org/D146694

Files:
  llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/utils/TableGen/InstrInfoEmitter.cpp


Index: llvm/utils/TableGen/InstrInfoEmitter.cpp
===================================================================
--- llvm/utils/TableGen/InstrInfoEmitter.cpp
+++ llvm/utils/TableGen/InstrInfoEmitter.cpp
@@ -117,7 +117,7 @@
 static void PrintDefList(const std::vector<Record *> &Uses, unsigned Num,
                          raw_ostream &OS) {
   OS << "static const MCPhysReg ImplicitList" << Num << "[] = { ";
-  for (auto const & [Idx, U] : enumerate(Uses))
+  for (auto [Idx, U] : enumerate(Uses))
     OS << (Idx ? ", " : "") << getQualifiedName(U);
   OS << " };\n";
 }
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -20963,7 +20963,7 @@
         SDValue RHS = SVN->getOperand(1);
         SmallVector<int, 16> Mask(SVN->getMask());
         bool Merged = true;
-        for (auto const &I : enumerate(Ops)) {
+        for (auto I : enumerate(Ops)) {
           SDValue &Op = I.value();
           if (Op) {
             SmallVector<int, 16> NewMask;
@@ -22451,7 +22451,7 @@
   // Recreate the BUILD_VECTOR, with elements now being Factor times smaller.
   SmallVector<SDValue, 16> NewOps;
   NewOps.reserve(NewIntVT.getVectorNumElements());
-  for (auto const &I : enumerate(N->ops())) {
+  for (auto I : enumerate(N->ops())) {
     SDValue Op = I.value();
     assert(!Op.isUndef() && "FIXME: after allowing UNDEF's, handle them here.");
     unsigned SrcOpIdx = I.index();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146694.507698.patch
Type: text/x-patch
Size: 1561 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230323/dff97708/attachment.bin>


More information about the llvm-commits mailing list