aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/GVN
Commit message (Collapse)AuthorAgeFilesLines
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122378 91177308-0d34-0410-b5e6-96231b3b80d8
* Preserve TBAA tags when doing load PRE.Dan Gohman2010-12-151-0/+28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121921 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119714 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for PHI-translating sext, zext, and trunc instructions,Dan Gohman2010-11-181-0/+31
| | | | | | | enabling more PRE. PR8586. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119704 91177308-0d34-0410-b5e6-96231b3b80d8
* 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). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119043 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119009 91177308-0d34-0410-b5e6-96231b3b80d8
* 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]; } } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118714 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116720 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115337 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115205 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114785 91177308-0d34-0410-b5e6-96231b3b80d8
* Correct bogus module triple specifications.Duncan Sands2010-08-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112469 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106221 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR7052, patch by Jakub Staszak!Chris Lattner2010-05-081-0/+63
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103347 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix intrinsic signature in this test.Nick Lewycky2010-04-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101674 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101612 91177308-0d34-0410-b5e6-96231b3b80d8
* add newlines at the end of files.Chris Lattner2010-04-072-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100705 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100264 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a redundant PHI testcase for SSAUpdater to go with svn r100047.Bob Wilson2010-03-311-0/+46
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100050 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR6642, GVN forwarding from memset to load of the base of the memset.Chris Lattner2010-03-251-0/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99488 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tests that checks @llvm.dbg.stoppoint handling.Devang Patel2010-03-011-66/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97493 91177308-0d34-0410-b5e6-96231b3b80d8
* stop using anders-aaChris Lattner2010-03-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97492 91177308-0d34-0410-b5e6-96231b3b80d8
* Testcase for critical edge splitting with load PRE.Bob Wilson2010-02-161-0/+27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96385 91177308-0d34-0410-b5e6-96231b3b80d8
* a testcase that doesn't crash GVN but could someday.Chris Lattner2010-02-111-3/+19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95851 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94875 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94690 91177308-0d34-0410-b5e6-96231b3b80d8
* Delete useless trailing semicolons.Dan Gohman2010-01-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92740 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91787 91177308-0d34-0410-b5e6-96231b3b80d8
* fix inconsistent use of tabsChris Lattner2009-12-191-20/+20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91783 91177308-0d34-0410-b5e6-96231b3b80d8
* 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' git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91004 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90978 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90973 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90971 91177308-0d34-0410-b5e6-96231b3b80d8
* merge crash-2.ll into crash.llChris Lattner2009-12-092-43/+43
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90969 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90930 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90926 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90698 91177308-0d34-0410-b5e6-96231b3b80d8
* add support for forwarding mem intrinsic values to non-local loads.Chris Lattner2009-12-061-0/+26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90697 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90695 91177308-0d34-0410-b5e6-96231b3b80d8
* merge two tests.Chris Lattner2009-12-062-20/+25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90691 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90520 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix this crasher, and add a FIXME for a missed optimization.Owen Anderson2009-12-031-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90408 91177308-0d34-0410-b5e6-96231b3b80d8
* add a failing testcase.Chris Lattner2009-12-031-0/+44
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90380 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90304 91177308-0d34-0410-b5e6-96231b3b80d8
* minimize this a bit more.Chris Lattner2009-12-011-2/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90216 91177308-0d34-0410-b5e6-96231b3b80d8
* merge 2009-11-29-ReverseMap.ll into crash.llChris Lattner2009-12-012-33/+34
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90212 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a testcase for the current llvm-gcc build failure.Nick Lewycky2009-11-301-0/+33
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90112 91177308-0d34-0410-b5e6-96231b3b80d8
* add PR#Chris Lattner2009-11-291-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90049 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a testcase for:Chris Lattner2009-11-291-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90048 91177308-0d34-0410-b5e6-96231b3b80d8
* add a testcase forChris Lattner2009-11-291-0/+45
| | | | | | | | | | | | void test9(int N, double* G) { long j; for (j = 1; j < N - 1; j++) G[j+1] = G[j] + G[j+1]; } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90047 91177308-0d34-0410-b5e6-96231b3b80d8