summaryrefslogtreecommitdiff
path: root/test/Transforms/GVN
Commit message (Collapse)AuthorAge
* Delete useless trailing semicolons.Dan Gohman2010-01-05
| | | | 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-19
| | | | | | | | | 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-19
| | | | 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-10
| | | | | | | | | 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-09
| | | | | | | | 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-09
| | | | | | | | | | | | 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-09
| | | | | | | 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-09
| | | | 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-09
| | | | | | | | | 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-09
| | | | | | | | | | | | | | | | | | | | | | | | | 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-06
| | | | | | | | 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-06
| | | | 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-06
| | | | | | | | | | | | | 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-06
| | | | 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-04
| | | | | | | | | 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-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90408 91177308-0d34-0410-b5e6-96231b3b80d8
* add a failing testcase.Chris Lattner2009-12-03
| | | | 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-02
| | | | | | | | | 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-01
| | | | 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-01
| | | | 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-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90112 91177308-0d34-0410-b5e6-96231b3b80d8
* add PR#Chris Lattner2009-11-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90049 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a testcase for:Chris Lattner2009-11-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-29
| | | | | | | | | | | | 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
* reenable load address insertion in load pre. This allows us toChris Lattner2009-11-28
| | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90041 91177308-0d34-0410-b5e6-96231b3b80d8
* disable value insertion for now, I need to figure out howChris Lattner2009-11-27
| | | | | | | | to inform GVN about the newly inserted values. This fixes PR5631. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90022 91177308-0d34-0410-b5e6-96231b3b80d8
* I accidentally implemented this :)Chris Lattner2009-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90014 91177308-0d34-0410-b5e6-96231b3b80d8
* add support for recursive phi translation and phi Chris Lattner2009-11-27
| | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90013 91177308-0d34-0410-b5e6-96231b3b80d8
* add two simple test cases we now optimize (to one load in the loop each) and ↵Chris Lattner2009-11-27
| | | | | | one we don't (corresponding to the fixme I added yesterday). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90012 91177308-0d34-0410-b5e6-96231b3b80d8
* teach GVN's load PRE to insert computations of the address in predecessorsChris Lattner2009-11-27
| | | | | | | | where it is not available. It's unclear how to get this inserted computation into GVN's scalar availability sets, Owen, help? :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89997 91177308-0d34-0410-b5e6-96231b3b80d8
* add some tests for memdep phi translation + PRE.Chris Lattner2009-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89996 91177308-0d34-0410-b5e6-96231b3b80d8
* this test is failing, and is expected to.Chris Lattner2009-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89995 91177308-0d34-0410-b5e6-96231b3b80d8
* filecheckizeChris Lattner2009-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89994 91177308-0d34-0410-b5e6-96231b3b80d8
* rename test.Chris Lattner2009-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89993 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix phi translation in load PRE to agree with the phi Chris Lattner2009-11-27
| | | | | | | | translation done by memdep, and reenable gep translation again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89992 91177308-0d34-0410-b5e6-96231b3b80d8
* redisable this, my bootstrap worked because it wasn't an optimized build, ↵Chris Lattner2009-11-27
| | | | | | whoops. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89991 91177308-0d34-0410-b5e6-96231b3b80d8
* try again.Chris Lattner2009-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89990 91177308-0d34-0410-b5e6-96231b3b80d8
* this is causing buildbot failures, disable for now.Chris Lattner2009-11-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89985 91177308-0d34-0410-b5e6-96231b3b80d8
* teach phi translation of GEPs to simplify geps like 'gep x, 0'.Chris Lattner2009-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to compile the example from PR5313 into: LBB1_2: ## %bb incl %ecx movb %al, (%rsi) movslq %ecx, %rax movb (%rdi,%rax), %al testb %al, %al jne LBB1_2 instead of: LBB1_2: ## %bb movslq %eax, %rcx incl %eax movb (%rdi,%rcx), %cl movb %cl, (%rsi) movslq %eax, %rcx cmpb $0, (%rdi,%rcx) jne LBB1_2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89981 91177308-0d34-0410-b5e6-96231b3b80d8
* teach memdep to do trivial PHI translation of GEPs. More toChris Lattner2009-11-27
| | | | | | | come. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89979 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach memdep to phi translate bitcasts. This allows us to compileChris Lattner2009-11-26
| | | | | | | | | | | | | | | | | | | | | | | | | the example in GCC PR16799 to: LBB1_2: ## %bb1 movl %eax, %eax subq %rax, %rdi movq %rdi, (%rcx) movl (%rdi), %eax testl %eax, %eax je LBB1_2 instead of: LBB1_2: ## %bb1 movl (%rdi), %ecx subq %rcx, %rdi movq %rdi, (%rax) cmpl $0, (%rdi) je LBB1_2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89978 91177308-0d34-0410-b5e6-96231b3b80d8
* convert to filecheckChris Lattner2009-11-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89977 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to work around grep's "Binary file (standard input) matches" complaints seenBenjamin Kramer2009-11-20
| | | | | | | on ppc buildbot. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89452 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend CaptureTracking to indicate when a value is never stored, evenDan Gohman2009-11-19
| | | | | | | | | if it is not ultimately captured. Teach BasicAliasAnalysis that a local object address which does not escape and is never stored does not alias with a value resulting from a load. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89398 91177308-0d34-0410-b5e6-96231b3b80d8
* Default-addressspace null pointers don't alias anything. This allowsDan Gohman2009-11-09
| | | | | | | GVN to be more aggressive. Patch by Hans Wennborg! (with a comment added by me) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86582 91177308-0d34-0410-b5e6-96231b3b80d8
* Treat lifetime begin/end markers as allocations/frees respectively for theOwen Anderson2009-10-28
| | | | | | | purposes for GVN/DSE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85383 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more careful about invariance reasoning on "store" queries. Stores still ↵Owen Anderson2009-10-28
| | | | | | | | | need to depend on Ref and ModRef calls within the invariant region. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85380 91177308-0d34-0410-b5e6-96231b3b80d8
* Add trivial support for the invariance intrinsics to memdep. This logic isOwen Anderson2009-10-28
| | | | | | | purely local for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85378 91177308-0d34-0410-b5e6-96231b3b80d8
* Check that GVN performs this transform even if the callsDuncan Sands2009-10-16
| | | | | | | | themselves are not marked readonly, but only the called functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84253 91177308-0d34-0410-b5e6-96231b3b80d8
* Memory dependence analysis was incorrectly stopping to scan for stores to a ↵Victor Hernandez2009-10-13
| | | | | | | | | | pointer at bitcast uses of a malloc call. It should continue scanning until the malloc call, and this patch fixes that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83931 91177308-0d34-0410-b5e6-96231b3b80d8