diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-10-12 22:00:26 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-10-12 22:00:26 +0000 |
commit | 154a967c231f9faba0ca7ec732abde802a3e4fd0 (patch) | |
tree | 1cfabb7188b38fafea12fe32b99236953ade4043 /llvm/lib/Transforms/Scalar/EarlyCSE.cpp | |
parent | a098a891ab6ace44a52181627d6557858ed5c051 (diff) | |
download | bcm5719-llvm-154a967c231f9faba0ca7ec732abde802a3e4fd0.tar.gz bcm5719-llvm-154a967c231f9faba0ca7ec732abde802a3e4fd0.zip |
Fix a couple hash functions so that they do not depend on undefined shifts. Based on patch by Ahmed Charles.
llvm-svn: 141820
Diffstat (limited to 'llvm/lib/Transforms/Scalar/EarlyCSE.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index 022af40c638..c0223d2bf19 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -92,7 +92,7 @@ unsigned DenseMapInfo<SimpleValue>::getHashValue(SimpleValue Val) { // Hash in all of the operands as pointers. unsigned Res = 0; for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i) - Res ^= getHash(Inst->getOperand(i)) << i; + Res ^= getHash(Inst->getOperand(i)) << (i & 0xF); if (CastInst *CI = dyn_cast<CastInst>(Inst)) Res ^= getHash(CI->getType()); @@ -185,7 +185,7 @@ unsigned DenseMapInfo<CallValue>::getHashValue(CallValue Val) { for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i) { assert(!Inst->getOperand(i)->getType()->isMetadataTy() && "Cannot value number calls with metadata operands"); - Res ^= getHash(Inst->getOperand(i)) << i; + Res ^= getHash(Inst->getOperand(i)) << (i & 0xF); } // Mix in the opcode. |