summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/GVN
Commit message (Collapse)AuthorAgeFilesLines
...
* remove support for llvm.invariant.end from memdep. It is a Chris Lattner2011-04-261-36/+0
| | | | | | work-in-progress that is not progressing, and it has issues. llvm-svn: 130247
* Improve the bail-out predicate to really only kick in when phiChris Lattner2011-04-261-0/+23
| | | | | | | translation fails. We were bailing out in some cases that would cause us to miss GVN'ing some non-local cases away. llvm-svn: 130206
* Enhance MemDep: When alias analysis returns a partial alias result,Chris Lattner2011-04-261-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | return it as a clobber. This allows GVN to do smart things. Enhance GVN to be smart about the case when a small load is clobbered by a larger overlapping load. In this case, forward the value. This allows us to compile stuff like this: int test(void *P) { int tmp = *(unsigned int*)P; return tmp+*((unsigned char*)P+1); } into: _test: ## @test movl (%rdi), %ecx movzbl %ch, %eax addl %ecx, %eax ret which has one load. We already handled the case where the smaller load was from a must-aliased base pointer. llvm-svn: 130180
* Give GVN back the ability to perform simple conditional propagation on ↵Owen Anderson2010-12-211-0/+55
| | | | | | | | | conditional branch values. I still think that LVI should be handling this, but that capability is some ways off in the future, and this matters for some significant benchmarks. llvm-svn: 122378
* Preserve TBAA tags when doing load PRE.Dan Gohman2010-12-151-0/+28
| | | | llvm-svn: 121921
* Completely rework the datastructure GVN uses to represent the value number ↵Owen Anderson2010-11-181-52/+0
| | | | | | | | | | | | | | | | | | | | | | | to leader mapping. Previously, this was a tree of hashtables, and a query recursed into the table for the immediate dominator ad infinitum if the initial lookup failed. This led to really bad performance on tall, narrow CFGs. We can instead replace it with what is conceptually a multimap of value numbers to leaders (actually represented by a hashtable with a list of Value*'s as the value type), and then determine which leader from that set to use very cheaply thanks to the DFS numberings maintained by DominatorTree. Because there are typically few duplicates of a given value, this scan tends to be quite fast. Additionally, we use a custom linked list and BumpPtr allocation to avoid any unnecessary allocation in representing the value-side of the multimap. This change brings with it a 15% (!) improvement in the total running time of GVN on 403.gcc, which I think is pretty good considering that includes all the "real work" being done by MemDep as well. The one downside to this approach is that we can no longer use GVN to perform simple conditional progation, but that seems like an acceptable loss since we now have LVI and CorrelatedValuePropagation to pick up the slack. If you see conditional propagation that's not happening, please file bugs against LVI or CVP. llvm-svn: 119714
* Add support for PHI-translating sext, zext, and trunc instructions,Dan Gohman2010-11-181-0/+31
| | | | | | enabling more PRE. PR8586. llvm-svn: 119704
* Teach InstructionSimplify about phi nodes. I chose to have it simplyDuncan Sands2010-11-142-20/+19
| | | | | | | | | | offload the work to hasConstantValue rather than do something more complicated (such handling mutually recursive phis) because (1) it is not clear it is worth it; and (2) if it is worth it, maybe such logic would be better placed in hasConstantValue. Adjust some GVN tests which are now cleaned up much further (eg: all phi nodes are removed). llvm-svn: 119043
* Testcase to go along with commit 118923 ("Have GVN simplify instructionsDuncan Sands2010-11-131-0/+15
| | | | | | | | | | | | | | | as it goes"). Before -std-compile-opts only got it down to %a = tail call i32 @foo(i32 0) readnone %x = tail call i32 @foo(i32 %a) readnone %y = tail call i32 @foo(i32 %a) readnone %z = icmp eq i32 %x, %y ret i1 %z while now -basicaa -gvn alone reduce it to %a = call i32 @foo(i32 0) readnone %x = call i32 @foo(i32 %a) readnone ret i1 true llvm-svn: 119009
* Enhance GVN to do more precise alias queries for non-local memoryDan Gohman2010-11-101-0/+59
| | | | | | | | | | | | | | | references. For example, this allows gvn to eliminate the load in this example: void foo(int n, int* p, int *q) { p[0] = 0; p[1] = 1; if (n) { *q = p[0]; } } llvm-svn: 118714
* Make BasicAliasAnalysis a normal AliasAnalysis implementation whichDan Gohman2010-10-1821-23/+23
| | | | | | | | | | | | does normal initialization and normal chaining. Change the default AliasAnalysis implementation to NoAlias. Update StandardCompileOpts.h and friends to explicitly request BasicAliasAnalysis. Update tests to explicitly request -basicaa. llvm-svn: 116720
* Now that the profitable bits of EnableFullLoadPRE have been enabled by ↵Owen Anderson2010-10-011-1/+1
| | | | | | | | | default, rip out the remainder. Anyone interested in more general PRE would be better served by implementing it separately, to get real anticipation calculation, etc. llvm-svn: 115337
* We do want to allow LoadPRE to perform LICM-like transformations: we already ↵Owen Anderson2010-09-301-0/+39
| | | | | | | | | consider PHI nodes to be negligible for code size (making this transform code size neutral), and it allows us to hoist values out of loops, which is always a good thing. llvm-svn: 115205
* LoadPRE was not properly checking that the load it was PRE'ing ↵Owen Anderson2010-09-251-1/+13
| | | | | | | | | | | | | | post-dominated the block it was being hoisted to. Splitting critical edges at the merge point only addressed part of the issue; it is also possible for non-post-domination to occur when the path from the load to the merge has branches in it. Unfortunately, full anticipation analysis is time-consuming, so for now approximate it. This is strictly more conservative than real anticipation, so we will miss some cases that real PRE would allow, but we also no longer insert loads into paths where they didn't exist before. :-) This is a very slight net positive on SPEC for me (0.5% on average). Most of the benchmarks are largely unaffected, but when it pays off it pays off decently: 181.mcf improves by 4.5% on my machine. llvm-svn: 114785
* Correct bogus module triple specifications.Duncan Sands2010-08-301-1/+1
| | | | llvm-svn: 112469
* Remove arm_apcscc from the test files. It is the default and doing thisRafael Espindola2010-06-171-1/+1
| | | | | | matches what llvm-gcc and clang now produce. llvm-svn: 106221
* Fix PR7052, patch by Jakub Staszak!Chris Lattner2010-05-081-0/+63
| | | | llvm-svn: 103347
* Fix intrinsic signature in this test.Nick Lewycky2010-04-171-1/+1
| | | | llvm-svn: 101674
* Re-commit my previous SSAUpdater changes. The previous version naively triedBob Wilson2010-04-171-0/+46
| | | | | | | | | | | to determine where to place PHIs by iteratively comparing reaching definitions at each block. That was just plain wrong. This version now computes the dominator tree within the subset of the CFG where PHIs may need to be placed, and then places the PHIs in the iterated dominance frontier of each definition. The rest of the patch is mostly the same, with a few more performance improvements added in. llvm-svn: 101612
* add newlines at the end of files.Chris Lattner2010-04-072-2/+2
| | | | llvm-svn: 100705
* Revert all my SSAUpdater patches. The PHI placement algorithm is not correctBob Wilson2010-04-031-46/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (what was I thinking?) and there's also a problem with LCSSA. I'll try again later with fixes. --- Reverse-merging r100263 into '.': U lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100177 into '.': G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100148 into '.': G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100147 into '.': U include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100131 into '.': G include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100130 into '.': G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100126 into '.': G include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp --- Reverse-merging r100050 into '.': D test/Transforms/GVN/2010-03-31-RedundantPHIs.ll --- Reverse-merging r100047 into '.': G include/llvm/Transforms/Utils/SSAUpdater.h G lib/Transforms/Utils/SSAUpdater.cpp llvm-svn: 100264
* Add a redundant PHI testcase for SSAUpdater to go with svn r100047.Bob Wilson2010-03-311-0/+46
| | | | llvm-svn: 100050
* fix PR6642, GVN forwarding from memset to load of the base of the memset.Chris Lattner2010-03-251-0/+12
| | | | llvm-svn: 99488
* Remove tests that checks @llvm.dbg.stoppoint handling.Devang Patel2010-03-011-66/+0
| | | | llvm-svn: 97493
* stop using anders-aaChris Lattner2010-03-011-1/+1
| | | | llvm-svn: 97492
* Testcase for critical edge splitting with load PRE.Bob Wilson2010-02-161-0/+27
| | | | llvm-svn: 96385
* a testcase that doesn't crash GVN but could someday.Chris Lattner2010-02-111-3/+19
| | | | llvm-svn: 95851
* Check alignment of loads when deciding whether it is safe to execute themBob Wilson2010-01-301-0/+44
| | | | | | | unconditionally. Besides checking the offset, also check that the underlying object is aligned as much as the load itself. llvm-svn: 94875
* Avoid creating redundant PHIs in SSAUpdater::GetValueInMiddleOfBlock.Bob Wilson2010-01-271-2/+7
| | | | | | | This was already being done in SSAUpdater::GetValueAtEndOfBlock so I've just changed SSAUpdater to check for existing PHIs in both places. llvm-svn: 94690
* Delete useless trailing semicolons.Dan Gohman2010-01-051-1/+1
| | | | llvm-svn: 92740
* fix an overly conservative caching issue that caused memdep toChris Lattner2009-12-191-0/+32
| | | | | | | | cache a pointer as being unavailable due to phi trans in the wrong place. This would cause later queries to fail even when they didn't involve phi trans. llvm-svn: 91787
* fix inconsistent use of tabsChris Lattner2009-12-191-20/+20
| | | | llvm-svn: 91783
* Fix PR5744, a case where we were getting the pointer size instead of theChris Lattner2009-12-101-0/+16
| | | | | | | | 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
* fix hte last remaining known (by me) phi translation bug. When we reanalyzeChris Lattner2009-12-091-4/+16
| | | | | | | 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
* Add a minor optimization: if we haven't changed the operands of anChris Lattner2009-12-091-66/+0
| | | | | | | | | | 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
* fix PR5733, a case where we'd replace an add with a lexically identical Chris Lattner2009-12-091-0/+66
| | | | | | binary operator that wasn't an add. In this case, a xor. Whoops. llvm-svn: 90971
* merge crash-2.ll into crash.llChris Lattner2009-12-092-43/+43
| | | | llvm-svn: 90969
* the code in GVN that tries to forward large loads to small Chris Lattner2009-12-091-0/+54
| | | | | | | | 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
* Switch GVN and memdep to use PHITransAddr, which correctly handlesChris Lattner2009-12-091-1/+50
| | | | | | | | | | | | | | | | | | | | | | | 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
* constant fold loads from memcpy's from global constants. This is importantChris Lattner2009-12-061-0/+16
| | | | | | | because clang lowers nontrivial automatic struct/array inits to memcpy from a global array. llvm-svn: 90698
* add support for forwarding mem intrinsic values to non-local loads.Chris Lattner2009-12-061-0/+26
| | | | llvm-svn: 90697
* Handle forwarding local memsets to loads. For example, we optimize this:Chris Lattner2009-12-061-0/+37
| | | | | | | | | | | short x(short *A) { memset(A, 1, sizeof(*A)*100); return A[42]; } to 'return 257' instead of doing the load. llvm-svn: 90695
* merge two tests.Chris Lattner2009-12-062-20/+25
| | | | llvm-svn: 90691
* Small and carefully crafted testcase showing a miscompilation by GVNChris Lattner2009-12-041-0/+33
| | | | | | | 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
* Fix this crasher, and add a FIXME for a missed optimization.Owen Anderson2009-12-031-1/+0
| | | | llvm-svn: 90408
* add a failing testcase.Chris Lattner2009-12-031-0/+44
| | | | llvm-svn: 90380
* Cleanup/remove some parts of the lifetime region handling code in memdep and ↵Owen Anderson2009-12-021-2/+2
| | | | | | | | GVN, per Chris' comments. Adjust testcases to match. llvm-svn: 90304
* minimize this a bit more.Chris Lattner2009-12-011-2/+1
| | | | llvm-svn: 90216
* merge 2009-11-29-ReverseMap.ll into crash.llChris Lattner2009-12-012-33/+34
| | | | llvm-svn: 90212
* Add a testcase for the current llvm-gcc build failure.Nick Lewycky2009-11-301-0/+33
| | | | llvm-svn: 90112
OpenPOWER on IntegriCloud