Warning: Code is a mess, not for real review. This is mostly for @nikic to take a look and tell me if I missed something fundamental.
Background:
- DecomposeGEP needed to be in sync with getUnderlyingObject in a very fragile manner. However, I can't find any good reason for this. Simple recursing through the base of the decomposed gep gives us the same number of recursive calls, and it doesn't seem to matter if the underlying object search is ahead of the recursion. All it does is add a small constant amount of additional work per step, at worst.
- We can often find a single underlying object, even after searching through a phi graph. The existing recursive phi handling is one instance of this (but done in the recursive step).
- If we allow the underlying logic search to traverse phi graphs, even with small limits (e.g. 6) we find interesting cases.
@nikic - I'm mostly looking for a sanity check here. This feels "too easy". Have I managed to miss something fundamental here?
clang-format: please reformat the code