1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

8989 Commits

Author SHA1 Message Date
Chris Lattner
cd6fed25d5 add testcases for the foo_with_overflow op xforms added recently and
fix bugs exposed by the tests.  Testcases from Alastair Lynn!

llvm-svn: 90056
2009-11-29 02:57:29 +00:00
Chris Lattner
5b1941cafb add PR#
llvm-svn: 90049
2009-11-29 01:28:58 +00:00
Chris Lattner
8ba0b842a2 Add a testcase for:
void test(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j] = G[j] + G[j+1] + G[j-1];
}

which we now compile to one load in the loop:

LBB1_2:                                                     ## %bb
	movsd	16(%rsi,%rax,8), %xmm2
	incq	%rdx
	addsd	%xmm2, %xmm1
	addsd	%xmm1, %xmm0
	movapd	%xmm2, %xmm1
	movsd	%xmm0, 8(%rsi,%rax,8)
	incq	%rax
	cmpq	%rcx, %rax
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movsd	8(%rsi,%rax,8), %xmm0
	addsd	16(%rsi,%rax,8), %xmm0
	addsd	(%rsi,%rax,8), %xmm0
	movsd	%xmm0, 8(%rsi,%rax,8)
	incq	%rax
	cmpq	%rcx, %rax
	jne	LBB1_2

llvm-svn: 90048
2009-11-29 01:15:43 +00:00
Chris Lattner
e7dbdc6a7e add a testcase for
void test9(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j+1] = G[j] + G[j+1];
}

llvm-svn: 90047
2009-11-29 01:04:40 +00:00
Chris Lattner
d48ff7ea6a Implement PR5634.
llvm-svn: 90046
2009-11-29 00:51:17 +00:00
Nick Lewycky
ff44d9d88a Teach memdep to look for memory use intrinsics during dependency queries. Fixes
PR5574.

llvm-svn: 90045
2009-11-28 21:27:49 +00:00
Chris Lattner
83284453a1 reenable load address insertion in load pre. This allows us to
handle cases like this:
void test(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j+1] = G[j] + G[j+1];
}

where G[1] isn't live into the loop.

llvm-svn: 90041
2009-11-28 16:08:18 +00:00
Chris Lattner
f825d5d176 implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
way that getUnderlyingObject does it. 

This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!' 
assertion on sqlite3.

llvm-svn: 90038
2009-11-28 15:12:41 +00:00
Chris Lattner
f3e5cbfc99 disable value insertion for now, I need to figure out how
to inform GVN about the newly inserted values.  This fixes 
PR5631.

llvm-svn: 90022
2009-11-27 22:50:07 +00:00
Chris Lattner
1fc57583fa I accidentally implemented this :)
llvm-svn: 90014
2009-11-27 19:56:00 +00:00
Chris Lattner
b1fceb6006 add support for recursive phi translation and phi
translation of add with immediate.  This allows us
to optimize this function:

void test(int N, double* G) {
  long j;
  G[1] = 1;
    for (j = 1; j < N - 1; j++)
        G[j+1] = G[j] + G[j+1];
}

to only do one load every iteration of the loop.

llvm-svn: 90013
2009-11-27 19:11:31 +00:00
Chris Lattner
6f124b48c3 add two simple test cases we now optimize (to one load in the loop each) and one we don't (corresponding to the fixme I added yesterday).
llvm-svn: 90012
2009-11-27 18:08:30 +00:00
Chris Lattner
cdfa9dadf1 fix PR5436 by making the 'simple' case of SRoA not promote out of range
array indexes.  The "complex" case of SRoA still handles them, and correctly.

This fixes a weirdness where we'd correctly avoid transforming A[0][42] if
the 42 was too large, but we'd only do it if it was one gep, not two separate
ones.

llvm-svn: 90007
2009-11-27 16:37:41 +00:00
Chris Lattner
02211273c7 filecheckize
llvm-svn: 90006
2009-11-27 16:31:59 +00:00
Duncan Sands
638c57757d While this test is testing a problem in the generic part of codegen,
the problem only shows for msp430 and pic16 which is why it specifies
them using -march.  But it is wrong to put such tests in CodeGen/Generic,
since not everyone builds these targets.  Put a copy of the test in each
of the target test directories.

llvm-svn: 90005
2009-11-27 16:04:14 +00:00
Chris Lattner
a466dbe80a teach GVN's load PRE to insert computations of the address in predecessors
where it is not available.  It's unclear how to get this inserted 
computation into GVN's scalar availability sets, Owen, help? :)

llvm-svn: 89997
2009-11-27 08:25:10 +00:00
Chris Lattner
9c8da17055 add some tests for memdep phi translation + PRE.
llvm-svn: 89996
2009-11-27 06:42:42 +00:00
Chris Lattner
3e12a00447 this test is failing, and is expected to.
llvm-svn: 89995
2009-11-27 06:36:28 +00:00
Chris Lattner
ed6850eb34 filecheckize
llvm-svn: 89994
2009-11-27 06:33:09 +00:00
Chris Lattner
479eda6018 rename test.
llvm-svn: 89993
2009-11-27 06:31:55 +00:00
Chris Lattner
0971e6da1f Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation 
again.

llvm-svn: 89992
2009-11-27 06:31:14 +00:00
Chris Lattner
16ee3226ce redisable this, my bootstrap worked because it wasn't an optimized build, whoops.
llvm-svn: 89991
2009-11-27 05:53:01 +00:00
Chris Lattner
ea3b1f2186 try again.
llvm-svn: 89990
2009-11-27 05:19:56 +00:00
Chris Lattner
895214c65e this is causing buildbot failures, disable for now.
llvm-svn: 89985
2009-11-27 01:52:22 +00:00
Chris Lattner
02ffb0a608 teach phi translation of GEPs to simplify geps like 'gep x, 0'.
This allows us to compile the example from PR5313 into:

LBB1_2:                                                     ## %bb
	incl	%ecx
	movb	%al, (%rsi)
	movslq	%ecx, %rax
	movb	(%rdi,%rax), %al
	testb	%al, %al
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movslq	%eax, %rcx
	incl	%eax
	movb	(%rdi,%rcx), %cl
	movb	%cl, (%rsi)
	movslq	%eax, %rcx
	cmpb	$0, (%rdi,%rcx)
	jne	LBB1_2

llvm-svn: 89981
2009-11-27 00:34:38 +00:00
Chris Lattner
4810fa619f teach memdep to do trivial PHI translation of GEPs. More to
come.

llvm-svn: 89979
2009-11-27 00:07:37 +00:00
Chris Lattner
4824ebfded Teach memdep to phi translate bitcasts. This allows us to compile
the example in GCC PR16799 to:

LBB1_2:                                                     ## %bb1
	movl	%eax, %eax
	subq	%rax, %rdi
	movq	%rdi, (%rcx)
	movl	(%rdi), %eax
	testl	%eax, %eax
	je	LBB1_2

instead of:

LBB1_2:                                                     ## %bb1
	movl	(%rdi), %ecx
	subq	%rcx, %rdi
	movq	%rdi, (%rax)
	cmpl	$0, (%rdi)
	je	LBB1_2

llvm-svn: 89978
2009-11-26 23:41:07 +00:00
Chris Lattner
4bf628a9ba convert to filecheck
llvm-svn: 89977
2009-11-26 23:32:59 +00:00
Chris Lattner
cf7665b0c8 Fix PR5471 by removing an instcombine xform. Some pieces of the code
generates store to undef and some generates store to null as the idiom
for undefined behavior.  Since simplifycfg zaps both, don't remove the
undefined behavior in instcombine.

llvm-svn: 89971
2009-11-26 22:04:42 +00:00
Chris Lattner
911e5047d0 @test9 is a testcase for r89958. Before 89958, we misanalyzed the
first expression as P+4+4*i which we considered to possibly alias
P+4*j.  Now we correctly analyze the former one as P+1+4*i.

@test10 is a sanity test that verfies that we know that P+4+4*i != P+4*i.

llvm-svn: 89960
2009-11-26 19:25:46 +00:00
Chris Lattner
ce573daf09 Implement PR1143 (at -m64) by making basicaa look through extensions. We
previously already handled it at -m32 because there were no i32->i64 
extensions for addressing.

llvm-svn: 89959
2009-11-26 18:53:33 +00:00
Chris Lattner
d86a693b70 teach GetLinearExpression to be a bit more aggressive.
llvm-svn: 89955
2009-11-26 17:00:01 +00:00
Chris Lattner
993cb8c911 update status of this. basicaa is much improved now,
only missing the one form (in this testcase).  Dan, do you
consider this example to be important?

llvm-svn: 89953
2009-11-26 16:42:00 +00:00
Chris Lattner
9c88c96b3f Teach basicaa that x|c == x+c when the c bits of x are clear. This
allows us to compile the example in readme.txt into:

LBB1_1:                                                     ## %bb
	movl	4(%rdx,%rax), %ecx
	movl	%ecx, %esi
	imull	(%rdx,%rax), %esi
	imull	%esi, %ecx
	movl	%esi, 8(%rdx,%rax)
	imull	%ecx, %esi
	movl	%ecx, 12(%rdx,%rax)
	movl	%esi, 16(%rdx,%rax)
	imull	%ecx, %esi
	movl	%esi, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

instead of:

LBB1_1: 
	movl	(%rdx,%rax), %ecx
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 8(%rdx,%rax)
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 12(%rdx,%rax)
	imull	8(%rdx,%rax), %ecx
	movl	%ecx, 16(%rdx,%rax)
	imull	12(%rdx,%rax), %ecx
	movl	%ecx, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

GCC (4.2) doesn't seem to be able to eliminate the loads in this 
testcase either, it generates:

L2:
	movl	(%rdx), %eax
	imull	4(%rdx), %eax
	movl	%eax, 8(%rdx)
	imull	4(%rdx), %eax
	movl	%eax, 12(%rdx)
	imull	8(%rdx), %eax
	movl	%eax, 16(%rdx)
	imull	12(%rdx), %eax
	movl	%eax, 20(%rdx)
	addl	$4, %ecx
	addq	$16, %rdx
	cmpl	$1002, %ecx
	jne	L2

llvm-svn: 89952
2009-11-26 16:26:43 +00:00
Chris Lattner
677b93d4c8 teach basicaa that A[i] != A[i+1].
llvm-svn: 89951
2009-11-26 16:18:10 +00:00
Chris Lattner
82257f0385 rename test
llvm-svn: 89950
2009-11-26 16:08:41 +00:00
Chris Lattner
69e59e50f3 Change the other half of aliasGEP (which handles GEP differencing) to use DecomposeGEPExpression. This dramatically simplifies and shrinks the code by eliminating the horrible CheckGEPInstructions method, fixes a miscompilation (@test3) and makes the code more aggressive. In particular, we now handle the @test4 case, which is reduced from the SmallPtrSet constructor. Missing this caused us to emit a variable length memset instead of a fixed size one.
llvm-svn: 89922
2009-11-26 02:17:34 +00:00
Chris Lattner
862a3532d6 add a new random feature test
llvm-svn: 89921
2009-11-26 02:16:28 +00:00
Evan Cheng
dd352c2a81 Test for 89905.
llvm-svn: 89906
2009-11-26 00:35:01 +00:00
Dale Johannesen
8f1aaa92b2 Test for llvm-gcc checkin 89898.
llvm-svn: 89899
2009-11-25 23:50:09 +00:00
Evan Cheng
bdedf32e51 ProcessImplicitDefs should watch out for invalidated iterator and extra implicit operands on copies.
llvm-svn: 89880
2009-11-25 21:13:39 +00:00
Bruno Cardoso Lopes
038281c523 Support PIC loading of constant pool entries
llvm-svn: 89863
2009-11-25 12:17:58 +00:00
Edward O'Callaghan
4b197b8908 Reverting patch in revision 89758, initial attempt at fixing PR5373 has proven to be bogus.
llvm-svn: 89844
2009-11-25 05:38:41 +00:00
Dale Johannesen
5809ff0e58 Do not store R31 into the caller's link area on PPC.
This violates the ABI (that area is "reserved"), and
while it is safe if all code is generated with current
compilers, there is some very old code around that uses
that slot for something else, and breaks if it is stored
into.  Adjust testcases looking for current behavior.
I've verified that the stack frame size is right in all
testcases, whether it changed or not.  7311323.

llvm-svn: 89811
2009-11-24 22:59:02 +00:00
Edward O'Callaghan
8c1cd4fdbc Fix for PR5373, Credit to Jakub Staszak.
llvm-svn: 89758
2009-11-24 11:51:52 +00:00
Evan Cheng
b81878ed80 Enable predication of NEON instructions in Thumb2 mode.
llvm-svn: 89748
2009-11-24 08:06:15 +00:00
Anton Korobeynikov
0f885eb7fd Materialize global addresses via movt/movw pair, this is always better
than doing the same via constpool:
1. Load from constpool costs 3 cycles on A9, movt/movw pair - just 2.
2. Load from constpool might stall up to 300 cycles due to cache miss.
3. Movt/movw does not use load/store unit.
4. Less constpool entries => better compiler performance.

This is only enabled on ELF systems, since darwin does not have needed
relocations (yet).

llvm-svn: 89720
2009-11-24 00:44:37 +00:00
Jim Grosbach
76b545e988 move fconst[sd] to UAL. <rdar://7414913>
llvm-svn: 89700
2009-11-23 21:08:25 +00:00
Jim Grosbach
b7607ee5fe update test for 89694
llvm-svn: 89695
2009-11-23 20:39:53 +00:00
Dan Gohman
58bb87921b Make ConstantFoldConstantExpression recursively visit the entire
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.

Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.

llvm-svn: 89659
2009-11-23 16:22:21 +00:00
Dan Gohman
0ef3e7cf76 Fix a use of an invalidated iterator in the case where there are multiple
adjacent uses of a dead basic block from the same user. This fixes PR5596.

llvm-svn: 89658
2009-11-23 16:13:39 +00:00
Nick Lewycky
9d1ee635e3 Reapply r88830 with a bugfix: this transform only applies to icmp eq/ne. This
fixes part of PR5438.

llvm-svn: 89639
2009-11-23 03:17:33 +00:00
Chris Lattner
632f60ccc9 remove a silly condition that doesn't make a lot of sense anymore.
llvm-svn: 89601
2009-11-22 16:15:59 +00:00
Edward O'Callaghan
573a04cfbb Miss two, PR5307.
llvm-svn: 89596
2009-11-22 15:35:28 +00:00
Edward O'Callaghan
a295e7bd9b Convert Thumb2 tests to FileCheck for PR5307.
llvm-svn: 89595
2009-11-22 15:18:27 +00:00
Benjamin Kramer
7968de0cde Turns out stuff gets allocated to different registers depending on the subtarget.
llvm-svn: 89594
2009-11-22 15:15:52 +00:00
Edward O'Callaghan
d1c7b40bb5 Convert ARM tests to FileCheck for PR5307.
llvm-svn: 89593
2009-11-22 14:23:33 +00:00
Benjamin Kramer
a08534a88d Convert test to FileCheck.
llvm-svn: 89589
2009-11-22 13:16:36 +00:00
Edward O'Callaghan
1a250b4109 Forgot to alter RUN line when converting to FileCheck.
llvm-svn: 89588
2009-11-22 13:09:48 +00:00
Edward O'Callaghan
5ae4559914 Fix for bad FileCheck converts in revision 89584.
llvm-svn: 89586
2009-11-22 12:50:05 +00:00
Edward O'Callaghan
949850890f Convert a few tests to FileCheck for PR5307.
llvm-svn: 89584
2009-11-22 11:45:44 +00:00
Bob Wilson
5d46596707 Fix pr5470. Tablegen handles template arguments by temporarily setting their
values, resolving references to them, and then removing the definitions.
If a template argument is set to an undefined value, we need to resolve
references to that argument to an explicit undefined value.  The current code
leaves the reference to the template argument as it is, which causes an
assertion failure later when the definition of the template argument is
removed.

llvm-svn: 89581
2009-11-22 03:58:57 +00:00
Jim Grosbach
99c5b49c61 Revert 89562. We're being sneakier than I was giving us credit for, and this
isn't necessary.

llvm-svn: 89568
2009-11-21 23:34:09 +00:00
Jim Grosbach
d4603a5c4e Darwin requires a frame pointer for all non-leaf functions to support correct
backtraces.

llvm-svn: 89562
2009-11-21 21:40:08 +00:00
Jakob Stoklund Olesen
78f465dc49 Don't leave temporary files in the test directory.
llvm-svn: 89531
2009-11-21 02:05:31 +00:00
Dale Johannesen
907ff5a620 When generating a vector the really slow way, via loads
and stores, handle the case where the element size is not
a valid target type correctly (PPC).

llvm-svn: 89521
2009-11-21 00:53:23 +00:00
Evan Cheng
9828118adf Enable hoisting load from constant memories.
llvm-svn: 89510
2009-11-20 23:31:34 +00:00
Sean Callanan
78ee7f5d57 Recommitting PALIGNR shift width fixes.
Thanks to Daniel Dunbar for fixing clang intrinsics:
  http://llvm.org/viewvc/llvm-project?view=rev&revision=89499

llvm-svn: 89500
2009-11-20 22:28:42 +00:00
Dale Johannesen
45f80d39f6 Remove an incorrect overaggressive optimization
(PPC specific).

llvm-svn: 89496
2009-11-20 22:16:40 +00:00
Sean Callanan
d92626fc0d Reverting PALIGNR fix until I figure out how this
broke the Clang testsuite.

llvm-svn: 89495
2009-11-20 22:09:28 +00:00
Sean Callanan
0da77167d3 Fixed PALIGNR to take 8-bit rotations in all cases.
Also fixed the corresponding testcase, and the PALIGNR
  intrinsic (tested for correctness with llvm-gcc).

llvm-svn: 89491
2009-11-20 21:40:28 +00:00
Dan Gohman
d115107ef2 Make Loop::getLoopLatch() work on loops which don't have preheaders, as
it may be used in contexts where preheader insertion may have failed due
to an indirectbr.

Make LoopSimplify's LoopSimplify::SeparateNestedLoop properly fail in
the case that it would require splitting an indirectbr edge.

These fix PR5502.

llvm-svn: 89484
2009-11-20 20:51:18 +00:00
Dan Gohman
94cca19d9d Fix IPSCCP's code for deleting dead blocks to tolerate outstanding
blockaddress users. This fixes PR5569.

llvm-svn: 89483
2009-11-20 20:19:14 +00:00
Evan Cheng
9f57c4916e Remat VLDRD from constpool. Clean up some instruction property specifications.
llvm-svn: 89478
2009-11-20 19:57:15 +00:00
Duncan Sands
072d688d75 Fix PR5558, which was caused by a wrong fix for PR3393 (see commit 63048),
which was an expensive checks failure due to a bug in the checking.  This
patch in essence reverts the original fix for PR3393, and refixes it by a
tweak to the way expensive checking is done.

llvm-svn: 89454
2009-11-20 10:45:10 +00:00
Benjamin Kramer
8be7ccec51 Try to work around grep's "Binary file (standard input) matches" complaints seen
on ppc buildbot.

llvm-svn: 89452
2009-11-20 09:53:25 +00:00
Daniel Dunbar
66d480dc05 Fix -march= name for x86-64.
llvm-svn: 89445
2009-11-20 02:52:08 +00:00
Dan Gohman
d3d7358309 Fix fast-isel to avoid selecting the return instruction if a
tail call has been encountered.

llvm-svn: 89444
2009-11-20 02:51:26 +00:00
Evan Cheng
5fe8b0b3c5 Also CSE non-pic load from constant pools.
llvm-svn: 89440
2009-11-20 02:10:27 +00:00
Dan Gohman
9f19d60c14 Teach getSmallConstantTripMultiple about Shl operators.
llvm-svn: 89426
2009-11-20 01:09:34 +00:00
Evan Cheng
405012b096 Fix codegen of conditional move of immediates. We were not making use of the immediate forms of cmov instructions at all.
llvm-svn: 89423
2009-11-20 00:54:03 +00:00
Bill Wendling
9c08122387 Specify proper arch and triple for 64-bit.
llvm-svn: 89418
2009-11-20 00:40:21 +00:00
Bill Wendling
80716c8fd8 Testcase for r89415.
llvm-svn: 89417
2009-11-20 00:32:16 +00:00
Dan Gohman
44ddc50043 Extend CaptureTracking to indicate when a value is never stored, even
if it is not ultimately captured. Teach BasicAliasAnalysis that a 
local object address which does not escape and is never stored does
not alias with a value resulting from a load.

llvm-svn: 89398
2009-11-19 21:57:48 +00:00
Dan Gohman
026230b0a9 Enable hoisting of loads from constant memory by default. In cases where
they are lowered to instruction sequences more complex than a simple
load, such that CodeGen cannot rematerialize them, a reload from a
spill slot is likely to be cheaper than the complex sequence.

llvm-svn: 89374
2009-11-19 19:00:10 +00:00
Daniel Dunbar
cfcc2952fb Unbreak test, Bruno please check.
llvm-svn: 89329
2009-11-19 07:18:49 +00:00
Evan Cheng
987b8c3d9a More consistent thumb1 asm printing.
llvm-svn: 89328
2009-11-19 06:57:41 +00:00
Evan Cheng
c2e359a418 Shrink ldr / str [sp, imm0-1024] to 16-bit instructions.
llvm-svn: 89326
2009-11-19 06:32:27 +00:00
Bruno Cardoso Lopes
bf95b9699e - Add sugregister logic to handle f64=(f32,f32).
- Support mips1 like load/store of doubles:

Instead of:
  sdc $f0, X($3)
Generate:
  swc $f0, X($3)
  swc $f1, X+4($3)

llvm-svn: 89322
2009-11-19 06:06:13 +00:00
Bill Wendling
ecc50bcc77 Test from Dhrystone to make sure that we're not emitting an aligned load for a
string that's aligned at 8-bytes instead of 16-bytes.

llvm-svn: 89295
2009-11-19 01:33:57 +00:00
Bob Wilson
70bfa110eb Fix buildbots.
llvm-svn: 89274
2009-11-18 23:30:38 +00:00
Richard Osborne
fc2d5141a4 Add XCore support for indirectbr / blockaddress.
llvm-svn: 89273
2009-11-18 23:20:42 +00:00
Bob Wilson
dccd3bdb4e Tail duplication still needs to iterate. Duplicating new instructions onto
the tail of a block may make that block a new candidate for duplication.

llvm-svn: 89264
2009-11-18 22:52:37 +00:00
Bill Wendling
fe0d83e1fe Not all ASM has # for comments.
llvm-svn: 89250
2009-11-18 21:54:13 +00:00
Jakob Stoklund Olesen
7b5afd4dd6 Fix PR5300.
When TwoAddressInstructionPass deletes a dead instruction, make sure that all
register kills are accounted for. The 2-addr register does not get special
treatment.

llvm-svn: 89246
2009-11-18 21:33:35 +00:00
Jakob Stoklund Olesen
9472aae362 Fix inverted test and add testcase from failing self-host.
llvm-svn: 89167
2009-11-18 00:02:18 +00:00
Jakob Stoklund Olesen
f96b51a084 Remove fragile test.
llvm-svn: 89150
2009-11-17 21:52:40 +00:00
Jim Grosbach
d4db2d58ae Enable arm jumpt table adjustment.
llvm-svn: 89143
2009-11-17 21:24:11 +00:00
Anton Korobeynikov
6b1a243be8 Forgot to commit test fixes
llvm-svn: 89138
2009-11-17 20:38:36 +00:00
Jakob Stoklund Olesen
0ca73b9208 Enable -split-phi-edges by default, except when -regalloc=local.
The local register allocator doesn't like it when LiveVariables is run.
We should also disable edge splitting under -O0, but that has to wait a bit.

llvm-svn: 89125
2009-11-17 19:15:50 +00:00
Evan Cheng
aaa58b7653 Generalize OptimizeLoopTermCond to optimize more loop terminating icmp to use postinc iv.
llvm-svn: 89116
2009-11-17 18:10:11 +00:00
Evan Cheng
0f7e9f7cec Revert 89021. It's miscompiling llvm-gcc driver driver at -O0.
llvm-svn: 89082
2009-11-17 09:55:52 +00:00
Jakob Stoklund Olesen
6ac8f7ec34 Enable -split-phi-edges by default
llvm-svn: 89021
2009-11-17 01:07:22 +00:00
Evan Cheng
6e4430374e MOV64rm should be marked isReMaterializable.
llvm-svn: 89019
2009-11-17 00:55:55 +00:00
Jim Grosbach
b123a9cbc0 Convert to FileCheck
llvm-svn: 89007
2009-11-17 00:20:26 +00:00
Jim Grosbach
2f09113304 Convert to FileCheck
llvm-svn: 89002
2009-11-17 00:03:38 +00:00
Jim Grosbach
299e4e76c4 Cleanup. Missed removing these when converting. Oops.
llvm-svn: 89001
2009-11-17 00:00:33 +00:00
Dan Gohman
c2979de134 Fix this test - there don't appear to be any actual Reload Reuses
in this testcase.

llvm-svn: 88998
2009-11-16 23:49:55 +00:00
Dan Gohman
c35e84e1f5 Revert r87049, which was the workaround for the regression triggered
by the recent FixedStackPseudoSourceValue-related changes, now that
the specific bug that affected it is fixed, in r88954.

llvm-svn: 88997
2009-11-16 23:43:42 +00:00
Jeffrey Yasskin
9f05d972b7 Revert the test from r88984. It relies on being able to mmap 16GB of
address space (though it only uses a small fraction of that), and the
buildbots disallow that.

Also add a comment to the Makefile's ulimit line warning future
developers that changing it won't work.

llvm-svn: 88994
2009-11-16 23:32:30 +00:00
Jim Grosbach
95cf7fad36 Convert to FileCheck
llvm-svn: 88991
2009-11-16 23:19:29 +00:00
Jeffrey Yasskin
0f846dbb3e Make X86-64 in the Large model always emit 64-bit calls.
The large code model is documented at
http://www.x86-64.org/documentation/abi.pdf and says that calls should
assume their target doesn't live within the 32-bit pc-relative offset
that fits in the call instruction.

To do this, we turn off the global-address->target-global-address
conversion in X86TargetLowering::LowerCall(). The first attempt at
this broke the lazy JIT because it can separate the movabs(imm->reg)
from the actual call instruction. The lazy JIT receives the address of
the movabs as a relocation and needs to record the return address from
the call; and then when that call happens, it needs to patch the
movabs with the newly-compiled target. We could thread the call
instruction into the relocation and record the movabs<->call mapping
explicitly, but that seems to require at least as much new
complication in the code generator as this change.

To fix this, we make lazy functions _always_ go through a call
stub. You'd think we'd only have to force lazy calls through a stub on
difficult platforms, but that turns out to break indirect calls
through a function pointer. The right fix for that is to distinguish
between calls and address-of operations on uncompiled functions, but
that's complex enough to leave for someone else to do.

Another attempt at this defined a new CALL64i pseudo-instruction,
which expanded to a 2-instruction sequence in the assembly output and
was special-cased in the X86CodeEmitter's emitInstruction()
function. That broke indirect calls in the same way as above.

This patch also removes a hack forcing Darwin to the small code model.
Without far-call-stubs, the small code model requires things of the
JITMemoryManager that the DefaultJITMemoryManager can't provide.

Thanks to echristo for lots of testing!

llvm-svn: 88984
2009-11-16 22:41:33 +00:00
Evan Cheng
78be20d62e - Check memoperand alignment instead of checking stack alignment. Most load / store folding instructions are not referencing spill stack slots.
- Mark MOVUPSrm re-materializable.

llvm-svn: 88974
2009-11-16 21:56:03 +00:00
Jim Grosbach
f4abb1280a Convert to FileCheck
llvm-svn: 88947
2009-11-16 20:04:15 +00:00
Lang Hames
6a5810c037 Added a testcase for PR5495.
llvm-svn: 88946
2009-11-16 20:03:13 +00:00
Jim Grosbach
deee4fbd5d Convert to FileCheck
llvm-svn: 88942
2009-11-16 19:46:46 +00:00
Jim Grosbach
0ba7bb08d7 tbb opt off by default
llvm-svn: 88921
2009-11-16 17:24:45 +00:00
David Greene
6469fa6824 Support spill comments.
Have the asm printer emit a comment if an instruction is a spill or
reload and have the spiller mark copies it introdues so the asm printer
can also annotate those.

llvm-svn: 88911
2009-11-16 15:12:23 +00:00
Evan Cheng
ea46259f53 Check if subreg index is zero.
llvm-svn: 88899
2009-11-16 06:31:49 +00:00
Evan Cheng
2fa416debd For some targets, a copy can use a register multiple times, e.g. ppc.
llvm-svn: 88895
2009-11-16 05:52:06 +00:00
Evan Cheng
5c06a152a8 xfail for now. It has been failing.
llvm-svn: 88892
2009-11-16 05:44:04 +00:00
Bruno Cardoso Lopes
21ca44ba49 - Fix a small bug while handling target constant pools (one param was missing).
- Add a smarter constant pool loading, instead of:

lui $2, %hi($CPI1_0)
addiu $2, $2, %lo($CPI1_0)
lwc1 $f0, 0($2)

Generate:

lui $2, %hi($CPI1_0)
lwc1 $f0, %lo($CPI1_0)($2)

llvm-svn: 88886
2009-11-16 04:33:42 +00:00
Jim Grosbach
1aa571da3c Detect need for autoalignment of the stack earlier to catch spills more
conservatively. eliminateFrameIndex() machinery adjust to handle addr mode
6 (vld1/vst1) used for spills. Fix tests to expect aligned Q-reg spilling

llvm-svn: 88874
2009-11-15 21:45:34 +00:00
Nick Lewycky
f05946faff Revert r88830 and r88831 which appear to have caused a selfhost buildbot some
grief. I suspect this patch merely exposed a bug else.

llvm-svn: 88841
2009-11-15 07:47:32 +00:00
Nick Lewycky
62f00c17eb Correct typo.
llvm-svn: 88831
2009-11-15 06:16:57 +00:00
Nick Lewycky
14a2122db3 Teach instcombine to look for booleans in wider integers when it encounters a
zext(icmp). It may be able to optimize that away. This fixes one of the cases
in PR5438.

llvm-svn: 88830
2009-11-15 05:55:17 +00:00
Jim Grosbach
6028068e88 remove xfail
llvm-svn: 88817
2009-11-14 21:57:35 +00:00
Richard Osborne
8748f55236 Add XCore support for arbitrary-sized aggregate returns.
llvm-svn: 88802
2009-11-14 19:33:35 +00:00
Nick Lewycky
fba1efd298 Teach BasicAA that a constant expression can't alias memory provably not
allocated until runtime (such as an alloca). Patch by Hans Wennborg!

llvm-svn: 88760
2009-11-14 06:15:14 +00:00
Evan Cheng
b8c04e1226 Added getSubRegIndex(A,B) that returns subreg index of A to B. Use it to replace broken code in VirtRegRewriter.
llvm-svn: 88753
2009-11-14 03:42:17 +00:00
Evan Cheng
9b46e74f42 - Change TargetInstrInfo::reMaterialize to pass in TargetRegisterInfo.
- If destination is a physical register and it has a subreg index, use the
  sub-register instead.
This fixes PR5423.

llvm-svn: 88745
2009-11-14 02:55:43 +00:00
Evan Cheng
3781b2e7b3 Add radar number.
llvm-svn: 88739
2009-11-14 02:11:32 +00:00
Evan Cheng
c56b0a0f14 Fix PR5412: Fix an inverted check and another missing sub-register check.
llvm-svn: 88738
2009-11-14 02:09:09 +00:00
Dan Gohman
b36274632d Enable the tail call optimization when the caller returns undef.
llvm-svn: 88737
2009-11-14 02:06:30 +00:00
Evan Cheng
e43198c166 When expanding t2STRDi8 r, r to two stores, add kill markers correctly.
llvm-svn: 88734
2009-11-14 01:50:00 +00:00
Evan Cheng
e2907b91de Fix PR5411. Bug in UpdateKills. A reg def partially define its super-registers.
llvm-svn: 88719
2009-11-13 23:16:41 +00:00
David Greene
97a1f550d1 Move DebugInfo checks into EmitComments and remove them from
target-specific AsmPrinters.  Not all comments need DebugInfo.

Re-enable the line numbers comment test.

llvm-svn: 88697
2009-11-13 21:34:57 +00:00
Dan Gohman
972293611d When optimizing for size, don't tail-merge unless it's likely to be a
code-size win, and not when it's only likely to be code-size neutral,
such as when only a single instruction would be eliminated and a new
branch would be required.

This fixes rdar://7392894.

llvm-svn: 88692
2009-11-13 21:02:15 +00:00
Evan Cheng
f629fdcab2 Fix PR5410: LiveVariables lost subreg def:
D0<def,dead> = ...
...
             = S0<use, kill>
S0<def>      = ...
...
D0<def>      = 

The first D0 def is correctly marked dead, however, livevariables should have
added an implicit def of S0 or we end up with a use without a def.

llvm-svn: 88690
2009-11-13 20:36:40 +00:00
Dan Gohman
01b65e1e48 Don't let a noalias difference disrupt the tailcall optimization.
llvm-svn: 88672
2009-11-13 18:49:38 +00:00
Dale Johannesen
f57a58c4fe Adjust isConstantSplat to allow for big-endian targets.
PPC is such a target; make it work.

llvm-svn: 87060
2009-11-13 01:45:18 +00:00
Daniel Dunbar
cdeab5257c Update test.
llvm-svn: 87049
2009-11-13 01:01:58 +00:00
Jim Grosbach
8ffdb5d109 Clean up testcase a bit. Simplify case blocks and adjust switch instruction to not take an undefined value as input.
llvm-svn: 86997
2009-11-12 17:19:09 +00:00
Benjamin Kramer
86592507dc Fix typo in run line.
llvm-svn: 86984
2009-11-12 12:35:27 +00:00
Gabor Greif
15afbc8fa9 typo
llvm-svn: 86980
2009-11-12 09:44:17 +00:00
Chris Lattner
00a9240c9c implement a nice little efficiency hack in the inliner. Since we're now
running IPSCCP early, and we run functionattrs interlaced with the inliner,
we often (particularly for small or noop functions) completely propagate
all of the information about a call to its call site in IPSSCP (making a call
dead) and functionattrs is smart enough to realize that the function is
readonly (because it is interlaced with inliner).

To improve compile time and make the inliner threshold more accurate, realize
that we don't have to inline dead readonly function calls.  Instead, just 
delete the call.  This happens all the time for C++ codes, here are some
counters from opt/llvm-ld counting the number of times calls were deleted vs
inlined on various apps:

Tramp3d opt:
  5033 inline                - Number of call sites deleted, not inlined
 24596 inline                - Number of functions inlined
llvm-ld:
  667 inline           - Number of functions deleted because all callers found
  699 inline           - Number of functions inlined

483.xalancbmk opt:
  8096 inline                - Number of call sites deleted, not inlined
 62528 inline                - Number of functions inlined
llvm-ld:
   217 inline           - Number of allocas merged together
  2158 inline           - Number of functions inlined

471.omnetpp:
  331 inline                - Number of call sites deleted, not inlined
 8981 inline                - Number of functions inlined
llvm-ld:
  171 inline           - Number of functions deleted because all callers found
  629 inline           - Number of functions inlined


Deleting a call is much faster than inlining it, and is insensitive to the
size of the callee. :)

llvm-svn: 86975
2009-11-12 07:56:08 +00:00
Evan Cheng
deacae0dd9 RegScavenger::enterBasicBlock should always reset register state.
llvm-svn: 86972
2009-11-12 07:49:10 +00:00
Evan Cheng
b0a193db31 - Teach LSR to avoid changing cmp iv stride if it will create an immediate that
cannot be folded into target cmp instruction.
- Avoid a phase ordering issue where early cmp optimization would prevent the
  later count-to-zero optimization.
- Add missing checks which could cause LSR to reuse stride that does not have
  users.
- Fix a bug in count-to-zero optimization code which failed to find the pre-inc
  iv's phi node.
- Remove, tighten, loosen some incorrect checks disable valid transformations.
- Quite a bit of code clean up.

llvm-svn: 86969
2009-11-12 07:35:05 +00:00
Chris Lattner
01fddcec53 use getPredicateOnEdge to fold comparisons through PHI nodes,
which implements GCC PR18046.  This also gets us 360 more
jump threads on 176.gcc.

llvm-svn: 86953
2009-11-12 05:24:05 +00:00
Chris Lattner
b976027c91 should not commit when distracted.
llvm-svn: 86929
2009-11-12 02:04:17 +00:00
Chris Lattner
32bb09e867 We now thread some impossible condition information with LVI.
llvm-svn: 86927
2009-11-12 01:55:20 +00:00
Chris Lattner
68f3b53ddc with the new code we can thread non-instruction values. This
allows us to handle the test10 testcase.

llvm-svn: 86924
2009-11-12 01:41:34 +00:00
Chris Lattner
46056d81aa move some stuff into DEBUG's and turn on lazy-value-info for
the basic.ll testcase.

llvm-svn: 86918
2009-11-12 01:22:16 +00:00
Dan Gohman
f8ec4856e4 Tail merge at any size when there are two potentials blocks and one
can be made to fall through into the other.

llvm-svn: 86909
2009-11-12 00:39:10 +00:00
Kenneth Uildriks
82bc831061 x86 users can now return arbitrary sized structs. Structs too large to fit in return registers will be returned through a hidden sret parameter introduced during SelectionDAG construction.
llvm-svn: 86876
2009-11-11 19:59:24 +00:00
Dan Gohman
9f47de10e3 Add support for tail duplication to BranchFolding, and extend
tail merging support to handle more cases.
 - Recognize several cases where tail merging is beneficial even when
   the tail size is smaller than the generic threshold.
 - Make use of MachineInstrDesc::isBarrier to help detect
   non-fallthrough blocks.
 - Check for and avoid disrupting fall-through edges in more cases.

llvm-svn: 86871
2009-11-11 19:48:59 +00:00
Devang Patel
630136fb86 Reenable StackTracke.cpp test.
llvm-svn: 86861
2009-11-11 19:08:42 +00:00
Duncan Sands
f0d9823d0b Don't trivially delete unused calls to llvm.invariant.start. This allows
llvm.invariant.start to be used without necessarily being paired with a call
to llvm.invariant.end.  If you run the entire optimization pipeline then such
calls are in fact deleted (adce does it), but that's actually a good thing since
we probably do want them to be zapped late in the game.  There should really be
an integration test that checks that the llvm.invariant.start call lasts long
enough that all passes that do interesting things with it get to do their stuff
before it is deleted.  But since no passes do anything interesting with it yet
this will have to wait for later.

llvm-svn: 86840
2009-11-11 15:34:13 +00:00
Evan Cheng
913687616e Add nounwind.
llvm-svn: 86814
2009-11-11 07:11:02 +00:00
Chris Lattner
746b4b7f2a remove condprop testcases.
llvm-svn: 86804
2009-11-11 05:25:16 +00:00
Daniel Dunbar
def4580a85 Add missing run line. Devang, please check.
llvm-svn: 86795
2009-11-11 03:10:03 +00:00
Bill Wendling
a6d7a411d3 Fix test to work on every platform.
llvm-svn: 86786
2009-11-11 01:44:22 +00:00
Bill Wendling
8718dfbbaa Fix test to work on every platform.
llvm-svn: 86785
2009-11-11 01:41:32 +00:00
Devang Patel
496147ef73 XFAIL for now.
llvm-svn: 86784
2009-11-11 01:41:10 +00:00
Bill Wendling
33ab3cd1bc Make sure that the exception handling data has the same visibility as the
function it's generated for.

llvm-svn: 86779
2009-11-11 01:24:59 +00:00
Devang Patel
b3f18462ca Do not assume first function scope seen represents current function.
llvm-svn: 86771
2009-11-11 00:31:36 +00:00
Chris Lattner
47b6f3432e oops, didn't mean to commit this, no harm, but add a todoops, didn't mean to commit this, no harm, but add a todoo
llvm-svn: 86768
2009-11-11 00:27:54 +00:00
Chris Lattner
6c04051d2a Stub out a new lazy value info pass, which will eventually
vend value constraint information to the optimizer.

llvm-svn: 86767
2009-11-11 00:22:30 +00:00
Devang Patel
eb421ea5de While creating DbgScopes, do not forget parent scope.
llvm-svn: 86763
2009-11-11 00:18:40 +00:00
Evan Cheng
ea76ec6720 Block terminator may be a switch.
llvm-svn: 86761
2009-11-11 00:00:21 +00:00
Bill Wendling
ff705446e1 Test this on Darwin only.
llvm-svn: 86752
2009-11-10 23:18:33 +00:00
Dale Johannesen
20e1cd09ba Emit correct code when making a ConstantPool entry for a vector
constant whose component type is not a legal type for the target.
(If the target ConstantPool cannot handle this type either, it has
an opportunity to merge elements.  In practice any target with
8-bit bytes must support i8 *as data*).  7320806 (partial).

llvm-svn: 86751
2009-11-10 23:16:41 +00:00
Chris Lattner
f66a81aecd implement a TODO by teaching jump threading about "xor x, 1".
llvm-svn: 86739
2009-11-10 22:39:16 +00:00
Bill Wendling
1176227990 Modify how the prologue encoded the "move" information for the FDE. GCC
generates a sequence similar to this:

__Z4funci:
LFB2:
        mflr r0
LCFI0:
        stmw r30,-8(r1)
LCFI1:
        stw r0,8(r1)
LCFI2:
        stwu r1,-80(r1)
LCFI3:
        mr r30,r1
LCFI4:

where LCFI3 and LCFI4 are used by the FDE to indicate what the FP, LR, and other
things are. We generated something more like this:

Leh_func_begin1:
        mflr r0
        stw r31, 20(r1)
        stw r0, 8(r1)
Llabel1:
        stwu r1, -80(r1)
Llabel2:
        mr r31, r1

Note that we are missing the "mr" instruction. This patch makes it more like the
GCC output.

llvm-svn: 86729
2009-11-10 22:14:04 +00:00
Chris Lattner
a163be92fc fix a crash in SCCP handling extractvalue of an array, pointed out and
tracked down by Stephan Reiter!

llvm-svn: 86726
2009-11-10 22:02:09 +00:00
Chris Lattner
fca84b3dff Make jump threading eliminate blocks that just contain phi nodes,
debug intrinsics, and an unconditional branch when possible.  This
reuses the TryToSimplifyUncondBranchFromEmptyBlock function split
out of simplifycfg.

llvm-svn: 86722
2009-11-10 21:40:01 +00:00
Evan Cheng
f5e85bec73 Generalize lsr code that optimize loop to count down towards zero.
llvm-svn: 86715
2009-11-10 21:14:05 +00:00
Dan Gohman
d7b00c4c8d Optimize test more.
llvm-svn: 86714
2009-11-10 21:02:18 +00:00
Duncan Sands
732a2ed037 Teach DSE to eliminate useless trampolines.
llvm-svn: 86683
2009-11-10 13:49:50 +00:00
Victor Hernandez
3c98070f2c Update computeArraySize() to use ComputeMultiple() to determine the array size associated with a malloc; also extend PerformHeapAllocSRoA() to check if the optimized malloc's arg had its highest bit set, so that it is safe for ComputeMultiple() to look through sext instructions while determining the optimized malloc's array size
llvm-svn: 86676
2009-11-10 08:32:25 +00:00
Chris Lattner
3455c2f5c6 optimize test
llvm-svn: 86672
2009-11-10 07:44:36 +00:00
Chris Lattner
562cc40dbb unify the code that determines whether it is a good idea to change the type
of a computation.  This fixes some infinite loops when dealing with TD that
has no native types.

llvm-svn: 86670
2009-11-10 07:23:37 +00:00
Nick Lewycky
f6be02e523 Reapply r86359, "Teach dead store elimination that certain intrinsics write to
memory just like a store" with bug fixed (partial-overwrite.ll is the
regression test).

llvm-svn: 86667
2009-11-10 06:46:40 +00:00
Chris Lattner
f3fc70a936 make jump threading recursively simplify expressions instead of doing it
just one level deep.  On the testcase we go from getting this:

F1:                                               ; preds = %T2
  %F = and i1 true, %cond                         ; <i1> [#uses=1]
  br i1 %F, label %X, label %Y

to a fully threaded:

F1:                                               ; preds = %T2
  br label %Y


This changes gets us to the point where we're forming (too many) switch 
instructions on doug's strswitch testcase.

llvm-svn: 86646
2009-11-10 01:57:31 +00:00
Dan Gohman
b4edfdb842 Trim a bunch of unneeded code from this testcase.
llvm-svn: 86640
2009-11-10 01:33:08 +00:00
Mike Stump
ee3ba929d0 Add testcase for recent checkin.
llvm-svn: 86620
2009-11-09 23:10:49 +00:00
Jim Grosbach
9f37156ae5 Update test
llvm-svn: 86614
2009-11-09 22:59:01 +00:00
Dan Gohman
6780148e20 Default-addressspace null pointers don't alias anything. This allows
GVN to be more aggressive. Patch by Hans Wennborg! (with a comment added by me)

llvm-svn: 86582
2009-11-09 19:29:11 +00:00
Dan Gohman
457b8bad4e Generalize LCSSA to handle loops with exits with predecessors outside
the loop. This is needed because with indirectbr it may not be possible
for LoopSimplify to guarantee that all loop exit predecessors are
inside the loop. This fixes PR5437.

LCCSA no longer actually requires LoopSimplify form, but for now it
must still have the dependency because the PassManager doesn't know
how to schedule LoopSimplify otherwise.

llvm-svn: 86569
2009-11-09 18:28:24 +00:00
Daniel Dunbar
e4f2bab2cd Use ',' separation in XFAILs, lit doesn't evaluate them as regexs (easy to add,
but might as well use the more standard syntax).

llvm-svn: 86553
2009-11-09 16:38:15 +00:00
Chris Lattner
f2b3c795fd if a 'with overflow' intrinsic just has the normal result used, simplify
it to a normal binop.  Patch by Alastair Lynn, testcase by me.

llvm-svn: 86524
2009-11-09 07:07:56 +00:00
Chris Lattner
5a3a41a757 enhance PHI slicing to handle the case when a slicable PHI is begin
used by a chain of other PHIs.

llvm-svn: 86503
2009-11-09 01:38:00 +00:00
Owen Anderson
7ac0e198c3 Revert my previous patch to ABCD and fix things the right way. There are two problems addressed
here:

1) We need to avoid processing sigma nodes as phi nodes for constraint generation.
2) We need to generate constraints for comparisons against constants properly.

This includes our first working ABCD test!

llvm-svn: 86498
2009-11-09 00:44:44 +00:00
Jim Grosbach
ea6c9c17f5 Use Unified Assembly Syntax for the ARM backend.
llvm-svn: 86494
2009-11-09 00:11:35 +00:00
Chris Lattner
6c67b00026 Teach an instcombine to not pull trunc instructions through PHI nodes
when both the source and dest are illegal types, since it would cause
the phi to grow (for example, we shouldn't transform test14b's phi to
a phi on i320).  This fixes an infinite loop on i686 bootstrap with
phi slicing turned on, so turn it back on.

llvm-svn: 86483
2009-11-08 21:20:06 +00:00
Chris Lattner
11b6e3c1eb reapply r8644[3-5] with only the scary part
(SliceUpIllegalIntegerPHI) disabled.

llvm-svn: 86480
2009-11-08 19:23:30 +00:00
Daniel Dunbar
1543f2c26f Speculatively revert r8644[3-5], they seem to be leading to infinite loops in
llvm-gcc bootstrap.

llvm-svn: 86478
2009-11-08 17:52:47 +00:00
Anton Korobeynikov
552b831b91 Add and-not (bic) patterns. Based heavily on patch by Brian Lucas!
llvm-svn: 86471
2009-11-08 15:33:12 +00:00
Anton Korobeynikov
6f4ee0efe1 Fix invalid operand updates & implement post-inc memory operands
llvm-svn: 86466
2009-11-08 14:27:38 +00:00
Anton Korobeynikov
7b3a35eee8 It is invalid to infer the value type from the result #0 of the node
since the instruction might use the other result of different type.

llvm-svn: 86462
2009-11-08 12:14:54 +00:00
Daniel Dunbar
274f1953cd Two small fixes for site.exp for cmake.
llvm-svn: 86453
2009-11-08 09:29:52 +00:00
Daniel Dunbar
bbee468b71 Derive the right paths to use during testing instead of passing it in via make.
Also, fix a few other details of the cmake test target and rename it to
'check'. CMake tests now work for the most part, but there are a handful of
failures left due to missing site.exp bits.

llvm-svn: 86452
2009-11-08 09:08:00 +00:00
Daniel Dunbar
ecd03574d6 Switch to using 'lit.site.cfg.in' for the site config template for Unit tests,
and generate it for CMake builds as well.

llvm-svn: 86451
2009-11-08 09:07:51 +00:00
Daniel Dunbar
abaa288896 Cleanup some unused RUN lines.
llvm-svn: 86450
2009-11-08 09:07:42 +00:00
Chris Lattner
d8faf7adb4 another more interesting test.
llvm-svn: 86445
2009-11-08 08:36:40 +00:00
Chris Lattner
a8adfad5b9 feature test for the new transformation in r86443
llvm-svn: 86444
2009-11-08 08:30:58 +00:00
Chris Lattner
cddc8aa1b8 teach a couple of instcombine transformations involving PHIs to
not turn a PHI in a legal type into a PHI of an illegal type, and
add a new optimization that breaks up insane integer PHI nodes into
small pieces (PR3451).

llvm-svn: 86443
2009-11-08 08:21:13 +00:00
Nick Lewycky
20b71b5437 Remove test. Execution tests are slow and generally not worth it.
llvm-svn: 86434
2009-11-08 02:23:15 +00:00
Nick Lewycky
c62b3b55b1 Fix run line.
llvm-svn: 86429
2009-11-08 01:04:45 +00:00
Nick Lewycky
21dd3f31b0 Fix the interpreter to not crash due to zeroext/signext
llvm-svn: 86428
2009-11-08 00:45:29 +00:00
Daniel Dunbar
656c9bf461 Stop running get_target_triple more than we need to.
llvm-svn: 86418
2009-11-07 23:52:20 +00:00
Nate Begeman
49d93dc6d1 x86 vector shuffle cleanup/fixes:
1. rename the movhp patfrag to movlhps, since thats what it actually matches
2. eliminate the bogus movhps load and store patterns, they were incorrect.  The load transforms are already handled (correctly) by shufps/unpack.
3. revert a recent test change to its correct form.

llvm-svn: 86415
2009-11-07 23:17:15 +00:00
Nick Lewycky
2b3ac2b1a7 Improve tail call elimination to handle the switch statement.
llvm-svn: 86403
2009-11-07 21:10:15 +00:00
Chris Lattner
73948d415c temporarily remove these tests, as they are breaking in the buildbot,
Eric, please investigate.

llvm-svn: 86399
2009-11-07 19:13:17 +00:00
Chris Lattner
c6bb31e5ea make instcombine only rewrite a chain of computation
(eliminating some extends) if the new type of the
computation is legal or if both the source and dest
are illegal.  This prevents instcombine from changing big
chains of computation into i64 on 32-bit targets for 
example.

llvm-svn: 86398
2009-11-07 19:11:46 +00:00
Chris Lattner
c9fb52966e remove empty files.
llvm-svn: 86392
2009-11-07 18:03:32 +00:00
Chris Lattner
15b00179d0 Revert r86359, it is breaking the self host on the
llvm-gcc-i386-darwin9 build bot.

llvm-svn: 86391
2009-11-07 17:59:32 +00:00
Anton Korobeynikov
9dc741f523 Add some dummy support for post-incremented loads
llvm-svn: 86385
2009-11-07 17:15:06 +00:00
Anton Korobeynikov
0a13189111 Add 8 bit libcalls and make use of them for msp430
llvm-svn: 86384
2009-11-07 17:14:39 +00:00
Anton Korobeynikov
da044db0f5 Initial support for addrmode handling. Tests by Brian Lucas!
llvm-svn: 86382
2009-11-07 17:13:35 +00:00
Anton Korobeynikov
30095499fc It turns out that the testcase in question uncovered subreg-handling bug.
Add assert in asmprinter to catch such cases and xfail the tests.
PR is to be filled.

llvm-svn: 86375
2009-11-07 15:20:32 +00:00
Eric Christopher
c5bcc1db29 Fix a couple of shuffle patterns to use movhlps instead
of movhps as the constraint.  Changes optimizations so
update testcases as appropriate as well.

llvm-svn: 86360
2009-11-07 08:45:53 +00:00
Nick Lewycky
80180a0497 Teach dead store elimination that certain intrinsics write to memory just like
a store.

llvm-svn: 86359
2009-11-07 08:34:40 +00:00
Chris Lattner
3482ad7de0 reapply 86289, 86278, 86270, 86267, 86266 & 86264 plus a fix
(making pred factoring only happen if threading is guaranteed
to be successful).

This now survives an X86-64 bootstrap of llvm-gcc.

llvm-svn: 86355
2009-11-07 08:05:03 +00:00
Chris Lattner
d5eaa6d39b Fix PR5421 by APInt'izing switch lowering.
llvm-svn: 86354
2009-11-07 07:50:34 +00:00
Nick Lewycky
f49c373c13 Oops, FunctionContainsEscapingAllocas is really used to mean two different
things. Back out part of r86349 for a moment.

llvm-svn: 86353
2009-11-07 07:42:38 +00:00
Nick Lewycky
a2b0965613 Dust off tail recursion elimination. Fix a fixme by applying CaptureTracking
and add a .ll to demo the new capability.

llvm-svn: 86349
2009-11-07 07:10:01 +00:00
Chris Lattner
1be54634e0 merge cmp1 into cmp0 and filecheckize.
llvm-svn: 86345
2009-11-07 06:19:20 +00:00
Evan Cheng
899d8cb6a0 Refactor code. Fix a potential missing check. Teach isIdentical() about tLDRpci_pic.
llvm-svn: 86330
2009-11-07 04:04:34 +00:00
Evan Cheng
8eaaffb9da - Add TargetInstrInfo::isIdentical(). It's similar to MachineInstr::isIdentical
except it doesn't care if the definitions' virtual registers differ. This is
  used by machine LICM and other MI passes to perform CSE.
- Teach Thumb2InstrInfo::isIdentical() to check two t2LDRpci_pic are identical.
  Since pc relative constantpool entries are always different, this requires it
  it check if the values can actually the same.

llvm-svn: 86328
2009-11-07 03:52:02 +00:00
Devang Patel
84b2af870e Revert following patches to fix llvmgcc bootstrap.
86289, 86278, 86270, 86267, 86266 & 86264
Chris, please take a look.

llvm-svn: 86321
2009-11-07 01:32:59 +00:00
Victor Hernandez
8736a8fca4 Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86311
2009-11-07 00:16:28 +00:00
Evan Cheng
6e3e66375a - Add pseudo instructions tLDRpci_pic and t2LDRpci_pic which does a pc-relative
load of a GV from constantpool and then add pc. It allows the code sequence to
  be rematerializable so it would be hoisted by machine licm.
- Add a late pass to break these pseudo instructions into a number of real
  instructions. Also move the code in Thumb2 IT pass that breaks up t2MOVi32imm
  to this pass. This is done before post regalloc scheduling to allow the
  scheduler to proper schedule these instructions. It also allow them to be
  if-converted and shrunk by later passes.

llvm-svn: 86304
2009-11-06 23:52:48 +00:00
Anton Korobeynikov
dca40933ee Honour subreg machine operands during asmprinting
llvm-svn: 86303
2009-11-06 23:45:15 +00:00
Bob Wilson
e79354a831 Print VMOV (immediate) operands as hexadecimal values. Apple's assembler
will not accept negative values for these.  LLVM's default operand printing
sign extends values, so that valid unsigned values appear as negative
immediates.  Print all VMOV immediate operands as hex values to resolve this.
Radar 7372576.

llvm-svn: 86301
2009-11-06 23:33:28 +00:00
Bob Wilson
68772d4db2 Fix a broken test.
llvm-svn: 86298
2009-11-06 23:06:42 +00:00
Evan Cheng
aaf30ce699 Remove ARMPCLabelIndex from ARMISelLowering. Use ARMFunctionInfo::createConstPoolEntryUId() instead.
llvm-svn: 86294
2009-11-06 22:24:13 +00:00
Gabor Greif
b0c347888a fix typo
llvm-svn: 86281
2009-11-06 20:10:46 +00:00
Chris Lattner
93a3e74486 Fix a problem discovered on self host.
llvm-svn: 86278
2009-11-06 19:21:48 +00:00
Devang Patel
1a557eacb8 Tolerate invalid derived type.
llvm-svn: 86269
2009-11-06 18:24:05 +00:00
Chris Lattner
b688868418 Extend jump threading to support much more general threading
predicates.  This allows us to jump thread things like:

_ZN12StringSwitchI5ColorE4CaseILj7EEERS1_RAT__KcRKS0_.exit119:
  %tmp1.i24166 = phi i8 [ 1, %bb5.i117 ], [ %tmp1.i24165, %_Z....exit ], [ %tmp1.i24165, %bb4.i114 ] 
  %toBoolnot.i87 = icmp eq i8 %tmp1.i24166, 0     ; <i1> [#uses=1]
  %tmp4.i90 = icmp eq i32 %tmp2.i, 6              ; <i1> [#uses=1]
  %or.cond173 = and i1 %toBoolnot.i87, %tmp4.i90  ; <i1> [#uses=1]
  br i1 %or.cond173, label %bb4.i96, label %_ZN12...

Where it is "obvious" that when coming from %bb5.i117 that the 'and' is always 
false.  This triggers a surprisingly high number of times in the testsuite, 
and gets us closer to generating good code for doug's strswitch testcase.

This also make a bunch of other code in jump threading redundant, I'll rip
out in the next patch.  This survived an enable-checking llvm-gcc bootstrap.

llvm-svn: 86264
2009-11-06 18:15:14 +00:00
Devang Patel
0d1f6a9d0e Do not bother to emit debug info for nameless global variable.
llvm-svn: 86259
2009-11-06 17:58:12 +00:00
Victor Hernandez
a5a12cd62e Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
llvm-svn: 86213
2009-11-06 01:33:24 +00:00
Devang Patel
5035033346 Do not try to emit debug info entry for dead global variable.
llvm-svn: 86212
2009-11-06 01:30:04 +00:00
Eric Christopher
593cfc9984 Fix PR5315, original patch by Nicolas Capens!
llvm-svn: 86203
2009-11-06 00:11:57 +00:00
Dan Gohman
229f9edf7a Update these tests for the new label names.
llvm-svn: 86192
2009-11-05 23:31:40 +00:00
Dan Gohman
f65735f0c5 The introduction of indirectbr meant the introduction of
unsplittable critical edges, which means the introduction of
loops which cannot be transformed to LoopSimplify form. Fix
LoopSimplify to avoid transforming such loops into invalid
code.

llvm-svn: 86176
2009-11-05 21:14:46 +00:00
Benjamin Kramer
a38019a3de Teach SimplifyLibCalls to fold memcmp calls with constant arguments.
llvm-svn: 86141
2009-11-05 17:44:22 +00:00
Chris Lattner
412e9dc6fc merge a few crash tests into crash.ll
llvm-svn: 86119
2009-11-05 05:57:34 +00:00
Bob Wilson
641ce17702 Add -mtriple to llc commands, attempting to fix buildbot failures.
llvm-svn: 86086
2009-11-05 00:51:31 +00:00
Bob Wilson
d14be3d83c Attempt again to fix buildbot failures: make expected output less specific
and compile with -mtriple to specify *-apple-darwin targets.

llvm-svn: 86081
2009-11-05 00:30:35 +00:00
Victor Hernandez
21ec158c23 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86077
2009-11-05 00:03:03 +00:00
Chris Lattner
a003aee613 improve DSE when TargetData is not around, based on work by
Hans Wennborg!

llvm-svn: 86067
2009-11-04 23:20:12 +00:00
Bob Wilson
25738f9e79 Add PowerPC codegen for indirect branches.
llvm-svn: 86050
2009-11-04 21:31:18 +00:00
Bob Wilson
9e30ecad4e Fix broken test.
llvm-svn: 86045
2009-11-04 20:04:11 +00:00
Bob Wilson
ca42ca296d Add test for ARM indirectbr codegen.
llvm-svn: 86042
2009-11-04 19:25:34 +00:00
Evan Cheng
801415706c RangeIsDefinedByCopyFromReg() should check for subreg_to_reg, insert_subreg,
and extract_subreg as a "copy" that defines a valno.
Also fixes a typo. These two issues prevent a simple subreg coalescing from
happening before.

llvm-svn: 86022
2009-11-04 08:33:14 +00:00
Chris Lattner
d8ab8fbe9f move two functions up higher in the file. Delete a useless argument
to EmitGEPOffset.  

Implement some new transforms for optimizing 
subtracts of two pointer to ints into the same vector.  This happens
for C++ iterator idioms for example, stringmap takes a const char*
that points to the start and end of a string.  Once inlined, we want
the pointer difference to turn back into a length.

This is rdar://7362831.

llvm-svn: 86021
2009-11-04 08:05:20 +00:00
Chris Lattner
aede55dc9b filecheckize this test.
llvm-svn: 86020
2009-11-04 07:57:05 +00:00
Evan Cheng
8b161e8f4f Fix test.
llvm-svn: 85986
2009-11-04 00:42:33 +00:00
Chris Lattner
b634c6cdb5 reimplement multiple return value handling in IPSCCP, making it
more aggressive an correct.  This survives building llvm in 64-bit
mode with optimizations and the built llvm passes make check.

llvm-svn: 85973
2009-11-03 23:40:48 +00:00
Evan Cheng
caab17007b fconsts / fconstd immediate should be proceeded with #.
llvm-svn: 85952
2009-11-03 21:59:33 +00:00
Evan Cheng
d783406059 Re-apply 85799. It turns out my code isn't buggy.
llvm-svn: 85947
2009-11-03 21:40:02 +00:00
Chris Lattner
036e15ff97 fix test
llvm-svn: 85946
2009-11-03 21:26:26 +00:00
Chris Lattner
11eafaadc3 merge a test into ipsccp-basic. running llvm-ld to get one pass is... bad.
llvm-svn: 85945
2009-11-03 21:25:50 +00:00
Chris Lattner
3ea71a58aa turn IPSCCP back on by default, try #3 or 4? Woo.
llvm-svn: 85929
2009-11-03 19:35:13 +00:00
Chris Lattner
2aa5962af6 fix an IPSCCP bug I introduced when I changed IPSCCP to start working on
functions that don't have local linkage.  Basically, we need to be more
careful about propagating argument information to functions whose results
we aren't tracking.  This fixes a miscompilation of 
LLVMCConfigurationEmitter.cpp when built with an llvm-gcc that has ipsccp
enabled.

llvm-svn: 85923
2009-11-03 19:24:51 +00:00
Devang Patel
5b0aaf3a1f Parse debug info attached with insertvalue and extractvalue instructions.
llvm-svn: 85921
2009-11-03 19:06:07 +00:00
Chris Lattner
cac8f54197 xfail this test since daniel turned off ipsccp
llvm-svn: 85907
2009-11-03 17:54:12 +00:00
Chris Lattner
15ceb6e7f7 testcase for r85903
llvm-svn: 85906
2009-11-03 17:03:02 +00:00
Kenneth Uildriks
e711736014 Make opt default to not adding a target data string and update tests that depend on target data to supply it within the test
llvm-svn: 85900
2009-11-03 15:29:06 +00:00
Evan Cheng
ed22395c61 Fix PR5367. QPR_8 is the super regclass of DPR_8 and SPR_8.
llvm-svn: 85871
2009-11-03 05:52:54 +00:00
Nate Begeman
52bcd33312 Declare sin & cos as readonly so they match the code in SelectionDAGBuild
llvm-svn: 85853
2009-11-03 02:19:31 +00:00
Anton Korobeynikov
bce2703f18 Temporary xfail until PR5367 will be resolved
llvm-svn: 85848
2009-11-03 00:37:36 +00:00
Anton Korobeynikov
48b30c79be Revert r85049, it is causing PR5367
llvm-svn: 85847
2009-11-03 00:24:48 +00:00
Evan Cheng
ca5847665b Revert 85799 for now. It might be breaking llvm-gcc driver.
llvm-svn: 85827
2009-11-02 21:49:14 +00:00
Chris Lattner
fc4e63b285 merge 2008-03-10-sret.ll into ipsccp-basic.ll, and upgrade its syntax.
llvm-svn: 85811
2009-11-02 18:27:22 +00:00
Chris Lattner
a1776913ab disable IPSCCP support for multiple return values, it is buggy, so just
disable it until I can fix it.

llvm-svn: 85810
2009-11-02 18:22:51 +00:00
Evan Cheng
ec5cb0cdbd Initilize the machine LICM CSE map upon the first time an instruction is hoisted to
the loop preheader. Add instructions which are already in the preheader block that
may be common expressions of those that are hoisted out. These does get a few more
instructions CSE'ed.

llvm-svn: 85799
2009-11-02 08:09:49 +00:00
Chris Lattner
f1afb57935 improve IPSCCP to be able to propagate the result of "!mayBeOverridden"
function to calls of that function, regardless of whether it has local
linkage or has its address taken.  Not escaping should only affect 
whether we make an aggressive assumption about the arguments to a 
function, not whether we can track the result of it.

llvm-svn: 85795
2009-11-02 07:33:59 +00:00
Evan Cheng
ce9d8e2737 Remove an irrelevant and poorly reduced test case.
llvm-svn: 85794
2009-11-02 07:11:54 +00:00
Chris Lattner
16b825e51f Use the libanalysis 'ConstantFoldLoadFromConstPtr' function
instead of reinventing SCCP-specific logic.  This gives us
new powers.

llvm-svn: 85789
2009-11-02 06:06:14 +00:00
Evan Cheng
57f7c7c914 Unbreak ARMBaseRegisterInfo::copyRegToReg.
llvm-svn: 85787
2009-11-02 04:44:55 +00:00
Chris Lattner
9fc809ca55 fix a bug exposed by moving SRoA earlier which caused a crash building kc++
llvm-svn: 85786
2009-11-02 04:37:17 +00:00
Chris Lattner
b94afb778c fix instcombine to only do store sinking when the alignments
of the two loads agree.  Propagate that onto the new store.

llvm-svn: 85772
2009-11-02 02:06:37 +00:00
Chris Lattner
96bfb792af merge a test into store.ll
llvm-svn: 85771
2009-11-02 02:00:18 +00:00
Chris Lattner
0eaddd9187 convert to filecheck
llvm-svn: 85770
2009-11-02 01:58:03 +00:00
Anton Korobeynikov
09147da530 Handle splats of undefs properly. This includes the testcase for PR5364 as well.
llvm-svn: 85767
2009-11-02 00:12:06 +00:00
Anton Korobeynikov
ed410a8ee3 64-bit FP loads & stores operate on both NEON and VFP pipelines.
llvm-svn: 85765
2009-11-02 00:11:06 +00:00
Evan Cheng
4a0d47f209 Make use of imm12 version of Thumb2 ldr / str instructions more aggressively.
llvm-svn: 85743
2009-11-01 21:12:51 +00:00
Chris Lattner
326adfb172 merge phi-merge.ll into phi.ll
I don't know what Dan wants to do with phi-merge-gep.ll, I'll let
him deal with it because instcombine may end up sinking these.

llvm-svn: 85739
2009-11-01 20:10:11 +00:00
Chris Lattner
f3c2039dde when merging two loads, make sure to take the min of their alignment,
not the max.  This didn't matter until the previous patch because
instcombine would refuse to sink loads with differenting alignments.

llvm-svn: 85738
2009-11-01 20:07:07 +00:00
Chris Lattner
b3fe1009a5 fix a bug noticed by inspection: when instcombine sinks loads through
phis, it didn't preserve the alignment of the load.  This is a missed
optimization of the alignment is high and a miscompilation when the
alignment is low.

llvm-svn: 85736
2009-11-01 19:50:13 +00:00
Chris Lattner
c0f971670d convert to filecheck.
llvm-svn: 85734
2009-11-01 19:22:20 +00:00
Chris Lattner
69549467e3 We currently only run ipsccp at LTO time, which is silly. It subsumes
ipconstprop and doesn't take much time.  Just run it in its place.

This adds a testcase for it, which I plan to expand to cover other
"integration" cases, where we expect the optimizer to be able to
eliminate various things.  Due to phase order issues we've regressed
in a number of areas and integration tests are the only way I see to
prevent this.

llvm-svn: 85729
2009-11-01 18:57:49 +00:00
Evan Cheng
0151329ce5 Fix tests.
llvm-svn: 85723
2009-11-01 18:13:29 +00:00
Chris Lattner
4cf2980e59 improve x86 codegen support for blockaddress. We now compile
the testcase into:

_test1:                                                     ## @test1
## BB#0:                                                    ## %entry
	leaq	L_test1_bb6(%rip), %rax
	jmpq	*%rax
L_test1_bb:                                                 ## Address Taken
LBB1_1:                                                     ## %bb
	movb	$1, %al
	ret
L_test1_bb6:                                                ## Address Taken
LBB1_2:                                                     ## %bb6
	movb	$2, %al
	ret

Note, it is very very strange that BlockAddressSDNode doesn't carry 
around TargetFlags.  Dan, please fix this.

llvm-svn: 85703
2009-11-01 03:25:03 +00:00
Evan Cheng
de16fff3e8 Use cbz and cbnz instructions.
llvm-svn: 85698
2009-10-31 23:46:45 +00:00
Jim Grosbach
5b094f3b36 vml[as].f32 cause stalls in following advanced SIMD instructions. Avoid using
them for scalar floating point operations for now.

llvm-svn: 85697
2009-10-31 22:57:36 +00:00
Jim Grosbach
7dfa53d978 Consolidate test files
llvm-svn: 85696
2009-10-31 22:20:56 +00:00
Jim Grosbach
acb31ebed1 Change to use FileCheck
llvm-svn: 85695
2009-10-31 22:16:14 +00:00
Jim Grosbach
93bcf7b8ce Make tests more explicit about which instructions are expected.
llvm-svn: 85694
2009-10-31 22:14:17 +00:00
Jim Grosbach
84e67e8e5c Grammar tweak to comments
llvm-svn: 85693
2009-10-31 22:12:44 +00:00
Jim Grosbach
c003ed5615 Update test to be more explicit about what instruction sequences are expected for each operation.
llvm-svn: 85691
2009-10-31 22:10:38 +00:00
Jim Grosbach
2a445e5d0a Update test to be more explicit about what instruction sequences are expected for each operation.
llvm-svn: 85689
2009-10-31 21:52:58 +00:00
Jim Grosbach
ace75c4288 Expand 64-bit logical shift right inline
llvm-svn: 85687
2009-10-31 21:42:19 +00:00
Jim Grosbach
16ae289667 Expand 64-bit arithmetic shift right inline
llvm-svn: 85685
2009-10-31 21:00:56 +00:00
Benjamin Kramer
2cc5f86d43 Force triple; darwin's ASM syntax differs from linux's.
llvm-svn: 85676
2009-10-31 19:54:06 +00:00
Jim Grosbach
534d2cb249 Expand 64 bit left shift inline rather than using the libcall. For now, this
is unconditional. Making it still use the libcall when optimizing for size
would be a good adjustment.

llvm-svn: 85675
2009-10-31 19:38:01 +00:00
Benjamin Kramer
60dac7de40 Add missing colons for FileCheck.
llvm-svn: 85674
2009-10-31 19:22:24 +00:00
Jim Grosbach
78a5bcfa02 Convert to FileCheck
llvm-svn: 85673
2009-10-31 19:06:53 +00:00
Dan Gohman
61e806613f Revert r85667. LoopUnroll currently can't call utility functions which
auto-update the DominatorTree because it doesn't keep the DominatorTree
current while it works.

llvm-svn: 85670
2009-10-31 17:33:01 +00:00
Dan Gohman
40cec16be1 Merge the enhancements from LoopUnroll's FoldBlockIntoPredecessor into
MergeBlockIntoPredecessor. This makes SimplifyCFG slightly more aggressive,
and makes it unnecessary for LoopUnroll to have its own copy of this code.

llvm-svn: 85667
2009-10-31 16:08:00 +00:00
Evan Cheng
9178904e56 It's safe to remat t2LDRpci; Add PseudoSourceValue to load / store's to enable more machine licm. More changes coming.
llvm-svn: 85643
2009-10-31 03:39:36 +00:00
Dan Gohman
d5dbd3f588 Add a target triple so that this test behaves consistently across hosts.
llvm-svn: 85640
2009-10-31 00:15:28 +00:00
Dan Gohman
14157e31a3 Fix the -mattr line for this test so that it passes on hosts that lack SSSE3.
llvm-svn: 85637
2009-10-30 23:18:27 +00:00
Dan Gohman
cd411a597d Add a testcase for the recent duplicate PHI elimination changes.
llvm-svn: 85636
2009-10-30 23:16:10 +00:00
Chris Lattner
3982885b51 if basic blocks are destroyed while there are *just* BlockAddress' hanging
around, then zap them.  This is analogous to dangling constantexprs hanging
off functions.

llvm-svn: 85627
2009-10-30 22:39:36 +00:00
Dan Gohman
ad6c6a3d33 Fix MachineLICM to use the correct virtual register class when
unfolding loads for hoisting.  getOpcodeAfterMemoryUnfold returns the
opcode of the original operation without the load, not the load
itself, MachineLICM needs to know the operand index in order to get
the correct register class. Extend getOpcodeAfterMemoryUnfold to
return this information.

llvm-svn: 85622
2009-10-30 22:18:41 +00:00
Daniel Dunbar
45b7d65288 Add missing substitution for %llvmgcc_only.
llvm-svn: 85614
2009-10-30 21:13:59 +00:00
Evan Cheng
52d6e56ac9 I forgot to commit this test.
llvm-svn: 85608
2009-10-30 20:03:40 +00:00
Rafael Espindola
d4fadd76da This fixes functions like
void f (int a1, int a2, int a3, int a4, int a5,...)

In ARMTargetLowering::LowerFormalArguments if the function has 4 or
more regular arguments we used to set VarArgsFrameIndex using an
offset of 0, which is only correct if the function has exactly 4
regular arguments.

llvm-svn: 85590
2009-10-30 14:33:14 +00:00
Bob Wilson
f13be9d41e Reimplement BranchFolding change to avoid tail merging for a 1 instruction
common tail, except when the OptimizeForSize function attribute is present.
Radar 7338114.

llvm-svn: 85441
2009-10-28 22:10:20 +00:00
Victor Hernandez
917cf94b22 Extend getMallocArraySize() to determine the array size if the malloc argument is:
ArraySize * ElementSize
ElementSize * ArraySize
ArraySize << log2(ElementSize)
ElementSize << log2(ArraySize)

Refactor isArrayMallocHelper and delete isSafeToGetMallocArraySize, so that there is only 1 copy of the malloc array determining logic.
Update users of getMallocArraySize() to not bother calling isArrayMalloc() as well.

llvm-svn: 85421
2009-10-28 20:18:55 +00:00
Owen Anderson
cfb2c9edeb Treat lifetime begin/end markers as allocations/frees respectively for the
purposes for GVN/DSE.

llvm-svn: 85383
2009-10-28 07:05:35 +00:00
Owen Anderson
a2584a4c64 Be more careful about invariance reasoning on "store" queries. Stores still need
to depend on Ref and ModRef calls within the invariant region.

llvm-svn: 85380
2009-10-28 06:30:52 +00:00
Owen Anderson
6cf32f04df Add trivial support for the invariance intrinsics to memdep. This logic is
purely local for now.

llvm-svn: 85378
2009-10-28 06:18:42 +00:00
Chris Lattner
1efa0c450a add bitcode reader support for blockaddress. We can now fully
round trip blockaddress through .ll and .bc files, so add a testcase.

There are still a bunch of places in the optimizer and other places
that need to be updated to work with these constructs, but at least
the basics are in now.

llvm-svn: 85377
2009-10-28 05:53:48 +00:00
Dan Gohman
076a3b5e25 Teach MachineLICM to unfold loads from constant memory from
otherwise unhoistable instructions in order to allow the loads
to be hoisted.

llvm-svn: 85364
2009-10-28 03:21:57 +00:00
Evan Cheng
1babe43881 Use fconsts and fconstd to materialize small fp constants.
llvm-svn: 85362
2009-10-28 01:44:26 +00:00
Dan Gohman
00c9f3e905 Mark dead physregdefs dead immediately. This helps MachineSink and
MachineLICM and other things which run before LiveVariables is run.

llvm-svn: 85360
2009-10-28 01:13:53 +00:00
Dan Gohman
a9fb025f00 Allow constants of different types to share constant pool entries
if they have compatible encodings.

llvm-svn: 85359
2009-10-28 01:12:16 +00:00
Chris Lattner
2bc8002f4c rename indbr -> indirectbr to appease the residents of #llvm.
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Dale Johannesen
9f175bf461 Add radar number.
llvm-svn: 85290
2009-10-27 20:12:38 +00:00
Dale Johannesen
089d45f489 Testcase for llvm-gcc patch 85284.
llvm-svn: 85287
2009-10-27 20:06:05 +00:00
Chris Lattner
fdda543cea add enough support for indirect branch for the feature test to pass
(assembler,asmprinter, bc reader+writer) and document it.  Codegen
currently aborts on it.

llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Rafael Espindola
9cafe9e468 Add missing testcase.
llvm-svn: 85266
2009-10-27 17:59:03 +00:00
Chris Lattner
9ab753239b change of mind :)
llvm-svn: 85258
2009-10-27 17:40:49 +00:00
Chris Lattner
ec7abb4dd5 rename test.
llvm-svn: 85256
2009-10-27 17:40:19 +00:00
Edward O'Callaghan
142c2fc0ae Convert Analysis tests to FileCheck in regards to PR5307.
llvm-svn: 85241
2009-10-27 14:54:46 +00:00
Bob Wilson
aadcaed95f Fix Thumb2 failures by converting them to FileCheck.
llvm-svn: 85210
2009-10-27 06:31:02 +00:00
Bob Wilson
cc098c98de Fix the rest of the ARM failures by converting them to FileCheck.
llvm-svn: 85208
2009-10-27 06:16:45 +00:00
Bob Wilson
5753a34ebb Fix some more failures by converting to FileCheck.
llvm-svn: 85207
2009-10-27 05:50:28 +00:00
Chris Lattner
aecb9a4040 Fix a pretty serious misfeature of the inliner: if it inlines a function
with multiple return values it inserts a PHI to merge them all together.
However, if the return values are all the same, it ends up with a pointless
PHI and this pointless PHI happens to really block SRoA from happening in 
at least a silly C++ example written by Doug, but probably others.  This 
fixes rdar://7339069.

llvm-svn: 85206
2009-10-27 05:39:41 +00:00
Chris Lattner
4648c60623 convert to filecheck.
llvm-svn: 85205
2009-10-27 05:35:35 +00:00
Bob Wilson
37191c825b Convert to FileCheck, fixing failure due to tab change in the process.
llvm-svn: 85204
2009-10-27 05:30:47 +00:00
Edward O'Callaghan
e9e8913261 Convert a few tests to FileCheck for PR5307.
llvm-svn: 85171
2009-10-26 22:52:03 +00:00
Dan Gohman
795e3db7ce Code that checks WillNotOverflowSignedAdd before creating an Add
can safely use the NSW bit on the Add.

llvm-svn: 85164
2009-10-26 22:14:22 +00:00
Dan Gohman
c8468855a7 Teach BasicAA how to analyze Select instructions, and make it more
aggressive on PHI instructions.

llvm-svn: 85158
2009-10-26 21:55:43 +00:00
David Goodwin
f6199e95b0 Break anti-dependence breaking out into its own class.
llvm-svn: 85127
2009-10-26 16:59:04 +00:00