The hash function for MI expressions, used by MachineCSE, is really
authorChandler Carruth <chandlerc@gmail.com>
Thu, 5 Jul 2012 10:03:57 +0000 (10:03 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 5 Jul 2012 10:03:57 +0000 (10:03 +0000)
commitb8087451cadab83332d6ba9c65227b6e925ea38f
tree41dbd04071ba30c1dfec194fbb20aee76f76d1ec
parente7de3b29f79b147a8f06e6edff0c54149d638139
The hash function for MI expressions, used by MachineCSE, is really
broken. This patch fixes the superficial problems which lead to the
intractably slow compile times reported in PR13225.

The specific issue is that we were failing to include the *offset* of
a global variable in the hash code. Oops. This would in turn cause all
MIs which were only distinguishable due to operating on different
offsets of a global variable to produce identical hash functions. In
some of the test cases attached to the PR I saw hash table activity
where there were O(1000) probes-per-lookup *on average*. A very few
entries were responsible for most of these probes.

There is still quite a bit more to do here. The ad-hoc layering of data
in MachineOperands makes them *extremely* brittle to hash correctly.
We're missing quite a few other cases, the only ones I've fixed here are
the specific MO types which were allowed through the assert() in
getOffset().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159741 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/MachineInstr.cpp