Only convert allocas to scalars if it is profitable. The profitability metric I
authorCameron Zwarich <zwarich@apple.com>
Wed, 16 Mar 2011 00:13:44 +0000 (00:13 +0000)
committerCameron Zwarich <zwarich@apple.com>
Wed, 16 Mar 2011 00:13:44 +0000 (00:13 +0000)
commit85b0f468cf8390fca3ec356cd498ce0039dbad4f
tree798870eaa63fe0b259845b06b3bad494451a73ab
parent0a0f6f342b9acf8b90618cd3f4e61584370837a3
Only convert allocas to scalars if it is profitable. The profitability metric I
chose is having a non-memcpy/memset use and being larger than any native integer
type. Originally I chose having an access of a size smaller than the total size
of the alloca, but this caused some minor issues on the spirit benchmark where
SRoA runs again after some inlining.

This fixes <rdar://problem/8613163>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127718 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/ScalarReplAggregates.cpp
test/Transforms/ScalarRepl/only-memcpy-uses.ll [new file with mode: 0644]