[llvm] [CodeGen] Make hash_value a non-friend function (NFC) (PR #137564)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 27 16:40:45 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/137564
We can implement hash_value with publicly available methods of Vector.
>From 732ade30801d479b279e55054fbe216a43239a66 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 27 Apr 2025 14:25:45 -0700
Subject: [PATCH] [CodeGen] Make hash_value a non-friend function (NFC)
We can implement hash_value with publicly available methods of Vector.
---
llvm/include/llvm/CodeGen/PBQP/Math.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
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