llvm-6502/test/Transforms/ScalarRepl
Chris Lattner 2e0d5f8432 Simplify and generalize the SROA "convert to scalar" transformation to
be able to handle *ANY* alloca that is poked by loads and stores of 
bitcasts and GEPs with constant offsets.  Before the code had a number
of annoying limitations and caused it to miss cases such as storing into
holes in structs and complex casts (as in bitfield-sroa) where we had
unions of bitfields etc.  This also handles a number of important cases
that are exposed due to the ABI lowering stuff we do to pass stuff by
value.

One case that is pretty great is that we compile 
2006-11-07-InvalidArrayPromote.ll into:

define i32 @func(<4 x float> %v0, <4 x float> %v1) nounwind {
	%tmp10 = call <4 x i32> @llvm.x86.sse2.cvttps2dq(<4 x float> %v1)
	%tmp105 = bitcast <4 x i32> %tmp10 to i128
	%tmp1056 = zext i128 %tmp105 to i256	
	%tmp.upgrd.43 = lshr i256 %tmp1056, 96
	%tmp.upgrd.44 = trunc i256 %tmp.upgrd.43 to i32	
	ret i32 %tmp.upgrd.44
}

which turns into:

_func:
	subl	$28, %esp
	cvttps2dq	%xmm1, %xmm0
	movaps	%xmm0, (%esp)
	movl	12(%esp), %eax
	addl	$28, %esp
	ret

Which is pretty good code all things considering :).

One effect of this is that SROA will start generating arbitrary bitwidth 
integers that are a multiple of 8 bits.  In the case above, we got a 
256 bit integer, but the codegen guys assure me that it can handle the 
simple and/or/shift/zext stuff that we're doing on these operations.

This addresses rdar://6532315



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63469 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-31 02:28:54 +00:00
..
2003-05-29-ArrayFail.ll Simplify and generalize the SROA "convert to scalar" transformation to 2009-01-31 02:28:54 +00:00
2003-05-30-InvalidIndices.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
2003-05-30-MultiLevel.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
2003-09-12-IncorrectPromote.ll Fix some escaping and quoting in RUN lines, mainly involving { and <. In two 2008-06-10 16:04:47 +00:00
2003-10-29-ArrayProblem.ll Fix some tests. 2008-06-12 21:23:38 +00:00
2005-12-14-UnionPromoteCrash.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
2006-01-24-IllegalUnionPromoteCrash.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
2006-04-20-PromoteCrash.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
2006-10-23-PointerUnionCrash.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
2006-11-07-InvalidArrayPromote.ll Simplify and generalize the SROA "convert to scalar" transformation to 2009-01-31 02:28:54 +00:00
2006-12-11-SROA-Crash.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
2007-03-19-CanonicalizeMemcpy.ll Remove use of implementation keyword. 2007-03-28 02:38:26 +00:00
2007-05-24-LargeAggregate.ll testcase for PR1446 2007-05-24 18:42:47 +00:00
2007-05-29-MemcpyPreserve.ll Testcase for PR1421 2007-05-30 06:10:46 +00:00
2007-11-03-bigendian_apint.ll Change uses of getTypeSize to getABITypeSize, getTypeStoreSize 2007-11-04 14:43:57 +00:00
2008-01-29-PromoteBug.ll Fix a bug where scalarrepl would discard offset if type would match. 2008-01-30 00:39:15 +00:00
2008-02-28-SubElementExtractCrash.ll fix a bug Anders ran into where scalarrepl would crash when promoting 2008-02-29 07:12:06 +00:00
2008-06-05-loadstore-agg.ll Learn ScalarReplAggregrates how stores and loads of first class aggregrates 2008-06-05 12:51:53 +00:00
2008-06-22-LargeArray.ll Fix PR2369 by making scalarrepl more careful about promoting 2008-06-22 17:46:21 +00:00
2008-08-22-out-of-range-array-promote.ll Fix PR2423 by checking all indices for out of range access, not only 2008-08-23 05:21:06 +00:00
2008-09-22-vector-gep.ll Allow scalarrepl to treat an all-zero GEP just as bitcast. 2008-10-06 16:23:31 +00:00
2009-01-09-scalarrepl-empty.ll Fix PR3304 2009-01-09 18:18:43 +00:00
AggregatePromote.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
arraytest.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
badarray.ll Simplify and generalize the SROA "convert to scalar" transformation to 2009-01-31 02:28:54 +00:00
basictest.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
bitfield-sroa.ll Simplify and generalize the SROA "convert to scalar" transformation to 2009-01-31 02:28:54 +00:00
copy-aggregate.ll This implements the second half of the fix for PR3290, handling 2009-01-08 05:42:05 +00:00
dg.exp sabre brings to my attention that the 'tr' suffix is also obsolete 2008-05-20 21:00:03 +00:00
DifferingTypes.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
load-store-aggregate.ll Add a testcase showing that scalarrepl supports first class structs. 2008-09-29 10:42:13 +00:00
memcpy-from-global.ll new testcase, should be able to eliminate the alloca and memcpy 2007-04-25 06:29:34 +00:00
memset-aggregate-byte-leader.ll For PR1319: 2007-04-15 09:21:47 +00:00
memset-aggregate.ll For PR1319: 2007-04-15 09:21:47 +00:00
phinodepromote.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
select_promote.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
sroa_two.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
union-fp-int.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
union-packed.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
union-pointer.ll Upgrade tests to not use llvm-upgrade. 2008-03-18 04:14:37 +00:00
vector_promote.ll strengthen this test. 2009-01-28 19:29:30 +00:00
volatile.ll Fix some issues with volatility, move "CanConvertToScalar" check 2009-01-28 20:16:43 +00:00