diff options
author | Eli Friedman <efriedma@quicinc.com> | 2019-06-01 00:08:54 +0000 |
---|---|---|
committer | Eli Friedman <efriedma@quicinc.com> | 2019-06-01 00:08:54 +0000 |
commit | d8e8722791e4ce6694673d450fdcaf99e5edcbf9 (patch) | |
tree | e56228779679241cfa465d5e72155f93d513d2da /llvm/lib/CodeGen/MachineOperand.cpp | |
parent | eb4d6142dcd53d79d8f8a86908a035582965fc52 (diff) | |
download | llvm-d8e8722791e4ce6694673d450fdcaf99e5edcbf9.zip llvm-d8e8722791e4ce6694673d450fdcaf99e5edcbf9.tar.gz llvm-d8e8722791e4ce6694673d450fdcaf99e5edcbf9.tar.bz2 |
[CodeGen] Fix hashing for MO_ExternalSymbol MachineOperands.
We were hashing the string pointer, not the string, so two instructions
could be identical (isIdenticalTo), but have different hash codes.
This showed up as a very rare, non-deterministic assertion failure
rehashing a DenseMap constructed by MachineOutliner. So there's no
"real" testcase, just a unittest which checks that the hash function
behaves correctly.
I'm a little scared fixing this is going to cause a regression in
outlining or MachineCSE, but hopefully we won't run into any issues.
Differential Revision: https://reviews.llvm.org/D61975
llvm-svn: 362281
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineOperand.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp index a83459e..9458745 100644 --- a/llvm/lib/CodeGen/MachineOperand.cpp +++ b/llvm/lib/CodeGen/MachineOperand.cpp @@ -361,7 +361,7 @@ hash_code llvm::hash_value(const MachineOperand &MO) { return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getIndex()); case MachineOperand::MO_ExternalSymbol: return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getOffset(), - MO.getSymbolName()); + StringRef(MO.getSymbolName())); case MachineOperand::MO_GlobalAddress: return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getGlobal(), MO.getOffset()); |