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

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 22:19:56 PST 2024


================
@@ -97,9 +99,14 @@ stable_hash llvm::stableHashValue(const MachineOperand &MO) {
       ++StableHashBailingGlobalAddress;
       return 0;
     }
-    auto Name = GV->getName();
-    return stable_hash_combine(MO.getType(), MO.getTargetFlags(),
-                               stable_hash_name(Name), MO.getOffset());
+    stable_hash GVHash = 0;
+    if (auto *GVar = dyn_cast<GlobalVariable>(GV))
----------------
nocchijiang wrote:

Seems like we can generate meaningful hash for globals regardless of the presence of name. Should we move the `hasName` check after this?

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


More information about the llvm-commits mailing list