Skip to content

Commit d8d6cb7

Browse files
committed
Address comments from nocchijiang
1 parent 58f729a commit d8d6cb7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/CodeGen/MachineStableHash.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,16 @@ stable_hash llvm::stableHashValue(const MachineOperand &MO) {
9595
return 0;
9696
case MachineOperand::MO_GlobalAddress: {
9797
const GlobalValue *GV = MO.getGlobal();
98-
if (!GV->hasName()) {
99-
++StableHashBailingGlobalAddress;
100-
return 0;
101-
}
10298
stable_hash GVHash = 0;
10399
if (auto *GVar = dyn_cast<GlobalVariable>(GV))
104100
GVHash = StructuralHash(*GVar);
105-
if (!GVHash)
101+
if (!GVHash) {
102+
if (!GV->hasName()) {
103+
++StableHashBailingGlobalAddress;
104+
return 0;
105+
}
106106
GVHash = stable_hash_name(GV->getName());
107+
}
107108

108109
return stable_hash_combine(MO.getType(), MO.getTargetFlags(), GVHash,
109110
MO.getOffset());

0 commit comments

Comments
 (0)