[llvm] ab5ee34 - [GlobalISel] Ensure MachineIRBuilder::getDebugLoc() returns a const reference. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat May 8 08:25:07 PDT 2021


Author: Simon Pilgrim
Date: 2021-05-08T16:23:28+01:00
New Revision: ab5ee342b92b4661cfec3cdd647c9a5c18e346dd

URL: https://github.com/llvm/llvm-project/commit/ab5ee342b92b4661cfec3cdd647c9a5c18e346dd
DIFF: https://github.com/llvm/llvm-project/commit/ab5ee342b92b4661cfec3cdd647c9a5c18e346dd.diff

LOG: [GlobalISel] Ensure MachineIRBuilder::getDebugLoc() returns a const reference. NFCI.

Avoids a lot of unnecessary tracking increments/decrements of the underlying TrackingMDNodeRef.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h b/llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
index ccc44b46a3752..7f8b9ac9d18fd 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h
@@ -363,7 +363,7 @@ class MachineIRBuilder {
   void setDebugLoc(const DebugLoc &DL) { this->State.DL = DL; }
 
   /// Get the current instruction's debug location.
-  DebugLoc getDebugLoc() { return State.DL; }
+  const DebugLoc &getDebugLoc() { return State.DL; }
 
   /// Build and insert <empty> = \p Opcode <empty>.
   /// The insertion point is the one set by the last call of either


        


More information about the llvm-commits mailing list