Chris Lattner
6d6f10fe91
fix PR5698
...
llvm-svn: 90708
2009-12-06 17:17:23 +00:00
Chris Lattner
778cb92235
constant fold loads from memcpy's from global constants. This is important
...
because clang lowers nontrivial automatic struct/array inits to memcpy from
a global array.
llvm-svn: 90698
2009-12-06 05:29:56 +00:00
Chris Lattner
93236ba327
add support for forwarding mem intrinsic values to non-local loads.
...
llvm-svn: 90697
2009-12-06 04:54:31 +00:00
Chris Lattner
42376066eb
Handle forwarding local memsets to loads. For example, we optimize this:
...
short x(short *A) {
memset(A, 1, sizeof(*A)*100);
return A[42];
}
to 'return 257' instead of doing the load.
llvm-svn: 90695
2009-12-06 01:57:02 +00:00
Chris Lattner
eb5bb1bf78
merge two tests.
...
llvm-svn: 90691
2009-12-06 01:47:24 +00:00
Nick Lewycky
a0e9d700dc
Generalize this optimization to work on equality comparisons between any two
...
integers that are constant except for a single bit (the same n-th bit in each).
llvm-svn: 90646
2009-12-05 05:00:00 +00:00
Chris Lattner
1ddfd9f96c
Fix PR5551 by not ignoring the top level constantexpr when
...
folding a load from constant.
llvm-svn: 90545
2009-12-04 06:29:29 +00:00
Chris Lattner
1c21aaca06
Small and carefully crafted testcase showing a miscompilation by GVN
...
that I'm working on. This is manifesting as a miscompile of 255.vortex
on some targets. No check lines yet because it fails.
llvm-svn: 90520
2009-12-04 02:12:12 +00:00
Owen Anderson
0b6e260066
Fix this crasher, and add a FIXME for a missed optimization.
...
llvm-svn: 90408
2009-12-03 03:43:29 +00:00
Chris Lattner
65812b58f2
add a failing testcase.
...
llvm-svn: 90380
2009-12-03 01:46:18 +00:00
Chris Lattner
77c36d68f3
fix PR5673 by being more careful about pointers to functions.
...
llvm-svn: 90369
2009-12-03 01:05:45 +00:00
Owen Anderson
b9878ee6b6
Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
...
per Chris' comments. Adjust testcases to match.
llvm-svn: 90304
2009-12-02 07:35:19 +00:00
Chris Lattner
4ca1981e82
merge sext-2 into sext.ll
...
llvm-svn: 90293
2009-12-02 05:34:35 +00:00
Chris Lattner
0a12a8f9fe
rename test
...
llvm-svn: 90292
2009-12-02 05:32:33 +00:00
Chris Lattner
fe206d2a13
filecheckize
...
llvm-svn: 90291
2009-12-02 05:32:16 +00:00
Mon P Wang
bb3eac9e7a
Fixed an assertion failure for tracking sext of a vector of integers
...
llvm-svn: 90290
2009-12-02 04:59:58 +00:00
Chris Lattner
367b5eafb7
minimize this a bit more.
...
llvm-svn: 90216
2009-12-01 07:30:01 +00:00
Chris Lattner
fd75b90d81
merge 2009-11-29-ReverseMap.ll into crash.ll
...
llvm-svn: 90212
2009-12-01 06:22:10 +00:00
Chris Lattner
3c9aca9079
fix PR5640 by tracking whether a block is the header of a loop more
...
precisely, which prevents us from infinitely peeling the loop.
llvm-svn: 90211
2009-12-01 06:04:43 +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
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
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
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
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
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
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
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
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
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
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
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
Edward O'Callaghan
2b8fed15e0
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