[llvm] c9d4b41 - [CodeGen] Ensure UserValue::getDebugLoc() and UserLabel::getDebugLoc() consistently return a const reference NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri May 7 06:48:49 PDT 2021


Author: Simon Pilgrim
Date: 2021-05-07T14:48:23+01:00
New Revision: c9d4b4173b56c5a56d32d07be660f872b9746f87

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

LOG: [CodeGen] Ensure UserValue::getDebugLoc() and UserLabel::getDebugLoc() consistently return a const reference NFCI.

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/LiveDebugVariables.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index ce898cddb791..100dacb1485e 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -473,7 +473,7 @@ class UserValue {
                        BlockSkipInstsMap &BBSkipInstsMap);
 
   /// Return DebugLoc of this UserValue.
-  DebugLoc getDebugLoc() { return dl;}
+  const DebugLoc &getDebugLoc() { return dl; }
 
   void print(raw_ostream &, const TargetRegisterInfo *);
 };
@@ -506,7 +506,7 @@ class UserLabel {
                       BlockSkipInstsMap &BBSkipInstsMap);
 
   /// Return DebugLoc of this UserLabel.
-  DebugLoc getDebugLoc() { return dl; }
+  const DebugLoc &getDebugLoc() { return dl; }
 
   void print(raw_ostream &, const TargetRegisterInfo *);
 };


        


More information about the llvm-commits mailing list