Skip to content

[TableGen] Use const auto& instead of auto to avoid copy #113053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 21, 2024

Conversation

abhishek-kaushik22
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 19, 2024

@llvm/pr-subscribers-tablegen

Author: None (abhishek-kaushik22)

Changes

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

1 Files Affected:

  • (modified) llvm/utils/TableGen/InstrDocsEmitter.cpp (+1-1)
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

Copy link
Contributor

@kazutakahirata kazutakahirata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@abhishek-kaushik22
Copy link
Contributor Author

@kazutakahirata Can you please merge?

@abhishek-kaushik22 abhishek-kaushik22 changed the title Use const auto& instead of auto to avoid copy [TableGen] Use const auto& instead of auto to avoid copy Nov 21, 2024
@e-kud e-kud merged commit cec5296 into llvm:main Nov 21, 2024
8 checks passed
@abhishek-kaushik22 abhishek-kaushik22 deleted the test branch December 9, 2024 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants