[llvm-commits] [llvm] r122727 - in /llvm/trunk: lib/Transforms/Scalar/EarlyCSE.cpp test/Transforms/EarlyCSE/basic.ll
Duncan Sands
baldrick at free.fr
Mon Jan 3 04:43:47 PST 2011
Hi Chris,
> +unsigned DenseMapInfo<MemoryValue>::getHashValue(MemoryValue 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)
> + Res ^= getHash(Inst->getOperand(i))<< i;
> + // Mix in the opcode.
> + return (Res<< 1) ^ Inst->getOpcode();
> +}
for calls you could also hash in the attributes.
Ciao, Duncan.
More information about the llvm-commits
mailing list