[llvm] Use `const auto&` instead of `auto` to avoid copy (PR #113053)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 19 10:05:11 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tablegen

Author: None (abhishek-kaushik22)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/113053.diff


1 Files Affected:

- (modified) llvm/utils/TableGen/InstrDocsEmitter.cpp (+1-1) 


``````````diff
diff --git a/llvm/utils/TableGen/InstrDocsEmitter.cpp b/llvm/utils/TableGen/InstrDocsEmitter.cpp
index 5f22fb417198bc..54ca7d8ae40da4 100644
--- a/llvm/utils/TableGen/InstrDocsEmitter.cpp
+++ b/llvm/utils/TableGen/InstrDocsEmitter.cpp
@@ -159,7 +159,7 @@ static void EmitInstrDocs(const RecordKeeper &RK, raw_ostream &OS) {
     // Operands.
     for (unsigned i = 0; i < II->Operands.size(); ++i) {
       bool IsDef = i < II->Operands.NumDefs;
-      auto Op = II->Operands[i];
+      const auto &Op = II->Operands[i];
 
       if (Op.MINumOperands > 1) {
         // This operand corresponds to multiple operands on the

``````````

</details>


https://github.com/llvm/llvm-project/pull/113053


More information about the llvm-commits mailing list