Commit Graph

5138 Commits

Author SHA1 Message Date
Nick Lewycky
280a6e607d Remove 'unwinds to' support from mainline. This patch undoes r47802 r47989
r48047 r48084 r48085 r48086 r48088 r48096 r48099 r48109 and r48123.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 16:53:59 +00:00
Evan Cheng
ee472b1081 MMX argument passing fixes:
On Darwin / Linux x86-32, v8i8, v4i16, v2i32 values are passed in MM[0-2].                                                                                                                                      
On Darwin / Linux x86-32, v1i64 values are passed in memory.                                                                                                                                                    
On Darwin x86-64, v8i8, v4i16, v2i32 values are passed in XMM[0-7].                                                                                                                                     
On Darwin x86-64, v1i64 values are passed in 64-bit GPRs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 07:56:45 +00:00
Chris Lattner
25453ea49e Loosen up an assertion to allow intrinsics. I really have no
idea what this code (findNonImmUse) does, so I'm only guessing 
that this is the right thing.  It would be really really nice
if this had comments and perhaps switched to SmallPtrSet
(hint hint) :)

This fixes rdar://5886601, a crash on gcc.target/i386/sse4_1-pblendw.c


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 05:13:01 +00:00
Chris Lattner
eede65ce6c Don't infininitely thread branches when a threaded edge
goes back to the block, e.g.:

  Threading edge through bool from 'bb37.us.thread3829' to 'bb37.us' with cost: 1, across block:

bb37.us:		; preds = %bb37.us.thread3829, %bb37.us, %bb33
	%D1361.1.us = phi i32 [ %tmp36, %bb33 ], [ %D1361.1.us, %bb37.us ], [ 0, %bb37.us.thread3829 ]		; <i32> [#uses=2]
	%tmp39.us = icmp eq i32 %D1361.1.us, 0		; <i1> [#uses=1]
	br i1 %tmp39.us, label %bb37.us, label %bb42.us



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 04:12:29 +00:00
Evan Cheng
2749c72f30 Fix bug in x86 memcpy / memset lowering. If there are trailing bytes not handled by rep instructions, a new memcpy / memset is introduced for them. However, since source / destination addresses are already adjusted, their offsets should be zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50239 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-25 00:26:43 +00:00
Evan Cheng
1e8586d175 New test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50229 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 20:01:58 +00:00
Devang Patel
ef89bbb436 Add EXTRA_OPTIONS on the llvmgxx command line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 17:59:03 +00:00
Devang Patel
00dd691e75 Add EXTRA_OPTIONS on the llvmgcc command line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 17:54:25 +00:00
Chris Lattner
c9e495c534 Split some code out of the main SimplifyCFG loop into its own function.
Fix said code to handle merging return instructions together correctly
when handling multiple return values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50199 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 00:01:19 +00:00
Anton Korobeynikov
488fe315ea Fix tests due to llvm2cpp move to llc target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 22:41:53 +00:00
Dan Gohman
3dc34f682d Add support to codegen for getresult instructions with undef operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 20:21:29 +00:00
Anton Korobeynikov
0e9ddde1cf Disable stack realignment for these tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50172 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:25:44 +00:00
Anton Korobeynikov
e44a4b3bd7 Fix test becase ABI stack alignment dropped to 'normal' value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50171 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:25:16 +00:00
Anton Korobeynikov
51a8feea9b Fix test, instruction count is valid only if stack is not realigned
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50170 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 18:24:48 +00:00
Chris Lattner
c6ee00b8ee Rewrite multiple return value handling in SCCP. Before, the -sccp pass
would turn every getresult instruction into undef.  This helps with
rdar://5778210


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50140 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 05:38:20 +00:00
Chris Lattner
69e6317083 remove this testcase. It isn't testing loop rotate, it is testing all
of -std-compile-opts and is now failing because other passes are generating
IR that looks different to input of loop rotate.  Devang, please 
introduce a testcase that only runs loop rotate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50136 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 05:36:04 +00:00
Chris Lattner
7e4687a9f2 returning an empty multiple return list is not valid.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 05:29:14 +00:00
Chris Lattner
525af20937 make this test more interesting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 03:49:32 +00:00
Chris Lattner
ed98501ab7 distill down the essense of this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 03:03:42 +00:00
Dale Johannesen
02dc1a7f1f new test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50123 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 01:22:22 +00:00
Evan Cheng
f30752cbcc Don't do: "(X & 4) >> 1 == 2 --> (X & 4) == 4" if there are more than one uses of the shift result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50118 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23 00:38:06 +00:00
Chris Lattner
a5ddb59a13 Start doing the significantly useful part of jump threading: handle cases
where a comparison has a phi input and that phi is a constant.  For example,
stuff like:

  Threading edge through bool from 'bb2149' to 'bb2231' with cost: 1, across block:
bb2237:		; preds = %bb2231, %bb2149
	%tmp2328.rle = phi i32 [ %tmp2232, %bb2231 ], [ %tmp2232439, %bb2149 ]		; <i32> [#uses=2]
	%done.0 = phi i32 [ %done.2, %bb2231 ], [ 0, %bb2149 ]		; <i32> [#uses=1]
	%tmp2239 = icmp eq i32 %done.0, 0		; <i1> [#uses=1]
	br i1 %tmp2239, label %bb2231, label %bb2327

or

bb38.i298:		; preds = %bb33.i295, %bb1693
	%tmp39.i296.rle = phi %struct.ibox* [ null, %bb1693 ], [ %tmp39.i296.rle1109, %bb33.i295 ]		; <%struct.ibox*> [#uses=2]
	%minspan.1.i291.reg2mem.1 = phi i32 [ 32000, %bb1693 ], [ %minspan.0.i288, %bb33.i295 ]		; <i32> [#uses=1]
	%tmp40.i297 = icmp eq %struct.ibox* %tmp39.i296.rle, null		; <i1> [#uses=1]
	br i1 %tmp40.i297, label %implfeeds.exit311, label %bb43.i301

This triggers thousands of times in spec.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50110 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 21:40:39 +00:00
Chris Lattner
ae65b3c791 Dig through multiple levels of AND to thread jumps if needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50106 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 20:46:09 +00:00
Chris Lattner
6bf77500c6 Teach jump threading to thread through blocks like:
br (and X, phi(Y, Z, false)), label L1, label L2

This triggers once on 252.eon and 6 times on 176.gcc.  Blocks 
in question often look like this:

bb262:		; preds = %bb261, %bb248
	%iftmp.251.0 = phi i1 [ true, %bb261 ], [ false, %bb248 ]		; <i1> [#uses=4]
	%tmp270 = icmp eq %struct.rtx_def* %tmp.0.i, null		; <i1> [#uses=1]
	%bothcond = or i1 %iftmp.251.0, %tmp270		; <i1> [#uses=1]
	br i1 %bothcond, label %bb288, label %bb273

In this case, it is clear that it doesn't matter if tmp.0.i is null when coming from bb261.  When coming from bb248, it is all that matters.


Another random example:

check_asm_operands.exit:		; preds = %check_asm_operands.exit.thr_comm, %bb30.i, %bb12.i, %bb6.i413
	%tmp.0.i420 = phi i1 [ true, %bb6.i413 ], [ true, %bb12.i ], [ true, %bb30.i ], [ false, %check_asm_operands.exit.thr_comm ; <i1> [#uses=1]
	call void @llvm.stackrestore( i8* %savedstack ) nounwind 
	%tmp4389 = icmp eq i32 %added_sets_1.0, 0		; <i1> [#uses=1]
	%tmp4394 = icmp eq i32 %added_sets_2.0, 0		; <i1> [#uses=1]
	%bothcond80 = and i1 %tmp4389, %tmp4394		; <i1> [#uses=1]
	%bothcond81 = and i1 %bothcond80, %tmp.0.i420		; <i1> [#uses=1]
	br i1 %bothcond81, label %bb4398, label %bb4397

Here is the case from 252.eon:

bb290.i.i:		; preds = %bb23.i57.i.i, %bb8.i39.i.i, %bb100.i.i, %bb100.i.i, %bb85.i.i110
	%myEOF.1.i.i = phi i1 [ true, %bb100.i.i ], [ true, %bb100.i.i ], [ true, %bb85.i.i110 ], [ true, %bb8.i39.i.i ], [ false, %bb23.i57.i.i ]		; <i1> [#uses=2]
	%i.4.i.i = phi i32 [ %i.1.i.i, %bb85.i.i110 ], [ %i.0.i.i, %bb100.i.i ], [ %i.0.i.i, %bb100.i.i ], [ %i.3.i.i, %bb8.i39.i.i ], [ %i.3.i.i, %bb23.i57.i.i ]		; <i32> [#uses=3]
	%tmp292.i.i = load i8* %tmp16.i.i100, align 1		; <i8> [#uses=1]
	%tmp293.not.i.i = icmp ne i8 %tmp292.i.i, 0		; <i1> [#uses=1]
	%bothcond.i.i = and i1 %tmp293.not.i.i, %myEOF.1.i.i		; <i1> [#uses=1]
	br i1 %bothcond.i.i, label %bb202.i.i, label %bb301.i.i
  Factoring out 3 common predecessors.

On the path from any blocks other than bb23.i57.i.i, the load and compare 
are dead.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 07:05:46 +00:00
Chris Lattner
f29984f695 add a basic testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 06:35:14 +00:00
Nick Lewycky
dc2421f786 Start removing 'unwinds to' support from mainline in preparation for 2.3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 05:16:02 +00:00
Chris Lattner
10c0d9179e optimize "p != gep p, ..." better. This allows us to compile
getelementptr-seteq.ll into:

define i1 @test(i64 %X, %S* %P) {
	%C = icmp eq i64 %X, -1		; <i1> [#uses=1]
	ret i1 %C
}

instead of:

define i1 @test(i64 %X, %S* %P) {
	%A.idx.mask = and i64 %X, 4611686018427387903		; <i64> [#uses=1]
	%C = icmp eq i64 %A.idx.mask, 4611686018427387903		; <i1> [#uses=1]
	ret i1 %C
}

And fixes the second half of PR2235.  This speeds up the insertion sort
case by 45%, from 1.12s to 0.77s.  In practice, this will significantly
speed up for loops structured like:

for (double *P = Base + N; P != Base; --P)
  ...

Which happens frequently for C++ iterators.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22 02:53:33 +00:00
Dan Gohman
61a9213440 Implement an x86-64 ABI detail of passing structs by hidden first
argument. The x86-64 ABI requires the incoming value of %rdi to
be copied to %rax on exit from a function that is returning a
large C struct.

Also, add a README-X86-64 entry detailing the missed optimization
opportunity and proposing an alternative approach.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 23:59:07 +00:00
Duncan Sands
92b9d49e4c Make these structs larger to ensure that they
are returned by struct return.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 08:17:05 +00:00
Duncan Sands
09eb6e7c25 Make the struct bigger, to ensure it is returned
by struct return.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 08:12:03 +00:00
Owen Anderson
a8bd65835b Refactor memcpyopt based on Chris' suggestions. Consolidate several functions
and simplify code that was fallout from the separation of memcpyopt and gvn.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50034 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21 07:45:10 +00:00
Chris Lattner
bd381a777b A better fix for my previous patch, MOVZQI2PQIrr just requires SSE2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49986 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 05:52:46 +00:00
Chris Lattner
b15f760cda Not all x86-64 machines have sse3 apparently.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49985 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 05:47:56 +00:00
Chris Lattner
5ae21fb23a rename *.llx -> *.ll, last batch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49971 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 22:32:52 +00:00
Chris Lattner
1ce9e00f8b rename *.llx -> *.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 22:29:10 +00:00
Chris Lattner
e972299f34 rename *.llx -> *.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49969 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 22:26:29 +00:00
Chris Lattner
d881ad2c57 Implement PR2206.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49967 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 22:17:26 +00:00
Chris Lattner
1c14c29746 refactor handling of symbolic constant folding, picking up
a few new cases( see Integer/a1.ll), but not anything that
would happen in practice.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49965 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 21:58:19 +00:00
Evan Cheng
8608f2eff2 64-bit atomic operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49949 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 02:30:38 +00:00
Dan Gohman
f4423b1e45 Teach llvm-as to accept function types with multiple return types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49945 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-19 00:24:39 +00:00
Evan Cheng
639f493ebf Be more careful with insert_subreg and extract_subreg where either source or destination operand has already been coalesced with another register that's defined by a insert_subreg or extract_subreg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 07:58:04 +00:00
Owen Anderson
241f65321e Make GVN able to remove unnecessary calls to read-only functions again.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 05:36:50 +00:00
Evan Cheng
621d157676 Fix a sub-register indice propagation bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 00:06:42 +00:00
Evan Cheng
03eb38848c Don't forget about sub-register indices when rematting instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 23:44:44 +00:00
Evan Cheng
9c1e06e187 After reading memory that's already freed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 20:24:25 +00:00
Evan Cheng
6f0ca06296 Really test what's intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 18:21:55 +00:00
Evan Cheng
0d4bdde327 Rewrite LiveVariable liveness computation. The new implementation is much simplified. It eliminated the nasty recursive routines and removed the partial def / use bookkeeping. There is also potential for performance improvement by replacing the conservative handling of partial physical register definitions. The code is currently disabled until live interval analysis is taught of the name scheme.
This patch also fixed a couple of nasty corner cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 09:46:40 +00:00
Owen Anderson
9eb883a56a XFAIL this test for the moment. The real solution is to prevent ADCE
from transforming loops and adding a separate loop pass for removing
loops with know trip counts.  Until that happens, ADCE is miscompiling this code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49769 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 04:25:42 +00:00
Dan Gohman
171c11ec93 Add support for the form of the SSE41 extractps instruction that
puts its result in a 32-bit GPR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49762 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 02:32:24 +00:00
Dan Gohman
bcda285fcc Recreate the size SDNode instead of reusing the old one in the x86
memcpy lowering code; this ensures that the size node has the desired
result type. This fixes a regression from r49572 with @llvm.memcpy.i64
on x86-32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49761 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 01:32:32 +00:00