[PATCH] D114990: Avoid by-value copies of referenced objects

Nathan Sidwell via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 16 07:23:06 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdd073e08aeb5: Avoid by-value copies of referenced objects (authored by urnathan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114990

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
  llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
  llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp


Index: llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
===================================================================
--- llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
+++ llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
@@ -349,7 +349,7 @@
           // Add the registers this load reads to those we check for clobbers.
           for (unsigned i = InstrDesc.getNumDefs(),
                         e = InstrDesc.getNumOperands(); i != e; i++) {
-            const auto Operand = NodeInstr.Instruction.getOperand(i);
+            const auto &Operand = NodeInstr.Instruction.getOperand(i);
             if (Operand.isReg())
               CurRegisterNumbers.insert(Operand.getReg());
           }
Index: llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
===================================================================
--- llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
+++ llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
@@ -531,7 +531,7 @@
             << LR->Locations.size() << "\n";
         Log << "    " << NumDwarfInlineInfos << " DWARF frames:\n";
         for (size_t Idx = 0; Idx < NumDwarfInlineInfos; ++Idx) {
-          const auto dii = DwarfInlineInfos.getFrame(Idx);
+          const auto &dii = DwarfInlineInfos.getFrame(Idx);
           Log << "    [" << Idx << "]: " << dii.FunctionName << " @ "
               << dii.FileName << ':' << dii.Line << '\n';
         }
@@ -551,7 +551,7 @@
             ++Idx) {
         const auto &gii = LR->Locations[Idx];
         if (Idx < NumDwarfInlineInfos) {
-          const auto dii = DwarfInlineInfos.getFrame(Idx);
+          const auto &dii = DwarfInlineInfos.getFrame(Idx);
           gsymFilename = LR->getSourceFile(Idx);
           // Verify function name
           if (dii.FunctionName.find(gii.Name.str()) != 0)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -301,7 +301,7 @@
       if (IgnoreNodeResults(N->getOperand(i).getNode()))
         continue;
 
-      const auto Op = N->getOperand(i);
+      const auto &Op = N->getOperand(i);
       LLVM_DEBUG(dbgs() << "Analyzing operand: "; Op.dump(&DAG));
       EVT OpVT = Op.getValueType();
       switch (getTypeAction(OpVT)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114990.394874.patch
Type: text/x-patch
Size: 2330 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211216/68557edd/attachment.bin>


More information about the llvm-commits mailing list