Dan Gohman
fbeec7270c
Fix a thinko; isNotAlreadyContainedIn had a built-in negative, so the
...
condition was inverted when the code was converted to contains().
llvm-svn: 91295
2009-12-14 17:31:01 +00:00
Dan Gohman
416d5b7361
Remove unnecessary #includes.
...
llvm-svn: 91293
2009-12-14 17:19:06 +00:00
Dan Gohman
163fb26927
Instead of having a ScalarEvolution pointer member in BasedUser, just pass
...
the ScalarEvolution pointer into the functions which need it.
llvm-svn: 91289
2009-12-14 17:12:51 +00:00
Dan Gohman
8dbd4e3d16
Don't bother cleaning up if there's nothing to clean up.
...
llvm-svn: 91288
2009-12-14 17:10:44 +00:00
Dan Gohman
88c7e61c5b
Delete an unused variable.
...
llvm-svn: 91287
2009-12-14 17:08:09 +00:00
Dan Gohman
838f604543
LSR itself doesn't need LoopInfo.
...
llvm-svn: 91283
2009-12-14 17:02:34 +00:00
Dan Gohman
273e692952
LSR itself doesn't need DominatorTree.
...
llvm-svn: 91282
2009-12-14 16:57:08 +00:00
Dan Gohman
c3513095cf
Remove the code in LSR that manually hoists expansions out of loops;
...
SCEVExpander does this automatically.
llvm-svn: 91281
2009-12-14 16:52:55 +00:00
Dan Gohman
ec2a7c58e8
Minor code cleanups.
...
llvm-svn: 91280
2009-12-14 16:37:29 +00:00
Chris Lattner
aaa6ac10a6
revert r91184, because it causes a crash on a .bc file I just
...
sent to Bob.
llvm-svn: 91268
2009-12-14 05:11:02 +00:00
Bob Wilson
895f364ae6
Revise scalar replacement to be more flexible about handle bitcasts and GEPs.
...
While scanning through the uses of an alloca, keep track of the current offset
relative to the start of the alloca, and check memory references to see if
the offset & size correspond to a component within the alloca. This has the
nice benefit of unifying much of the code from isSafeUseOfAllocation,
isSafeElementUse, and isSafeUseOfBitCastedAllocation. The code to rewrite
the uses of a promoted alloca, after it is determined to be safe, is
reorganized in the same way.
Also, when rewriting GEP instructions, mark them as "in-bounds" since all the
indices are known to be safe.
llvm-svn: 91184
2009-12-11 23:47:40 +00:00
Eric Christopher
22889c049d
Make sure the immediate dominator isn't NULL through iterations
...
of the loop. We could get to this condition via indirect
branches.
llvm-svn: 91009
2009-12-10 00:25:41 +00:00
Chris Lattner
9ccc879006
Fix PR5744, a case where we were getting the pointer size instead of the
...
value size. This only manifested when memdep inprecisely returns clobber,
which is do to a caching issue in the PR5744 testcase. We can 'efficiently
emulate' this by using '-no-aa'
llvm-svn: 91004
2009-12-10 00:11:45 +00:00
Chris Lattner
3ddf804f78
allow this to build when the #if 0's are enabled. No functionality change.
...
llvm-svn: 90999
2009-12-10 00:04:46 +00:00
Dan Gohman
72c367fb52
Dereference loopHeader after checking for null rather than before.
...
llvm-svn: 90990
2009-12-09 22:55:01 +00:00
Chris Lattner
ca5f9cb18b
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
f8ba1253f1
change GetStoreValueForLoad to use IRBuilder, which is cleaner and
...
implicitly constant folds.
llvm-svn: 90977
2009-12-09 18:13:28 +00:00
Bob Wilson
1c5a6fb299
Fix a comment.
...
llvm-svn: 90975
2009-12-09 18:05:27 +00:00
Chris Lattner
07df9efb35
change AnalyzeLoadFromClobberingMemInst/AnalyzeLoadFromClobberingStore
...
to require the load ty/ptr to be passed in, no functionality change.
llvm-svn: 90960
2009-12-09 07:37:07 +00:00
Chris Lattner
0def861ee9
change AnalyzeLoadFromClobberingWrite and clients to pass in type
...
and pointer instead of the load. No functionality change.
llvm-svn: 90959
2009-12-09 07:34:10 +00:00
Chris Lattner
0c31547168
change NonLocalDepEntry from being a typedef for an std::pair to be its
...
own small class. No functionality change.
llvm-svn: 90956
2009-12-09 07:08:01 +00:00
Chris Lattner
946b58dd90
add some aborts to #if 0's.
...
llvm-svn: 90929
2009-12-09 02:41:54 +00:00
Chris Lattner
972e6d8d00
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
Bob Wilson
c5d082fd5d
Some superficial cleanups.
...
llvm-svn: 90866
2009-12-08 18:27:03 +00:00
Bob Wilson
2029ea04f9
Clean up dead operands left around after SROA replaces a mem intrinsic.
...
I'm not aware that this does anything significant on its own, but it's
needed for another patch that I'm working on.
llvm-svn: 90864
2009-12-08 18:22:03 +00:00
Nick Lewycky
8bca014d7f
Remove unnecessary #include "llvm/LLVMContext.h".
...
llvm-svn: 90836
2009-12-08 05:45:41 +00:00
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
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
Bob Wilson
050b812fe7
Fix up some comments.
...
llvm-svn: 90603
2009-12-04 21:57:37 +00:00
Bob Wilson
5ca37b274c
Fix 80-column violations.
...
llvm-svn: 90601
2009-12-04 21:51:35 +00:00
Bob Wilson
53bdae3802
Fix a comment typo.
...
llvm-svn: 90487
2009-12-03 21:47:07 +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
a48f44d9ee
improve portability to avoid conflicting with std::next in c++'0x.
...
Patch by Howard Hinnant!
llvm-svn: 90365
2009-12-03 00:50:42 +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
c468025ac9
factor some code better.
...
llvm-svn: 90299
2009-12-02 06:44:58 +00:00
Chris Lattner
2764b4dc55
formatting cleanups.
...
llvm-svn: 90298
2009-12-02 06:35:55 +00:00
Chris Lattner
eea42c7b51
tidy up, remove dependence on order of evaluation of function args from EmitMemCpy.
...
llvm-svn: 90297
2009-12-02 06:05:42 +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
Benjamin Kramer
3efc050ac4
Revert r90089 for now, it's breaking selfhost.
...
llvm-svn: 90097
2009-11-29 21:17:48 +00:00
Benjamin Kramer
bfa993ab20
Fix two FIXMEs.
...
llvm-svn: 90089
2009-11-29 20:29:30 +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
cd261c9c26
Implement PR5634.
...
llvm-svn: 90046
2009-11-29 00:51:17 +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
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
3d9823b9cf
factor some logic out of instcombine into a new SimplifyAddInst method.
...
llvm-svn: 90011
2009-11-27 17:42:22 +00:00