[LLVMdev] scalarrepl tuning

Chris Lattner clattner at apple.com
Wed Feb 3 22:15:44 PST 2010

On Feb 3, 2010, at 10:05 AM, Bob Wilson wrote:

> The last experiment was to test my intuition that SROA will rarely apply to arrays, since it requires that they be accessed with only constant indices.  I was expecting that we could get away with setting a very low limit on the number of array elements for SROA candidates.  To test this, I compiled all the benchmarks and accumulated counts of array sizes in cases where we succeeded with SROA.  I don't have a graph for this, but I was surprised in several ways.  First there were 8377 arrays transformed by SROA.  That's a lot more than I expected.  Second, I was guessing that we would almost never split up an array with more than 4 elements, but there were 350 cases where that happened.  I decided to go with a limit of 8 elements, since that caught all but 16 cases.

FWIW, a common reason for this is that loop unrolling can turn all accesses to an array into constants.


More information about the llvm-dev mailing list