Revise scalar replacement to be more flexible about handle bitcasts and GEPs.
authorBob Wilson <bob.wilson@apple.com>
Fri, 11 Dec 2009 23:47:40 +0000 (23:47 +0000)
committerBob Wilson <bob.wilson@apple.com>
Fri, 11 Dec 2009 23:47:40 +0000 (23:47 +0000)
commit73a1b67cb9b52553c3684b8eea3f97f35744354b
tree52e91617028448984e702cced02eb6a219b723b5
parenta0474a83bfa75757866c9ce361ddb8462a585882
Revise scalar replacement to be more flexible about handle bitcasts and GEPs.
While scanning through the uses of an alloca, keep track of the current offset
relative to the start of the alloca, and check memory references to see if
the offset & size correspond to a component within the alloca.  This has the
nice benefit of unifying much of the code from isSafeUseOfAllocation,
isSafeElementUse, and isSafeUseOfBitCastedAllocation.  The code to rewrite
the uses of a promoted alloca, after it is determined to be safe, is
reorganized in the same way.

Also, when rewriting GEP instructions, mark them as "in-bounds" since all the
indices are known to be safe.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91184 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/ScalarReplAggregates.cpp
test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll [new file with mode: 0644]