scalarrepl tuning

In svn r95224 I modified the scalar replacement (SROA) pass to use different criteria to decide when it is likely to be profitable to split up an aggregate into its separate elements. The commit message has a pretty decent explanation, but I wanted to give some further detail here. I am hoping that the llvm-dev list allows messages with attachments. If the graphs get stripped off, this won't be very interesting.

I was inspired by Jakob's approach to using SCIENCE to adjust our inlining heuristics, so I did a few experiments for SROA. For these experiments, I ran the llvm nightly test benchmarks, including 3 different versions of SPEC and various other applications. The first thing measured was the total size and number of elements for each aggregate encountered by SROA.



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