1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

6062 Commits

Author SHA1 Message Date
Bob Wilson
8505aa648d Reapply 91184 with fixes and an addition to the testcase to cover the problem
found last time.  Instead of trying to modify the IR while iterating over it,
I've change it to keep a list of WeakVH references to dead instructions, and
then delete those instructions later.  I also added some special case code to
detect and handle the situation when both operands of a memcpy intrinsic are
referencing the same alloca.

llvm-svn: 91459
2009-12-15 22:00:51 +00:00
Chris Lattner
fa960751b1 optimize strstr, PR5783
llvm-svn: 91438
2009-12-15 19:14:40 +00:00
Dan Gohman
a1003e40f7 Delete an unused function.
llvm-svn: 91432
2009-12-15 16:30:09 +00:00
Chris Lattner
284fe3f14c add some other xforms that should be done as part of PR5783
llvm-svn: 91428
2009-12-15 09:05:13 +00:00
Chris Lattner
587962c667 Remove isPod() from DenseMapInfo, splitting it out to its own
isPodLike type trait.  This is a generally useful type trait for
more than just DenseMap, and we really care about whether something
acts like a pod, not whether it really is a pod.

llvm-svn: 91421
2009-12-15 07:26:43 +00:00
Dan Gohman
abb2ea84d9 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
ea5d4d2354 Remove unnecessary #includes.
llvm-svn: 91293
2009-12-14 17:19:06 +00:00
Dan Gohman
5066c25e62 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
b001599b67 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
178e26adbf Delete an unused variable.
llvm-svn: 91287
2009-12-14 17:08:09 +00:00
Dan Gohman
44a2a502f2 LSR itself doesn't need LoopInfo.
llvm-svn: 91283
2009-12-14 17:02:34 +00:00
Dan Gohman
449298eb08 LSR itself doesn't need DominatorTree.
llvm-svn: 91282
2009-12-14 16:57:08 +00:00
Dan Gohman
bf3406f85f 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
0a0423c492 Minor code cleanups.
llvm-svn: 91280
2009-12-14 16:37:29 +00:00
Chris Lattner
6603d21f13 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
Chandler Carruth
f5a2d328af Don't leave pointers uninitialized in the default constructor. GCC complains
about the potential use of these uninitialized members under certain conditions.

llvm-svn: 91239
2009-12-13 07:04:45 +00:00
Bob Wilson
8486cae4ce 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
70ca0b3d58 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
ffedf37584 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
af8114cef6 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
3ae2ed72a7 Dereference loopHeader after checking for null rather than before.
llvm-svn: 90990
2009-12-09 22:55:01 +00:00
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
a97922837e 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
9e68616e49 Fix a comment.
llvm-svn: 90975
2009-12-09 18:05:27 +00:00
Chris Lattner
db0baa713d 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
b3587059c8 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
e0207b46d2 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
4645bb977a add some aborts to #if 0's.
llvm-svn: 90929
2009-12-09 02:41:54 +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
Bob Wilson
04cc375a1a Some superficial cleanups.
llvm-svn: 90866
2009-12-08 18:27:03 +00:00
Bob Wilson
d673b32280 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
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
Nick Lewycky
5a00cea348 Remove unnecessary #include "llvm/LLVMContext.h".
llvm-svn: 90836
2009-12-08 05:45:41 +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
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
Bob Wilson
8c1617ed73 Fix up some comments.
llvm-svn: 90603
2009-12-04 21:57:37 +00:00
Bob Wilson
514e0d319a Fix 80-column violations.
llvm-svn: 90601
2009-12-04 21:51:35 +00:00
Chris Lattner
422a3ff7d5 add an assert to make it really clear what this is doing. Return singularval as
a compile time perf optimization to avoid a load.

llvm-svn: 90507
2009-12-04 01:03:32 +00:00
Bob Wilson
c717c5e7ae Fix a comment typo.
llvm-svn: 90487
2009-12-03 21:47:07 +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
9ce833945e 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
Jim Grosbach
ccb304105a Move EliminateDuplicatePHINodes() from SimplifyCFG.cpp to Local.cpp
llvm-svn: 90324
2009-12-02 17:06:45 +00:00
Andreas Neustifter
e70972f8d5 Cheap, mostly strict, stable sorting.
This is necessary for tests so the results are comparable.

llvm-svn: 90320
2009-12-02 15:57:15 +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
b541c63e60 factor some code better.
llvm-svn: 90299
2009-12-02 06:44:58 +00:00
Chris Lattner
90aff65316 formatting cleanups.
llvm-svn: 90298
2009-12-02 06:35:55 +00:00
Chris Lattner
cb2c4e9f42 tidy up, remove dependence on order of evaluation of function args from EmitMemCpy.
llvm-svn: 90297
2009-12-02 06:05:42 +00:00