instcombine: alloca: Limit array size type promotion
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 13 Mar 2015 19:34:55 +0000 (19:34 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 13 Mar 2015 19:34:55 +0000 (19:34 +0000)
commit07ff9b03f6bf750e491cdde73f943a65f58f0d80
tree807d766deaa4cbbc4d66679e1ec9820eceb75c94
parent720762e2c0fc849342996302c37471b35e3537c8
instcombine: alloca: Limit array size type promotion

Move type promotion of the size of the array allocation to the end of
`simplifyAllocaArraySize()`.  This avoids promoting the type of the
array size if it's a `ConstantInt`, since the next -instcombine
iteration will drop it to a scalar allocation anyway.  Similarly, this
avoids promoting the type if it's an `UndefValue`, in which case the
alloca gets RAUW'ed.

This is NFC when considered over the lifetime of -instcombine, since
it's just reducing the number of iterations needed to reach fixed point.

llvm-svn: 232201
llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp