Rework the rewriting of loads and stores for vector and integer allocas
authorChandler Carruth <chandlerc@gmail.com>
Tue, 20 Nov 2012 01:12:50 +0000 (01:12 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 20 Nov 2012 01:12:50 +0000 (01:12 +0000)
commitf5837aacd4b04e551fb194f4095006b7e6f2b991
tree9867d2cba4b2601ff14dc290d1c86970f5e94ff9
parent1f9f73a4c647cc37ea9568d3791599f4daf384fe
Rework the rewriting of loads and stores for vector and integer allocas
to properly handle the combinations of these with split integer loads
and stores. This essentially replaces Evan's r168227 by refactoring the
code in a different way, and trynig to mirror that refactoring in both
the load and store sides of the rewriting.

Generally speaking there was some really problematic duplicated code
here that led to poorly founded assumptions and then subtle bugs. Now
much of the code actually flows through and follows a more consistent
style and logical path. There is still a tiny bit of duplication on the
store side of things, but it is much less bad.

This also changes the logic to never re-use a load or store instruction
as that was simply too error prone in practice.

I've added a few tests (one a reduction of the one in Evan's original
patch, which happened to be the same as the report in PR14349). I'm
going to look at adding a few more tests for things I found and fixed in
passing (such as the volatile tests in the vectorizable predicate).

This patch has survived bootstrap, and modulo one bugfix survived
Duncan's test suite, but let me know if anything else explodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168346 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/basictest.ll
test/Transforms/SROA/vector-extract.ll [deleted file]
test/Transforms/SROA/vector-promotion.ll