llvm-6502/lib/Transforms/Scalar
Bob Wilson 3992feb075 Adjust the heuristics used to decide when SROA is likely to be profitable.
The SRThreshold value makes perfect sense for checking if an entire aggregate
should be promoted to a scalar integer, but it is not so good for splitting
an aggregate into its separate elements.  A struct may contain a large embedded
array along with some scalar fields that would benefit from being split apart
by SROA.  Even if the total aggregate size is large, it may still be good to
perform SROA.  Thus, the most important piece of this patch is simply moving
the aggregate size comparison vs. SRThreshold so that it guards only the
aggregate promotion.

We have also been checking the number of elements to decide if an aggregate
should be split up.  The limit of "SRThreshold/4" seemed rather arbitrary,
and I don't think it's very useful to derive this limit from SRThreshold
anyway.  I've collected some data showing that the current default limit of
32 (since SRThreshold defaults to 128) is a reasonable cutoff for struct
types.  One thing suggested by the data is that distinguishing between structs
and arrays might be useful.  There are (obviously) a lot more large arrays
than large structs (as measured by the number of elements and not the total
size -- a large array inside a struct still counts as a single element given
the way we do SROA right now).  Out of 8377 arrays where we successfully
performed SROA while compiling a large set of benchmarks, only 16 of them had
more than 8 elements.  And, for those 16 arrays, it's not at all clear that
SROA was actually beneficial.  So, to offset the compile time cost of
investigating more large structs for SROA, the patch lowers the limit on array
elements to 8.

This fixes Apple Radar 7563690.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95224 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-03 17:23:56 +00:00
..
ABCD.cpp Change errs() to dbgs(). 2010-01-05 01:27:39 +00:00
ADCE.cpp Use do+while instead of while for loops which obviously have a 2010-01-05 16:27:25 +00:00
BasicBlockPlacement.cpp eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861 2009-09-02 06:11:42 +00:00
CMakeLists.txt move instcombine to its own library, it's past time. 2010-01-04 06:23:24 +00:00
CodeGenPrepare.cpp When doing address-mode sinking, expand the base register first, rather 2010-01-19 22:45:06 +00:00
ConstantProp.cpp remove a bunch of extraneous LLVMContext arguments 2009-11-06 04:27:31 +00:00
DCE.cpp eliminate VISIBILITY_HIDDEN from Transforms/Scalar. PR4861 2009-09-02 06:11:42 +00:00
DeadStoreElimination.cpp Use do+while instead of while for loops which obviously have a 2010-01-05 16:27:25 +00:00
GEPSplitter.cpp Check in the experimental GEP splitter pass. This pass splits complex 2009-10-26 19:12:14 +00:00
GVN.cpp Fix some comment typos. 2010-02-03 00:33:21 +00:00
IndVarSimplify.cpp Re-implement the main strength-reduction portion of LoopStrengthReduction. 2010-01-21 02:09:26 +00:00
JumpThreading.cpp third bug from PR6119: the xor dupe extension allows 2010-01-23 19:21:31 +00:00
LICM.cpp Change errs() to dbgs(). 2010-01-05 01:27:30 +00:00
LoopDeletion.cpp LoopDeletion depends on loops having dedicated exits. 2009-11-05 21:47:04 +00:00
LoopIndexSplit.cpp Use do+while instead of while for loops which obviously have a 2010-01-05 16:27:25 +00:00
LoopRotation.cpp Update various Loop optimization passes to cope with the possibility that 2009-11-05 21:11:53 +00:00
LoopStrengthReduce.cpp Generic reformatting and comment fixing. No functionality change. 2010-01-29 00:52:43 +00:00
LoopUnrollPass.cpp Change errs() to dbgs(). 2010-01-05 01:27:44 +00:00
LoopUnswitch.cpp fix a crash in loop unswitch on a loop invariant vector condition. 2010-02-02 02:26:54 +00:00
Makefile make -fno-rtti the default unless a directory builds with REQUIRES_RTTI. 2010-01-24 20:43:08 +00:00
MemCpyOptimizer.cpp Convert a ton of simple integer type equality tests to the new predicate. 2010-01-05 20:07:06 +00:00
Reassociate.cpp only factor from expressions whose uses are empty and whose 2010-01-09 06:01:36 +00:00
Reg2Mem.cpp clean up this code a bit. 2009-09-02 06:15:37 +00:00
Scalar.cpp remove the now dead condprop pass, PR3906. 2009-11-11 05:56:35 +00:00
ScalarReplAggregates.cpp Adjust the heuristics used to decide when SROA is likely to be profitable. 2010-02-03 17:23:56 +00:00
SCCP.cpp Change errs() to dbgs(). 2010-01-05 01:27:15 +00:00
SCCVN.cpp Use do+while instead of while for loops which obviously have a 2010-01-05 16:27:25 +00:00
SimplifyCFGPass.cpp Use do+while instead of while for loops which obviously have a 2010-01-05 16:27:25 +00:00
SimplifyHalfPowrLibCalls.cpp improve portability to avoid conflicting with std::next in c++'0x. 2009-12-03 00:50:42 +00:00
SimplifyLibCalls.cpp Recommit this, looks like it wasn't the cause. 2010-02-03 00:21:58 +00:00
TailDuplication.cpp Change errs() to dbgs(). 2010-01-05 01:27:33 +00:00
TailRecursionElimination.cpp Revert 94937 and move the noreturn check to codegen. 2010-02-03 03:55:59 +00:00