diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-01 12:30:59 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-01 12:30:59 +0000 |
| commit | 6ab86b1bb6bbffb6fdd6241cb87ac18c33b8453e (patch) | |
| tree | d7e10409e310fd44afab515da6601c71cd26def0 /llvm/lib/Transforms | |
| parent | d294bdb5ad1681e08169dc3c836ed5d81602eb88 (diff) | |
| download | bcm5719-llvm-6ab86b1bb6bbffb6fdd6241cb87ac18c33b8453e.tar.gz bcm5719-llvm-6ab86b1bb6bbffb6fdd6241cb87ac18c33b8453e.zip | |
EarlyCSE: Replace custom hash mixing with Hashing.h
Brings it in line with the other hashes in EarlyCSE.
llvm-svn: 227733
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index c8dc7711746..9a9f9651f3f 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -42,10 +42,6 @@ STATISTIC(NumCSELoad, "Number of load instructions CSE'd"); STATISTIC(NumCSECall, "Number of call instructions CSE'd"); STATISTIC(NumDSE, "Number of trivial dead stores removed"); -static unsigned getHash(const void *V) { - return DenseMapInfo<const void*>::getHashValue(V); -} - //===----------------------------------------------------------------------===// // SimpleValue //===----------------------------------------------------------------------===// @@ -239,16 +235,10 @@ template <> struct DenseMapInfo<CallValue> { unsigned DenseMapInfo<CallValue>::getHashValue(CallValue Val) { Instruction *Inst = Val.Inst; - // Hash in all of the operands as pointers. - unsigned Res = 0; - 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 & 0xF); - } - - // Mix in the opcode. - return (Res << 1) ^ Inst->getOpcode(); + // Hash all of the operands as pointers and mix in the opcode. + return hash_combine( + Inst->getOpcode(), + hash_combine_range(Inst->value_op_begin(), Inst->value_op_end())); } bool DenseMapInfo<CallValue>::isEqual(CallValue LHS, CallValue RHS) { |

