[llvm] Added const reference for params wth size >= 16 bytes (PR #125074)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 07:39:37 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-selectiondag

@llvm/pr-subscribers-backend-risc-v

Author: Herman Semenoff (GermanAizek)

<details>
<summary>Changes</summary>

For better optimized code generation functions calls by compiler, objects sizes equal to or greater than 16 bytes must be pass by constant reference. A constant reference is also useful as refactoring technique that indicates that param is a constant.

Reference: https://stackoverflow.com/a/3314034

---

Patch is 267.62 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/125074.diff


127 Files Affected:

- (modified) llvm/include/llvm/Analysis/AliasSetTracker.h (+1-1) 
- (modified) llvm/include/llvm/Analysis/AssumeBundleQueries.h (+3-3) 
- (modified) llvm/include/llvm/Bitcode/BitcodeReader.h (+17-17) 
- (modified) llvm/include/llvm/Bitcode/BitcodeWriter.h (+1-1) 
- (modified) llvm/include/llvm/CGData/CodeGenData.h (+1-1) 
- (modified) llvm/include/llvm/CodeGen/AsmPrinter.h (+3-3) 
- (modified) llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h (+1-1) 
- (modified) llvm/include/llvm/CodeGen/MachineFunction.h (+1-1) 
- (modified) llvm/include/llvm/CodeGen/SelectionDAG.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h (+2-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h (+2-2) 
- (modified) llvm/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h (+7-7) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h (+2-2) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h (+2-2) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h (+5-5) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h (+2-2) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h (+5-5) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFGdbIndex.h (+2-2) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h (+4-4) 
- (modified) llvm/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h (+3-3) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h (+1-1) 
- (modified) llvm/include/llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h (+1-1) 
- (modified) llvm/include/llvm/Debuginfod/Debuginfod.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/COFF.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/COFF_x86_64.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/ELF.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch32.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/ELF_aarch64.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/ELF_i386.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/ELF_loongarch.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/JITLink/ELF_x86_64.h (+1-1) 
- (modified) llvm/include/llvm/ExecutionEngine/Orc/Core.h (+1-1) 
- (modified) llvm/include/llvm/IR/InstrTypes.h (+39-39) 
- (modified) llvm/include/llvm/IR/Instructions.h (+105-105) 
- (modified) llvm/include/llvm/Object/Binary.h (+1-1) 
- (modified) llvm/include/llvm/Object/COFFModuleDefinition.h (+1-1) 
- (modified) llvm/include/llvm/Object/DXContainer.h (+1-1) 
- (modified) llvm/include/llvm/Object/ObjectFile.h (+2-2) 
- (modified) llvm/include/llvm/SandboxIR/Instruction.h (+41-41) 
- (modified) llvm/include/llvm/Support/BinaryStreamWriter.h (+2-2) 
- (modified) llvm/lib/Bitcode/Reader/BitcodeReader.cpp (+20-20) 
- (modified) llvm/lib/Bitcode/Writer/BitcodeWriter.cpp (+2-2) 
- (modified) llvm/lib/CGData/CodeGenData.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (+4-4) 
- (modified) llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (+2-2) 
- (modified) llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h (+2-2) 
- (modified) llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp (+3-3) 
- (modified) llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp (+1-1) 
- (modified) llvm/lib/CodeGen/MachineFunction.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/CodeView/CVTypeVisitor.cpp (+4-4) 
- (modified) llvm/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/CodeView/DebugStringTableSubsection.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFAddressRange.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFContext.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp (+8-8) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (+2-2) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp (+3-3) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp (+2-2) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFDie.cpp (+4-4) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp (+3-3) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp (+4-4) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp (+2-2) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFListTable.cpp (+2-2) 
- (modified) llvm/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp (+3-3) 
- (modified) llvm/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp (+1-1) 
- (modified) llvm/lib/DebugInfo/PDB/Native/DbiModuleList.cpp (+2-2) 
- (modified) llvm/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp (+1-1) 
- (modified) llvm/lib/Debuginfod/Debuginfod.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/Interpreter/Execution.cpp (+31-31) 
- (modified) llvm/lib/ExecutionEngine/Interpreter/Interpreter.h (+2-2) 
- (modified) llvm/lib/ExecutionEngine/JITLink/COFF.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/ELF.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/ELF_aarch32.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/ELF_aarch64.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/ELF_i386.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/ELF_loongarch.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/Orc/Core.cpp (+1-1) 
- (modified) llvm/lib/ExecutionEngine/Orc/DebugObjectManagerPlugin.cpp (+5-5) 
- (modified) llvm/lib/IR/AsmWriter.cpp (+1-1) 
- (modified) llvm/lib/IR/Instructions.cpp (+90-90) 
- (modified) llvm/lib/ObjCopy/ELF/ELFObject.cpp (+2-2) 
- (modified) llvm/lib/ObjCopy/ELF/ELFObject.h (+2-2) 
- (modified) llvm/lib/Object/Archive.cpp (+3-3) 
- (modified) llvm/lib/Object/ArchiveWriter.cpp (+1-1) 
- (modified) llvm/lib/Object/Binary.cpp (+1-1) 
- (modified) llvm/lib/Object/COFFModuleDefinition.cpp (+1-1) 
- (modified) llvm/lib/Object/COFFObjectFile.cpp (+4-4) 
- (modified) llvm/lib/Object/DXContainer.cpp (+1-1) 
- (modified) llvm/lib/Object/GOFFObjectFile.cpp (+1-1) 
- (modified) llvm/lib/SandboxIR/Instruction.cpp (+39-39) 
- (modified) llvm/lib/Support/AMDGPUMetadata.cpp (+1-1) 
- (modified) llvm/lib/Support/BinaryStreamWriter.cpp (+2-2) 
- (modified) llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp (+4-3) 
- (modified) llvm/lib/Target/AArch64/AArch64FrameLowering.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp (+2-2) 
- (modified) llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.h (+2-2) 
- (modified) llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp (+1-1) 
- (modified) llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (+2-2) 
- (modified) llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h (+3-3) 
- (modified) llvm/lib/Target/AMDGPU/Utils/AMDGPUDelayedMCExpr.cpp (+2-2) 
- (modified) llvm/lib/Target/ARM/ARMInstructionSelector.cpp (+4-4) 
- (modified) llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp (+6-4) 
- (modified) llvm/lib/Target/ARM/Utils/ARMBaseInfo.h (+2-2) 
- (modified) llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp (+1-1) 
- (modified) llvm/lib/TargetParser/ARMTargetParser.cpp (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/Analysis/AliasSetTracker.h b/llvm/include/llvm/Analysis/AliasSetTracker.h
index e5817d2409bc651..917df86d8d01de1 100644
--- a/llvm/include/llvm/Analysis/AliasSetTracker.h
+++ b/llvm/include/llvm/Analysis/AliasSetTracker.h
@@ -249,7 +249,7 @@ class AliasSetTracker {
     }
   }
 
-  AliasSet &addMemoryLocation(MemoryLocation Loc, AliasSet::AccessLattice E);
+  AliasSet &addMemoryLocation(const MemoryLocation &Loc, AliasSet::AccessLattice E);
   AliasSet *mergeAliasSetsForMemoryLocation(const MemoryLocation &MemLoc,
                                             AliasSet *PtrAS,
                                             bool &MustAliasAll);
diff --git a/llvm/include/llvm/Analysis/AssumeBundleQueries.h b/llvm/include/llvm/Analysis/AssumeBundleQueries.h
index f7a893708758c5a..3acdd46e86a6e13 100644
--- a/llvm/include/llvm/Analysis/AssumeBundleQueries.h
+++ b/llvm/include/llvm/Analysis/AssumeBundleQueries.h
@@ -100,14 +100,14 @@ struct RetainedKnowledge {
   Attribute::AttrKind AttrKind = Attribute::None;
   uint64_t ArgValue = 0;
   Value *WasOn = nullptr;
-  bool operator==(RetainedKnowledge Other) const {
+  bool operator==(const RetainedKnowledge &Other) const {
     return AttrKind == Other.AttrKind && WasOn == Other.WasOn &&
            ArgValue == Other.ArgValue;
   }
-  bool operator!=(RetainedKnowledge Other) const { return !(*this == Other); }
+  bool operator!=(const RetainedKnowledge &Other) const { return !(*this == Other); }
   /// This is only intended for use in std::min/std::max between attribute that
   /// only differ in ArgValue.
-  bool operator<(RetainedKnowledge Other) const {
+  bool operator<(const RetainedKnowledge &Other) const {
     assert(((AttrKind == Other.AttrKind && WasOn == Other.WasOn) ||
             AttrKind == Attribute::None || Other.AttrKind == Attribute::None) &&
            "This is only intend for use in min/max to select the best for "
diff --git a/llvm/include/llvm/Bitcode/BitcodeReader.h b/llvm/include/llvm/Bitcode/BitcodeReader.h
index f204060a3a97871..09ece3eae8c4b51 100644
--- a/llvm/include/llvm/Bitcode/BitcodeReader.h
+++ b/llvm/include/llvm/Bitcode/BitcodeReader.h
@@ -119,12 +119,12 @@ struct ParserCallbacks {
 
     // Calls the ctor.
     friend Expected<BitcodeFileContents>
-    getBitcodeFileContents(MemoryBufferRef Buffer);
+    getBitcodeFileContents(const MemoryBufferRef &Buffer);
 
     Expected<std::unique_ptr<Module>>
     getModuleImpl(LLVMContext &Context, bool MaterializeAll,
                   bool ShouldLazyLoadMetadata, bool IsImporting,
-                  ParserCallbacks Callbacks = {});
+                  const ParserCallbacks &Callbacks = {});
 
   public:
     StringRef getBuffer() const {
@@ -141,11 +141,11 @@ struct ParserCallbacks {
     /// importing into another module.
     Expected<std::unique_ptr<Module>>
     getLazyModule(LLVMContext &Context, bool ShouldLazyLoadMetadata,
-                  bool IsImporting, ParserCallbacks Callbacks = {});
+                  bool IsImporting, const ParserCallbacks &Callbacks = {});
 
     /// Read the entire bitcode module and return it.
     Expected<std::unique_ptr<Module>>
-    parseModule(LLVMContext &Context, ParserCallbacks Callbacks = {});
+    parseModule(LLVMContext &Context, const ParserCallbacks &Callbacks = {});
 
     /// Returns information about the module to be used for LTO: whether to
     /// compile with ThinLTO, and whether it has a summary.
@@ -171,21 +171,21 @@ struct ParserCallbacks {
   /// symbol table should prefer to use irsymtab::read instead of this function
   /// because it creates a reader for the irsymtab and handles upgrading bitcode
   /// files without a symbol table or with an old symbol table.
-  Expected<BitcodeFileContents> getBitcodeFileContents(MemoryBufferRef Buffer);
+  Expected<BitcodeFileContents> getBitcodeFileContents(const MemoryBufferRef &Buffer);
 
   /// Returns a list of modules in the specified bitcode buffer.
   Expected<std::vector<BitcodeModule>>
-  getBitcodeModuleList(MemoryBufferRef Buffer);
+  getBitcodeModuleList(const MemoryBufferRef &Buffer);
 
   /// Read the header of the specified bitcode buffer and prepare for lazy
   /// deserialization of function bodies. If ShouldLazyLoadMetadata is true,
   /// lazily load metadata as well. If IsImporting is true, this module is
   /// being parsed for ThinLTO importing into another module.
   Expected<std::unique_ptr<Module>>
-  getLazyBitcodeModule(MemoryBufferRef Buffer, LLVMContext &Context,
+  getLazyBitcodeModule(const MemoryBufferRef &Buffer, LLVMContext &Context,
                        bool ShouldLazyLoadMetadata = false,
                        bool IsImporting = false,
-                       ParserCallbacks Callbacks = {});
+                       const ParserCallbacks &Callbacks = {});
 
   /// Like getLazyBitcodeModule, except that the module takes ownership of
   /// the memory buffer if successful. If successful, this moves Buffer. On
@@ -194,36 +194,36 @@ struct ParserCallbacks {
   Expected<std::unique_ptr<Module>> getOwningLazyBitcodeModule(
       std::unique_ptr<MemoryBuffer> &&Buffer, LLVMContext &Context,
       bool ShouldLazyLoadMetadata = false, bool IsImporting = false,
-      ParserCallbacks Callbacks = {});
+      const ParserCallbacks &Callbacks = {});
 
   /// Read the header of the specified bitcode buffer and extract just the
   /// triple information. If successful, this returns a string. On error, this
   /// returns "".
-  Expected<std::string> getBitcodeTargetTriple(MemoryBufferRef Buffer);
+  Expected<std::string> getBitcodeTargetTriple(const MemoryBufferRef &Buffer);
 
   /// Return true if \p Buffer contains a bitcode file with ObjC code (category
   /// or class) in it.
-  Expected<bool> isBitcodeContainingObjCCategory(MemoryBufferRef Buffer);
+  Expected<bool> isBitcodeContainingObjCCategory(const MemoryBufferRef &Buffer);
 
   /// Read the header of the specified bitcode buffer and extract just the
   /// producer string information. If successful, this returns a string. On
   /// error, this returns "".
-  Expected<std::string> getBitcodeProducerString(MemoryBufferRef Buffer);
+  Expected<std::string> getBitcodeProducerString(const MemoryBufferRef &Buffer);
 
   /// Read the specified bitcode file, returning the module.
   Expected<std::unique_ptr<Module>>
-  parseBitcodeFile(MemoryBufferRef Buffer, LLVMContext &Context,
-                   ParserCallbacks Callbacks = {});
+  parseBitcodeFile(const MemoryBufferRef &Buffer, LLVMContext &Context,
+                   const ParserCallbacks &Callbacks = {});
 
   /// Returns LTO information for the specified bitcode file.
-  Expected<BitcodeLTOInfo> getBitcodeLTOInfo(MemoryBufferRef Buffer);
+  Expected<BitcodeLTOInfo> getBitcodeLTOInfo(const MemoryBufferRef &Buffer);
 
   /// Parse the specified bitcode buffer, returning the module summary index.
   Expected<std::unique_ptr<ModuleSummaryIndex>>
-  getModuleSummaryIndex(MemoryBufferRef Buffer);
+  getModuleSummaryIndex(const MemoryBufferRef &Buffer);
 
   /// Parse the specified bitcode buffer and merge the index into CombinedIndex.
-  Error readModuleSummaryIndex(MemoryBufferRef Buffer,
+  Error readModuleSummaryIndex(const MemoryBufferRef &Buffer,
                                ModuleSummaryIndex &CombinedIndex);
 
   /// Parse the module summary index out of an IR file and return the module
diff --git a/llvm/include/llvm/Bitcode/BitcodeWriter.h b/llvm/include/llvm/Bitcode/BitcodeWriter.h
index 2823b438f80bf40..db4c752abc5ed78 100644
--- a/llvm/include/llvm/Bitcode/BitcodeWriter.h
+++ b/llvm/include/llvm/Bitcode/BitcodeWriter.h
@@ -163,7 +163,7 @@ void writeIndexToFile(
 /// If EmbedCmdline is set, the command line is also exported in
 /// the corresponding section (__LLVM,_cmdline / .llvmcmd) - even if CmdArgs
 /// were empty.
-void embedBitcodeInModule(Module &M, MemoryBufferRef Buf, bool EmbedBitcode,
+void embedBitcodeInModule(Module &M, const MemoryBufferRef &Buf, bool EmbedBitcode,
                           bool EmbedCmdline,
                           const std::vector<uint8_t> &CmdArgs);
 
diff --git a/llvm/include/llvm/CGData/CodeGenData.h b/llvm/include/llvm/CGData/CodeGenData.h
index da0e412f2a0e036..ba62f7332818ff6 100644
--- a/llvm/include/llvm/CGData/CodeGenData.h
+++ b/llvm/include/llvm/CGData/CodeGenData.h
@@ -265,7 +265,7 @@ std::unique_ptr<Module> loadModuleForTwoRounds(BitcodeModule &OrigModule,
 Expected<stable_hash> mergeCodeGenData(ArrayRef<StringRef> ObjectFiles);
 
 void warn(Error E, StringRef Whence = "");
-void warn(Twine Message, std::string Whence = "", std::string Hint = "");
+void warn(const Twine &Message, const std::string &Whence = "", const std::string &Hint = "");
 
 } // end namespace cgdata
 
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 5291369b3b9f1d8..18a99186bafe871 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -632,7 +632,7 @@ class AsmPrinter : public MachineFunctionPass {
                                          StringRef Suffix) const;
 
   /// Return the MCSymbol for the specified ExternalSymbol.
-  MCSymbol *GetExternalSymbolSymbol(Twine Sym) const;
+  MCSymbol *GetExternalSymbolSymbol(const Twine &Sym) const;
 
   /// Return the symbol for the specified jump table entry.
   MCSymbol *GetJTISymbol(unsigned JTID, bool isLinkerPrivate = false) const;
@@ -723,10 +723,10 @@ class AsmPrinter : public MachineFunctionPass {
   /// emitDwarfSymbolReference().
   ///
   /// The length of the emitted value depends on the DWARF format.
-  void emitDwarfStringOffset(DwarfStringPoolEntry S) const;
+  void emitDwarfStringOffset(const DwarfStringPoolEntry &S) const;
 
   /// Emit the 4-or 8-byte offset of a string from the start of its section.
-  void emitDwarfStringOffset(DwarfStringPoolEntryRef S) const {
+  void emitDwarfStringOffset(const DwarfStringPoolEntryRef &S) const {
     emitDwarfStringOffset(S.getEntry());
   }
 
diff --git a/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h b/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
index 08e6a0e3ef6295c..814879860b1b212 100644
--- a/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
+++ b/llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
@@ -105,7 +105,7 @@ class BasicBlockSectionsProfileReader {
   }
 
   // Returns a profile parsing error for the current line.
-  Error createProfileParseError(Twine Message) const {
+  Error createProfileParseError(const Twine &Message) const {
     return make_error<StringError>(
         Twine("invalid profile " + MBuf->getBufferIdentifier() + " at line " +
               Twine(LineIt.line_number()) + ": " + Message),
diff --git a/llvm/include/llvm/CodeGen/MachineFunction.h b/llvm/include/llvm/CodeGen/MachineFunction.h
index c3eb27b9462879d..861db8147438f73 100644
--- a/llvm/include/llvm/CodeGen/MachineFunction.h
+++ b/llvm/include/llvm/CodeGen/MachineFunction.h
@@ -1059,7 +1059,7 @@ class LLVM_ABI MachineFunction {
       AtomicOrdering Ordering = AtomicOrdering::NotAtomic,
       AtomicOrdering FailureOrdering = AtomicOrdering::NotAtomic);
   MachineMemOperand *getMachineMemOperand(
-      MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, LocationSize Size,
+      const MachinePointerInfo &PtrInfo, MachineMemOperand::Flags F, LocationSize Size,
       Align BaseAlignment, const AAMDNodes &AAInfo = AAMDNodes(),
       const MDNode *Ranges = nullptr, SyncScope::ID SSID = SyncScope::System,
       AtomicOrdering Ordering = AtomicOrdering::NotAtomic,
diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h
index 461c0c1ead16d2c..2f0472661bf26cf 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -1408,7 +1408,7 @@ class SelectionDAG {
                   const MDNode *Ranges = nullptr);
   inline SDValue getLoad(
       ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, EVT VT, const SDLoc &dl,
-      SDValue Chain, SDValue Ptr, SDValue Offset, MachinePointerInfo PtrInfo,
+      SDValue Chain, SDValue Ptr, SDValue Offset, const MachinePointerInfo &PtrInfo,
       EVT MemVT, MaybeAlign Alignment = MaybeAlign(),
       MachineMemOperand::Flags MMOFlags = MachineMemOperand::MONone,
       const AAMDNodes &AAInfo = AAMDNodes(), const MDNode *Ranges = nullptr) {
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h b/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
index 7780e233cab3b0b..7864649c9366088 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h
@@ -30,13 +30,13 @@ enum VisitorDataSource {
                     // supply the bytes.
 };
 
-Error visitTypeRecord(CVType &Record, TypeIndex Index,
+Error visitTypeRecord(CVType &Record, const TypeIndex &Index,
                       TypeVisitorCallbacks &Callbacks,
                       VisitorDataSource Source = VDS_BytesPresent);
 Error visitTypeRecord(CVType &Record, TypeVisitorCallbacks &Callbacks,
                       VisitorDataSource Source = VDS_BytesPresent);
 
-Error visitMemberRecord(CVMemberRecord Record, TypeVisitorCallbacks &Callbacks,
+Error visitMemberRecord(const CVMemberRecord &Record, TypeVisitorCallbacks &Callbacks,
                         VisitorDataSource Source = VDS_BytesPresent);
 Error visitMemberRecord(TypeLeafKind Kind, ArrayRef<uint8_t> Record,
                         TypeVisitorCallbacks &Callbacks);
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h b/llvm/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
index f9d1507af5f3cd6..abf3e63ca06ea9b 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h
@@ -69,7 +69,7 @@ class DebugInlineeLinesSubsectionRef final : public DebugSubsectionRef {
   }
 
   Error initialize(BinaryStreamReader Reader);
-  Error initialize(BinaryStreamRef Section) {
+  Error initialize(const BinaryStreamRef &Section) {
     return initialize(BinaryStreamReader(Section));
   }
 
@@ -101,7 +101,7 @@ class DebugInlineeLinesSubsection final : public DebugSubsection {
   Error commit(BinaryStreamWriter &Writer) const override;
   uint32_t calculateSerializedSize() const override;
 
-  void addInlineSite(TypeIndex FuncId, StringRef FileName, uint32_t SourceLine);
+  void addInlineSite(const TypeIndex &FuncId, StringRef FileName, uint32_t SourceLine);
   void addExtraFile(StringRef FileName);
 
   bool hasExtraFiles() const { return HasExtraFiles; }
diff --git a/llvm/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h b/llvm/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
index 6e5b8adddd4aef4..7b3f0a78af3b6a4 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/DebugStringTableSubsection.h
@@ -36,7 +36,7 @@ class DebugStringTableSubsectionRef : public DebugSubsectionRef {
     return S->kind() == DebugSubsectionKind::StringTable;
   }
 
-  Error initialize(BinaryStreamRef Contents);
+  Error initialize(const BinaryStreamRef &Contents);
   Error initialize(BinaryStreamReader &Reader);
 
   Expected<StringRef> getString(uint32_t Offset) const;
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
index 02b402e86d23399..c5bdf5a5b652298 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
@@ -173,7 +173,7 @@ class DWARFAbbreviationDeclaration {
   getAttributeValueFromOffset(uint32_t AttrIndex, uint64_t Offset,
                               const DWARFUnit &U) const;
 
-  llvm::Expected<ExtractState> extract(DataExtractor Data, uint64_t *OffsetPtr);
+  llvm::Expected<ExtractState> extract(const DataExtractor &Data, uint64_t *OffsetPtr);
   void dump(raw_ostream &OS) const;
 
   // Return an optional byte size of all attribute data in this abbreviation
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
index f4d6c451cbe1d65..55a8d89294bba02 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAddressRange.h
@@ -68,7 +68,7 @@ struct DWARFAddressRange {
     return true;
   }
 
-  void dump(raw_ostream &OS, uint32_t AddressSize, DIDumpOptions DumpOpts = {},
+  void dump(raw_ostream &OS, uint32_t AddressSize, const DIDumpOptions &DumpOpts = {},
             const DWARFObject *Obj = nullptr) const;
 };
 
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
index 6439827ef70f0f0..138fbef4e79d832 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
@@ -34,7 +34,7 @@ class DWARFAbbreviationDeclarationSet {
 
   uint64_t getOffset() const { return Offset; }
   void dump(raw_ostream &OS) const;
-  Error extract(DataExtractor Data, uint64_t *OffsetPtr);
+  Error extract(const DataExtractor &Data, uint64_t *OffsetPtr);
 
   const DWARFAbbreviationDeclaration *
   getAbbreviationDeclaration(uint32_t AbbrCode) const;
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
index ae2a4e2276da0fe..1e7931277ec9d27 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h
@@ -63,7 +63,7 @@ class DWARFDebugAddrTable {
   Error extractPreStandard(const DWARFDataExtractor &Data, uint64_t *OffsetPtr,
                            uint16_t CUVersion, uint8_t CUAddrSize);
 
-  void dump(raw_ostream &OS, DIDumpOptions DumpOpts = {}) const;
+  void dump(raw_ostream &OS, const DIDumpOptions &DumpOpts = {}) const;
 
   /// Return the address based on a given index.
   Expected<uint64_t> getAddrEntry(uint32_t Index) const;
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
index 942de05f6bd84be..928d7889cbf2349 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h
@@ -61,7 +61,7 @@ class DWARFDebugArangeSet {
   DWARFDebugArangeSet() { clear(); }
 
   void clear();
-  Error extract(DWARFDataExtractor data, uint64_t *offset_ptr,
+  Error extract(const DWARFDataExtractor &data, uint64_t *offset_ptr,
                 function_ref<void(Error)> WarningHandler = nullptr);
   void dump(raw_ostream &OS) const;
 
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
index 068674cfae5c56b..8661b2247b9d12b 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h
@@ -27,7 +27,7 @@ class DWARFDebugAranges {
 
 private:
   void clear();
-  void extract(DWARFDataExtractor DebugArangesData,
+  void extract(const DWARFDataExtractor &DebugArangesData,
                function_ref<void(Error)> RecoverableErrorHandler,
                function_ref<void(Error)> WarningHandler);
 
diff --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index a9a3c7edde691e5..624116ab34672c0 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -124,8 +124,8 @@ class UnwindLocation {
   /// Create a location whose value is the result of evaluating a DWARF
   /// expression. This allows complex expressions to be evaluated in order to
   /// unwind a register or CFA value.
-  static UnwindLocation createIsDWARFExpression(DWARFExpression Expr);
-  static UnwindLocation createAtDWARFExpression(DWARFExpression Expr);
+  static UnwindLocation createIsDWARFExpression(const DWARFExpression &Expr);
+  static UnwindLocation createAtDWARFExpression(const DWARFExpression &Expr);
   static UnwindLocation createIsConstant(int32_t Value);
 
   Location getLocation() const { return Kind; }
@@ -164,7 +164,7 @@ class UnwindLocation {
   /// instead of from .debug_frame. This is needed for register number
   /// conversion be...
[truncated]

``````````

</details>


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


More information about the llvm-commits mailing list