mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
EarlyCSE: Replace custom hash mixing with Hashing.h
Brings it in line with the other hashes in EarlyCSE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227733 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
276f405407
commit
5dffd27576
@ -42,10 +42,6 @@ STATISTIC(NumCSELoad, "Number of load instructions CSE'd");
|
|||||||
STATISTIC(NumCSECall, "Number of call instructions CSE'd");
|
STATISTIC(NumCSECall, "Number of call instructions CSE'd");
|
||||||
STATISTIC(NumDSE, "Number of trivial dead stores removed");
|
STATISTIC(NumDSE, "Number of trivial dead stores removed");
|
||||||
|
|
||||||
static unsigned getHash(const void *V) {
|
|
||||||
return DenseMapInfo<const void*>::getHashValue(V);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// SimpleValue
|
// SimpleValue
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -239,16 +235,10 @@ template <> struct DenseMapInfo<CallValue> {
|
|||||||
|
|
||||||
unsigned DenseMapInfo<CallValue>::getHashValue(CallValue Val) {
|
unsigned DenseMapInfo<CallValue>::getHashValue(CallValue Val) {
|
||||||
Instruction *Inst = Val.Inst;
|
Instruction *Inst = Val.Inst;
|
||||||
// Hash in all of the operands as pointers.
|
// Hash all of the operands as pointers and mix in the opcode.
|
||||||
unsigned Res = 0;
|
return hash_combine(
|
||||||
for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i) {
|
Inst->getOpcode(),
|
||||||
assert(!Inst->getOperand(i)->getType()->isMetadataTy() &&
|
hash_combine_range(Inst->value_op_begin(), Inst->value_op_end()));
|
||||||
"Cannot value number calls with metadata operands");
|
|
||||||
Res ^= getHash(Inst->getOperand(i)) << (i & 0xF);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mix in the opcode.
|
|
||||||
return (Res << 1) ^ Inst->getOpcode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DenseMapInfo<CallValue>::isEqual(CallValue LHS, CallValue RHS) {
|
bool DenseMapInfo<CallValue>::isEqual(CallValue LHS, CallValue RHS) {
|
||||||
|
Loading…
Reference in New Issue
Block a user