[llvm] [StructuralHash] Global Variable (PR #118412)

Kyungwoo Lee via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 22:39:39 PST 2024


================
@@ -98,14 +123,21 @@ class StructuralHashImpl {
       return stable_hash_combine(Hashes);
     }
 
+    if (auto *GVar = dyn_cast<GlobalVariable>(C)) {
+      Hashes.emplace_back(hashGlobalVariable(*GVar));
+      return stable_hash_combine(Hashes);
+    }
+
     if (auto *G = dyn_cast<GlobalValue>(C)) {
       Hashes.emplace_back(hashGlobalValue(G));
       return stable_hash_combine(Hashes);
     }
 
     if (const auto *Seq = dyn_cast<ConstantDataSequential>(C)) {
-      Hashes.emplace_back(xxh3_64bits(Seq->getRawDataValues()));
-      return stable_hash_combine(Hashes);
+      if (Seq->isString()) {
----------------
kyulee-com wrote:

If you see below in the switch statement, `ConstantArrayVal` or `ConstantVectorVal` (that inherits `ConstantDataSequentials`) should cover the rest by handling each Constant element. 

https://github.com/llvm/llvm-project/pull/118412


More information about the llvm-commits mailing list