Chris Lattner
bf3d03b576
fix hte last remaining known (by me) phi translation bug. When we reanalyze
...
clobbers to forward pieces of large stores to small loads, we need to consider
the properly phi translated pointer in the store block.
llvm-svn: 90978
2009-12-09 18:21:46 +00:00
Chris Lattner
2f9b661ab8
Add a minor optimization: if we haven't changed the operands of an
...
add, there is no need to scan the world to find the same add again.
This invalidates the previous testcase, which wasn't wonderful anyway,
because it needed a run of instcombine to permute the use-lists in
just the right way to before GVN was run (so it was really fragile).
Not a big loss.
llvm-svn: 90973
2009-12-09 17:27:45 +00:00
Chris Lattner
e05f9a128c
fix PR5733, a case where we'd replace an add with a lexically identical
...
binary operator that wasn't an add. In this case, a xor. Whoops.
llvm-svn: 90971
2009-12-09 17:18:49 +00:00
Chris Lattner
8361f3cfc9
merge crash-2.ll into crash.ll
...
llvm-svn: 90969
2009-12-09 17:17:26 +00:00
Chris Lattner
1f1da3a5a6
the code in GVN that tries to forward large loads to small
...
stores is not phi translating, thus it miscompiles really
crazy testcases. This is from inspection, I haven't seen
this in the wild.
llvm-svn: 90930
2009-12-09 02:43:05 +00:00
Chris Lattner
dda5ca59e2
Switch GVN and memdep to use PHITransAddr, which correctly handles
...
phi translation of complex expressions like &A[i+1]. This has the
following benefits:
1. The phi translation logic is all contained in its own class with
a strong interface and verification that it is self consistent.
2. The logic is more correct than before. Previously, if intermediate
expressions got PHI translated, we'd miss the update and scan for
the wrong pointers in predecessor blocks. @phi_trans2 is a testcase
for this.
3. We have a lot less code in memdep.
We can handle phi translation across blocks of things like @phi_trans3,
which is pretty insane :).
This patch should fix the miscompiles of 255.vortex, and I tested it
with a bootstrap of llvm-gcc, llvm-test and dejagnu of course.
llvm-svn: 90926
2009-12-09 01:59:31 +00:00
Duncan Sands
897f9579d6
Teach GlobalOpt to delete aliases with internal linkage (after
...
forwarding any uses). GlobalDCE can also do this, but is only
run at -O3.
llvm-svn: 90850
2009-12-08 10:10:20 +00:00
Chris Lattner
7066a138ff
fix PR5698
...
llvm-svn: 90708
2009-12-06 17:17:23 +00:00
Chris Lattner
ea3007ddb8
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
8885e71303
add support for forwarding mem intrinsic values to non-local loads.
...
llvm-svn: 90697
2009-12-06 04:54:31 +00:00
Chris Lattner
5eba6ee969
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
f9ff4c0fc4
merge two tests.
...
llvm-svn: 90691
2009-12-06 01:47:24 +00:00
Nick Lewycky
10693e2bb0
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
107fc93d48
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
0876163071
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
251cb28a25
Fix this crasher, and add a FIXME for a missed optimization.
...
llvm-svn: 90408
2009-12-03 03:43:29 +00:00
Chris Lattner
3bf9321d67
add a failing testcase.
...
llvm-svn: 90380
2009-12-03 01:46:18 +00:00
Chris Lattner
851aea6ce2
fix PR5673 by being more careful about pointers to functions.
...
llvm-svn: 90369
2009-12-03 01:05:45 +00:00
Owen Anderson
f47cde694f
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
2d3554c3d9
merge sext-2 into sext.ll
...
llvm-svn: 90293
2009-12-02 05:34:35 +00:00
Chris Lattner
3781027d07
rename test
...
llvm-svn: 90292
2009-12-02 05:32:33 +00:00
Chris Lattner
2c2a69cd14
filecheckize
...
llvm-svn: 90291
2009-12-02 05:32:16 +00:00
Mon P Wang
91ac05d480
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
ec294dac55
minimize this a bit more.
...
llvm-svn: 90216
2009-12-01 07:30:01 +00:00
Chris Lattner
7323159b21
merge 2009-11-29-ReverseMap.ll into crash.ll
...
llvm-svn: 90212
2009-12-01 06:22:10 +00:00
Chris Lattner
7c0c90df97
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
51b973c964
Add a testcase for the current llvm-gcc build failure.
...
llvm-svn: 90112
2009-11-30 07:02:18 +00:00
Nick Lewycky
116b145b02
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
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
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