[CodeGen] Ensure UserValue::getDebugLoc() and UserLabel::getDebugLoc() consistently...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 7 May 2021 13:48:10 +0000 (14:48 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 7 May 2021 13:48:23 +0000 (14:48 +0100)
Avoids a lot of unnecessary tracking increments/decrements of the underlying TrackingMDNodeRef.

llvm/lib/CodeGen/LiveDebugVariables.cpp

index ce898cd..100dacb 100644 (file)
@@ -473,7 +473,7 @@ public:
                        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 @@ public:
                       BlockSkipInstsMap &BBSkipInstsMap);
 
   /// Return DebugLoc of this UserLabel.
-  DebugLoc getDebugLoc() { return dl; }
+  const DebugLoc &getDebugLoc() { return dl; }
 
   void print(raw_ostream &, const TargetRegisterInfo *);
 };