[llvm] dd21c6b - [DAG] Ensure all SD classes consistently return a const reference with getDebugLoc(). NFCI.

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


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

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

LOG: [DAG] Ensure all SD classes consistently return a const reference with getDebugLoc(). NFCI.

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

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h b/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
index 8788dff6263d..75b4242a415c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
+++ b/llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
@@ -211,7 +211,7 @@ class SDDbgValue {
   bool isVariadic() const { return IsVariadic; }
 
   /// Returns the DebugLoc.
-  DebugLoc getDebugLoc() const { return DL; }
+  const DebugLoc &getDebugLoc() const { return DL; }
 
   /// Returns the SDNodeOrder.  This is the order of the preceding node in the
   /// input.
@@ -251,7 +251,7 @@ class SDDbgLabel {
   MDNode *getLabel() const { return Label; }
 
   /// Returns the DebugLoc.
-  DebugLoc getDebugLoc() const { return DL; }
+  const DebugLoc &getDebugLoc() const { return DL; }
 
   /// Returns the SDNodeOrder.  This is the order of the preceding node in the
   /// input.


        


More information about the llvm-commits mailing list