[llvm] [StableHash] Implement stable global name for the hash computation (PR #106156)
    Ellis Hoag via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Aug 27 12:49:14 PDT 2024
    
    
  
================
@@ -95,13 +95,21 @@ stable_hash llvm::stableHashValue(const MachineOperand &MO) {
   case MachineOperand::MO_Metadata:
     StableHashBailingMetadataUnsupported++;
     return 0;
-  case MachineOperand::MO_GlobalAddress:
-    StableHashBailingGlobalAddress++;
-    return 0;
+  case MachineOperand::MO_GlobalAddress: {
+    const GlobalValue *GV = MO.getGlobal();
+    if (!GV->hasName()) {
+      StableHashBailingGlobalAddress++;
----------------
ellishg wrote:
```suggestion
      ++StableHashBailingGlobalAddress;
```
Prefer preincrement, but you might also want to change the rest of the stats variables.
https://llvm.org/docs/CodingStandards.html#prefer-preincrement
https://github.com/llvm/llvm-project/pull/106156
    
    
More information about the llvm-commits
mailing list