Commit Graph

54648 Commits

Author SHA1 Message Date
Tobias Grosser 8d6f6b74b1 Do not point edge heads to source labels
If no destination label is available, just point to the node itself
instead of pointing to some source label. Source and destination labels are
not related in any way.

llvm-svn: 90132
2009-11-30 12:37:39 +00:00
Tobias Grosser f444599ef0 Only print edgeSourceLabels if they are not empty
Graphviz can layout the graphs better if a node does not contain source
ports. Therefore only print the ports if the source ports are useful,
that means are not labeled with the empty string "".
This patch also simplifies graphs without any edgeSourceLabels e.g. the
dominance trees.

llvm-svn: 90131
2009-11-30 12:24:40 +00:00
Tobias Grosser f7495f497a Small PostDominatorTree improvements
* Do not SEGFAULT if tree entryNode() is NULL
 * Print function names in dotty printer

llvm-svn: 90130
2009-11-30 12:06:37 +00:00
Tobias Grosser 5f0988ceb0 Remove ":" after BB name in -view-cfg-only
llvm-svn: 90129
2009-11-30 11:55:24 +00:00
Eric Christopher 7348432ade First pass at llvm.objectsize documentation.
llvm-svn: 90116
2009-11-30 08:03:53 +00:00
Nick Lewycky 2d32947099 Revert r90107, fixing test/Transforms/GVN/2009-11-29-ReverseMap.ll and the
llvm-gcc build.

llvm-svn: 90113
2009-11-30 07:05:51 +00:00
Nick Lewycky 8a29dd4c7f Add a testcase for the current llvm-gcc build failure.
llvm-svn: 90112
2009-11-30 07:02:18 +00:00
Nick Lewycky 1c2720320b Remove the 'simple jit' tutorial as it wasn't really being maintained and its
material is covered by the Kaleidoscope tutorial.

llvm-svn: 90111
2009-11-30 04:23:17 +00:00
Mon P Wang 031cb00246 Add test case for r90108
llvm-svn: 90109
2009-11-30 02:42:27 +00:00
Mon P Wang 32f8bb9ed4 Added support to allow clients to custom widen. For X86, custom widen vectors for
divide/remainder since these operations can trap by unroll them and adding undefs
for the resulting vector.

llvm-svn: 90108
2009-11-30 02:42:02 +00:00
Chris Lattner 4d252d20e8 reapply r90093 with an addition of keeping the forward
and reverse nonlocal memdep maps in synch, this should
fix 255.vortex.

llvm-svn: 90107
2009-11-30 02:26:29 +00:00
Nick Lewycky fef0c67d01 Fix this test on 64-bit systems which seem to use i64 for gep indices sometimes
while 32-bit gcc uses i32.

llvm-svn: 90106
2009-11-30 02:23:57 +00:00
Nick Lewycky 95ef6c9560 Commit r90099 made LLVM simplify one of these constant expressions a little
more. Update the syntax we're checking for and filecheckize it too.

This will fix the selfhost buildbots but will 'break' the others (sigh) because
they're still linked against older LLVM which is emitting less optimized IR.

llvm-svn: 90104
2009-11-30 00:38:56 +00:00
Nick Lewycky e35e6f097d Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.

llvm-svn: 90099
2009-11-29 21:40:55 +00:00
Benjamin Kramer 3efc050ac4 Revert r90089 for now, it's breaking selfhost.
llvm-svn: 90097
2009-11-29 21:17:48 +00:00
Chris Lattner 0311ade94c revert this patch for now, it causes failures of:
LLVM::Transforms/GVN/2009-02-17-LoadPRECrash.ll
    LLVM::Transforms/GVN/2009-06-17-InvalidPRE.ll

llvm-svn: 90096
2009-11-29 21:14:59 +00:00
Chris Lattner 52e7715b0b Fix a really nasty caching bug I introduced in memdep. An entry
was being added to the Result vector, but not being put in the
cache.  This means that if the cache was reused wholesale for a
later query that it would be missing this entry and we'd do an
incorrect load elimination.

Unfortunately, it's not really possible to write a useful 
testcase for this, but this unbreaks 255.vortex.

llvm-svn: 90093
2009-11-29 21:09:36 +00:00
Benjamin Kramer bfa993ab20 Fix two FIXMEs.
llvm-svn: 90089
2009-11-29 20:29:30 +00:00
Nick Lewycky 0a1f25b927 Detabify.
llvm-svn: 90085
2009-11-29 18:10:39 +00:00
Benjamin Kramer 8cb52c266f Remove dead returns.
llvm-svn: 90083
2009-11-29 17:42:58 +00:00
Kovarththanan Rajaratnam 4b9f0b6720 This patch ensures that Path::GetMainExecutable is able to handle the
case where realpath() fails. When this occurs we segfault trying to
create a std::string from a NULL pointer.

Fixes PR5635.

llvm-svn: 90082
2009-11-29 17:19:48 +00:00
Daniel Dunbar 53b95c4080 Fix FileCheck crash when fuzzy scanning starting at the end of the file.
llvm-svn: 90065
2009-11-29 08:30:24 +00:00
Chris Lattner 1cc4cca193 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 6a05f2dc8e mark all the 'foo with overflow' intrinsics as readnone.
llvm-svn: 90055
2009-11-29 02:44:33 +00:00
Chris Lattner 58ccf88c36 update and consolidate the load pre notes.
llvm-svn: 90050
2009-11-29 02:19:52 +00:00
Chris Lattner 0d39613f65 add PR#
llvm-svn: 90049
2009-11-29 01:28:58 +00:00
Chris Lattner 73d45454be 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 a73adac52e 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 cd261c9c26 Implement PR5634.
llvm-svn: 90046
2009-11-29 00:51:17 +00:00
Nick Lewycky 218a3393f4 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 32140312ca 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 44da5bd837 Enhance InsertPHITranslatedPointer to be able to return a list of newly
inserted instructions.  No functionality change until someone starts using it.

llvm-svn: 90039
2009-11-28 15:39:14 +00:00
Chris Lattner c7bc66dfc6 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 d5bd369a0f enable code to handle un-phi-translatable cases more aggressively:
if we don't have an address expression available in a predecessor,
then model this as the value being clobbered at the end of the pred
block instead of being modeled as a complete phi translation failure.
This is important for PRE of loads because we want to see that the
load is available in all but this predecessor, and complete phi
translation failure results in not getting any information about
predecessors.

This doesn't do anything until I renable code insertion since PRE
now sees that it is available in all but one predecessors, but can't
insert the addressing in the predecessor that is missing it to 
eliminate the redundancy.

llvm-svn: 90037
2009-11-28 14:54:10 +00:00
Chris Lattner cf0b198827 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 2be52e72ae Rework InsertPHITranslatedPointer to handle the recursive case, this
fixes PR5630 and sets the stage for the next phase of goodness (testcase
pending).

llvm-svn: 90019
2009-11-27 22:05:15 +00:00
Chris Lattner 4ee17e1482 recursively phi translate bitcast operands too, for consistency.
llvm-svn: 90016
2009-11-27 20:25:30 +00:00
Nick Lewycky 6e0525141f Oops! Fix bug introduced in my recent cleanup change. Thanks to Tobias Grosser
for pointing this out.

llvm-svn: 90015
2009-11-27 19:57:53 +00:00
Chris Lattner d141f885a1 I accidentally implemented this :)
llvm-svn: 90014
2009-11-27 19:56:00 +00:00
Chris Lattner 2f0354ecf0 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 e66f84e012 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 3d9823b9cf factor some logic out of instcombine into a new SimplifyAddInst method.
llvm-svn: 90011
2009-11-27 17:42:22 +00:00
Chris Lattner 83a4a9868f add a deadargelim note.
llvm-svn: 90009
2009-11-27 17:12:30 +00:00
Chris Lattner ca9e0e83b3 This testcase is actually only partially redundant, and requires
the FIXME I added yesterday to be implemented.

llvm-svn: 90008
2009-11-27 16:53:57 +00:00
Chris Lattner 2226db66ab 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 92ba18e9e4 filecheckize
llvm-svn: 90006
2009-11-27 16:31:59 +00:00
Duncan Sands b56334b4f2 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
Duncan Sands 31c0e0ee35 Vector types are no longer required to have a power-of-two length.
llvm-svn: 90004
2009-11-27 13:38:03 +00:00
Duncan Sands ee7425cc56 These code generator limitations have been removed.
llvm-svn: 90003
2009-11-27 12:33:22 +00:00
Chris Lattner 6d294de548 add comment.
llvm-svn: 90002
2009-11-27 08:40:14 +00:00
Chris Lattner ac323297e0 reduce nesting, no functionality change.
llvm-svn: 90001
2009-11-27 08:37:22 +00:00
Chris Lattner 8e62d0a93d limit the recursion depth of GetLinearExpression. This
fixes a crash analyzing consumer-lame, which had an "%X = add %X, 1"
in unreachable code.

llvm-svn: 90000
2009-11-27 08:32:52 +00:00
Chris Lattner 25be93dfed 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 41a5bba4e0 add some tests for memdep phi translation + PRE.
llvm-svn: 89996
2009-11-27 06:42:42 +00:00
Chris Lattner fa76d23c1d this test is failing, and is expected to.
llvm-svn: 89995
2009-11-27 06:36:28 +00:00
Chris Lattner 4f1552bde7 filecheckize
llvm-svn: 89994
2009-11-27 06:33:09 +00:00
Chris Lattner 66426c70e6 rename test.
llvm-svn: 89993
2009-11-27 06:31:55 +00:00
Chris Lattner a9a76ccf56 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 b018bda665 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 fb8a718fc3 try again.
llvm-svn: 89990
2009-11-27 05:19:56 +00:00
Chris Lattner 14444f5c1a this is causing buildbot failures, disable for now.
llvm-svn: 89985
2009-11-27 01:52:22 +00:00
Chris Lattner cc6d29286c this (and probably several others) are now done.
llvm-svn: 89982
2009-11-27 00:35:04 +00:00
Chris Lattner 5030c6ab21 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 8574aba4ea factor some instcombine simplifications for getelementptr out to a new
SimplifyGEPInst method in InstructionSimplify.h.  No functionality change.

llvm-svn: 89980
2009-11-27 00:29:05 +00:00
Chris Lattner 4c88e814b8 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 9bd2136ca3 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 dfaa592de1 convert to filecheck
llvm-svn: 89977
2009-11-26 23:32:59 +00:00
Nick Lewycky a75fe185ba Fix typo spotted by Gabor Greif.
llvm-svn: 89976
2009-11-26 23:19:05 +00:00
Chris Lattner c49f5ac7d8 factor some code out into some helper functions.
llvm-svn: 89975
2009-11-26 23:18:49 +00:00
Nick Lewycky 898e8f756a Clean up file, no functionality change.
llvm-svn: 89974
2009-11-26 22:54:26 +00:00
Chris Lattner 0f77ac2640 Add a hack for PR5601, a crash on obsolete syntax that we plan to
remove in LLVM 3.0

llvm-svn: 89973
2009-11-26 22:48:23 +00:00
Chris Lattner a5bc618a91 fix crash on Transforms/InstCombine/intrinsics.ll introduced by r89970
llvm-svn: 89972
2009-11-26 22:08:06 +00:00
Chris Lattner a73ecf0b00 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 5b83ba215d implement a bunch of xforms for overflow intrinsics, based on a patch
by Alastair Lynn.

llvm-svn: 89970
2009-11-26 21:42:47 +00:00
Bob Wilson 9594db5693 Rename new TailDuplicationPass to avoid name conflict with the old one.
llvm-svn: 89968
2009-11-26 21:38:41 +00:00
Chris Lattner 5fe97e7aca @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 1bf7ff704a 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 d7cabea8ca fix two transposed lines duncan caught and add an explanatory comment.
llvm-svn: 89958
2009-11-26 18:35:46 +00:00
Chris Lattner 9aa846956e this todo is resolved.
llvm-svn: 89957
2009-11-26 17:14:10 +00:00
Chris Lattner 29f82a1465 move DecomposeGEPExpression out into ValueTracking.cpp
llvm-svn: 89956
2009-11-26 17:12:50 +00:00
Chris Lattner 631c5b2cb9 teach GetLinearExpression to be a bit more aggressive.
llvm-svn: 89955
2009-11-26 17:00:01 +00:00
Chris Lattner 5c1cfc252c resolve a fixme. I haven't figured out how to write a testcase
to exercise this though.

llvm-svn: 89954
2009-11-26 16:52:32 +00:00
Chris Lattner ba0014a44c 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 29bc8a91d3 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 12dacdd359 teach basicaa that A[i] != A[i+1].
llvm-svn: 89951
2009-11-26 16:18:10 +00:00
Chris Lattner 453751031a rename test
llvm-svn: 89950
2009-11-26 16:08:41 +00:00
Chris Lattner 7a5b56aca9 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 0d23076adf add a new random feature test
llvm-svn: 89921
2009-11-26 02:16:28 +00:00
Chris Lattner 5341c9679d Generalize DecomposeGEPExpression to exactly handle what Value::getUnderlyingObject does (when TD is around). This allows us to avoid calling DecomposeGEPExpression unless the ultimate alias check we care about passes, speedup up BasicAA a bit.
llvm-svn: 89920
2009-11-26 02:14:59 +00:00
Chris Lattner 8928899413 Implement a new DecomposeGEPExpression method, which decomposes a GEP into a list of scaled offsets. Use this to eliminate some previous ad-hoc code which was subtly broken (it assumed all Constant*'s were non-zero, but strange constant express could be zero).
llvm-svn: 89915
2009-11-26 02:13:03 +00:00
Chris Lattner a99edbedd1 Use GEPOperator more pervasively to simplify code.
llvm-svn: 89914
2009-11-26 02:11:08 +00:00
Chris Lattner 8e09ad6f3c update some notes slightly
llvm-svn: 89913
2009-11-26 01:51:18 +00:00
Chris Lattner 4f0b47d9e7 remove some redundant braces
llvm-svn: 89912
2009-11-26 01:50:12 +00:00
Evan Cheng a4c986cbdd Test for 89905.
llvm-svn: 89906
2009-11-26 00:35:01 +00:00
Evan Cheng 595a16300c When all defs of a vr are implicit_def, delete all of the defs.
llvm-svn: 89905
2009-11-26 00:32:36 +00:00
Bob Wilson 2d4ff12da9 Split tail duplication into a separate pass. This is needed to avoid
running tail duplication when doing branch folding for if-conversion, and
we also want to be able to run tail duplication earlier to fix some
reg alloc problems.  Move the CanFallThrough function from BranchFolding
to MachineBasicBlock so that it can be shared by TailDuplication.

llvm-svn: 89904
2009-11-26 00:32:21 +00:00
Dale Johannesen 979ac9fce4 Test for llvm-gcc checkin 89898.
llvm-svn: 89899
2009-11-25 23:50:09 +00:00
Devang Patel 4da997b936 Update to reflect recent debugging information encoding changes.
llvm-svn: 89896
2009-11-25 23:28:01 +00:00
Viktor Kutuzov 8981b3abe5 Rollback changes r89516: Added two SubtargetFeatures::AddFeatures methods, which accept a comma-separated string or already parsed command line parameters as input, and some code re-factoring to use these new methods.
llvm-svn: 89893
2009-11-25 22:44:18 +00:00
Evan Cheng 44df27e964 ProcessImplicitDefs should watch out for invalidated iterator and extra implicit operands on copies.
llvm-svn: 89880
2009-11-25 21:13:39 +00:00