Replace the ad-hoc hashing in GVN with the new hashing infrastructure.
authorChandler Carruth <chandlerc@gmail.com>
Mon, 5 Mar 2012 11:29:54 +0000 (11:29 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 5 Mar 2012 11:29:54 +0000 (11:29 +0000)
commit16003d0c0c20256dc02d0a922d41ad0c7e9c726c
tree0bfee94f9256821fb52619fc85d9a536f2acd973
parentc78bd9ba6beaa42e2c1de14a3cc519cfdbfd593a
Replace the ad-hoc hashing in GVN with the new hashing infrastructure.
This implicitly fixes a nasty bug in the GVN hashing (that thankfully
could only manifest as a performance bug): actually include the opcode
in the hash. The old code started the hash off with the opcode, but then
overwrote it with the type pointer.

Since this is likely to be pretty hot (GVN being already pretty
expensive) I've included a micro-optimization to just not bother with
the varargs hashing if they aren't present. I can't measure any change
in GVN performance due to this, even with a big test case like Duncan's
sqlite one. Everything I see is in the noise floor. That said, this
closes a loop hole for a potential scaling problem due to collisions if
the opcode were the differentiating aspect of the expression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152025 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/GVN.cpp