[llvm] c6cec7b - [CodeGen] Make hash_value a non-friend function (NFC) (#137564)

via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 27 18:17:19 PDT 2025


Author: Kazu Hirata
Date: 2025-04-27T18:17:15-07:00
New Revision: c6cec7bd9cef993b377903b88375e00badcbf11b

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

LOG: [CodeGen] Make hash_value a non-friend function (NFC) (#137564)

We can implement hash_value with publicly available methods of Vector.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/PBQP/Math.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/CodeGen/PBQP/Math.h b/llvm/include/llvm/CodeGen/PBQP/Math.h
index 3dc158d9ac8b9..1cbbeeba3f32b 100644
--- a/llvm/include/llvm/CodeGen/PBQP/Math.h
+++ b/llvm/include/llvm/CodeGen/PBQP/Math.h
@@ -25,8 +25,6 @@ using PBQPNum = float;
 
 /// PBQP Vector class.
 class Vector {
-  friend hash_code hash_value(const Vector &);
-
 public:
   /// Construct a PBQP vector of the given size.
   explicit Vector(unsigned Length) : Data(Length) {}
@@ -96,7 +94,7 @@ class Vector {
 inline hash_code hash_value(const Vector &V) {
   const unsigned *VBegin = reinterpret_cast<const unsigned *>(V.begin());
   const unsigned *VEnd = reinterpret_cast<const unsigned *>(V.end());
-  return hash_combine(V.Data.size(), hash_combine_range(VBegin, VEnd));
+  return hash_combine(V.getLength(), hash_combine_range(VBegin, VEnd));
 }
 
 /// Output a textual representation of the given vector on the given


        


More information about the llvm-commits mailing list