Fix another crasher in SROA, reported by Joel.
authorChandler Carruth <chandlerc@gmail.com>
Tue, 2 Oct 2012 18:57:13 +0000 (18:57 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 2 Oct 2012 18:57:13 +0000 (18:57 +0000)
commitfdb15850e6f2d395b128bde0f2fff6b20c96adc6
tree74f9141d9c7107d8b1efabc99137e532d4696898
parent7bbd6e366b39157445cc921024a987e61ea68c00
Fix another crasher in SROA, reported by Joel.

We require that the indices into the use lists are stable in order to
build fast lookup tables to locate a particular partition use from an
operand of a PHI or select. This is (obviously in hind sight)
incompatible with erasing elements from the array. Really, we don't want
to erase anyways. It is expensive, and a rare operation. Instead, simply
weaken the contract of the PartitionUse structure to allow null Use
pointers to represent dead uses. Now we can clear out the pointer to
mark things as dead, and all it requires is adding some 'continue'
checks to the various loops.

I'm still reducing a test case for this, as the test case I have is
huge. I think this one I can get a nice test case for though, as it was
much more deterministic.

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