Chris Lattner
cd79ebb23c
The phi translated pointer can be computed when returning a partially cached result
...
instead of stored. This reduces memdep memory usage, and also eliminates a bunch of
weakvh's. This speeds up gvn on gcc.c-torture/20001226-1.c from 23.9s to 8.45s (2.8x)
on a different machine than earlier.
llvm-svn: 91885
2009-12-22 04:25:02 +00:00
Chris Lattner
15c2988820
avoid calling extractMallocCall when it's obvious we don't have
...
a call. This speeds up memdep ~1.5%
llvm-svn: 91869
2009-12-22 01:00:32 +00:00
Chris Lattner
07f0e8ec8a
fix an overly conservative caching issue that caused memdep to
...
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
2009-12-19 21:29:22 +00:00
Chris Lattner
366b8ac755
enhance NonLocalDepEntry to keep the per-block phi translated address
...
of the query.
llvm-svn: 90958
2009-12-09 07:31:04 +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
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
Nick Lewycky
056fe5f97d
Fix indentation in switch statement.
...
llvm-svn: 90650
2009-12-05 06:37:24 +00:00
Benjamin Kramer
65c962b3aa
Silence compiler warnings.
...
llvm-svn: 90319
2009-12-02 15:33:44 +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
cb2e2bd645
rename some variables.
...
llvm-svn: 90258
2009-12-01 21:16:01 +00:00
Chris Lattner
9cd2498f45
tidy
...
llvm-svn: 90257
2009-12-01 21:15:15 +00:00
Chris Lattner
d576951cec
fix 255.vortex again, third time's the charm.
...
llvm-svn: 90217
2009-12-01 07:33:32 +00:00
Nick Lewycky
81fea1665b
Revert r90107, fixing test/Transforms/GVN/2009-11-29-ReverseMap.ll and the
...
llvm-gcc build.
llvm-svn: 90113
2009-11-30 07:05:51 +00:00
Chris Lattner
dd895d559f
reapply r90093 with an addition of keeping the forward
...
and reverse nonlocal memdep maps in synch, this should
fix 255.vortex.
llvm-svn: 90107
2009-11-30 02:26:29 +00:00
Chris Lattner
de1d55c200
revert this patch for now, it causes failures of:
...
LLVM::Transforms/GVN/2009-02-17-LoadPRECrash.ll
LLVM::Transforms/GVN/2009-06-17-InvalidPRE.ll
llvm-svn: 90096
2009-11-29 21:14:59 +00:00
Chris Lattner
6155ce3427
Fix a really nasty caching bug I introduced in memdep. An entry
...
was being added to the Result vector, but not being put in the
cache. This means that if the cache was reused wholesale for a
later query that it would be missing this entry and we'd do an
incorrect load elimination.
Unfortunately, it's not really possible to write a useful
testcase for this, but this unbreaks 255.vortex.
llvm-svn: 90093
2009-11-29 21:09:36 +00:00
Nick Lewycky
2c7105b098
Detabify.
...
llvm-svn: 90085
2009-11-29 18:10:39 +00:00
Nick Lewycky
ff44d9d88a
Teach memdep to look for memory use intrinsics during dependency queries. Fixes
...
PR5574.
llvm-svn: 90045
2009-11-28 21:27:49 +00:00
Chris Lattner
f8d8142a06
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
2e5340d0dc
enable code to handle un-phi-translatable cases more aggressively:
...
if we don't have an address expression available in a predecessor,
then model this as the value being clobbered at the end of the pred
block instead of being modeled as a complete phi translation failure.
This is important for PRE of loads because we want to see that the
load is available in all but this predecessor, and complete phi
translation failure results in not getting any information about
predecessors.
This doesn't do anything until I renable code insertion since PRE
now sees that it is available in all but one predecessors, but can't
insert the addressing in the predecessor that is missing it to
eliminate the redundancy.
llvm-svn: 90037
2009-11-28 14:54:10 +00:00
Chris Lattner
73b425ba51
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
473e8af336
recursively phi translate bitcast operands too, for consistency.
...
llvm-svn: 90016
2009-11-27 20:25:30 +00:00
Chris Lattner
b1fceb6006
add support for recursive phi translation and phi
...
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.
llvm-svn: 90013
2009-11-27 19:11:31 +00:00
Chris Lattner
c81be8ddba
add comment.
...
llvm-svn: 90002
2009-11-27 08:40:14 +00:00
Chris Lattner
af321b5729
reduce nesting, no functionality change.
...
llvm-svn: 90001
2009-11-27 08:37:22 +00:00
Chris Lattner
a466dbe80a
teach GVN's load PRE to insert computations of the address in predecessors
...
where it is not available. It's unclear how to get this inserted
computation into GVN's scalar availability sets, Owen, help? :)
llvm-svn: 89997
2009-11-27 08:25:10 +00:00
Chris Lattner
0971e6da1f
Fix phi translation in load PRE to agree with the phi
...
translation done by memdep, and reenable gep translation
again.
llvm-svn: 89992
2009-11-27 06:31:14 +00:00
Chris Lattner
16ee3226ce
redisable this, my bootstrap worked because it wasn't an optimized build, whoops.
...
llvm-svn: 89991
2009-11-27 05:53:01 +00:00
Chris Lattner
ea3b1f2186
try again.
...
llvm-svn: 89990
2009-11-27 05:19:56 +00:00
Chris Lattner
895214c65e
this is causing buildbot failures, disable for now.
...
llvm-svn: 89985
2009-11-27 01:52:22 +00:00
Chris Lattner
02ffb0a608
teach phi translation of GEPs to simplify geps like 'gep x, 0'.
...
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
llvm-svn: 89981
2009-11-27 00:34:38 +00:00
Chris Lattner
4810fa619f
teach memdep to do trivial PHI translation of GEPs. More to
...
come.
llvm-svn: 89979
2009-11-27 00:07:37 +00:00
Chris Lattner
4824ebfded
Teach memdep to phi translate bitcasts. This allows us to compile
...
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
llvm-svn: 89978
2009-11-26 23:41:07 +00:00
Chris Lattner
5020bb83d7
factor some code out into some helper functions.
...
llvm-svn: 89975
2009-11-26 23:18:49 +00:00
Nick Lewycky
e7829c73f2
Remove dead code. While there, also turn a few 'T* ' into 'T *' to match the
...
rest of the file.
llvm-svn: 89577
2009-11-22 02:38:11 +00:00
Owen Anderson
cfb2c9edeb
Treat lifetime begin/end markers as allocations/frees respectively for the
...
purposes for GVN/DSE.
llvm-svn: 85383
2009-10-28 07:05:35 +00:00
Owen Anderson
a2584a4c64
Be more careful about invariance reasoning on "store" queries. Stores still need
...
to depend on Ref and ModRef calls within the invariant region.
llvm-svn: 85380
2009-10-28 06:30:52 +00:00
Owen Anderson
6cf32f04df
Add trivial support for the invariance intrinsics to memdep. This logic is
...
purely local for now.
llvm-svn: 85378
2009-10-28 06:18:42 +00:00
Victor Hernandez
0f662a7acf
Rename MallocFreeHelper as MemoryBuiltins
...
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Victor Hernandez
6c86b93663
Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
...
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez
673c036bc7
Remove FreeInst.
...
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.
llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Victor Hernandez
e8998896f5
Auto-upgrade free instructions to calls to the builtin free function.
...
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.
llvm-svn: 84987
2009-10-24 04:23:03 +00:00
Victor Hernandez
8428eb5720
Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
...
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Victor Hernandez
21280bc3af
Memory dependence analysis was incorrectly stopping to scan for stores to a pointer at bitcast uses of a malloc call.
...
It should continue scanning until the malloc call, and this patch fixes that.
llvm-svn: 83931
2009-10-13 01:42:53 +00:00
Chris Lattner
de39a12610
Revert r82404, it is causing a bootstrap miscompile. This is very very
...
scary, as it indicates a lurking bug. yay.
llvm-svn: 82411
2009-09-20 22:44:26 +00:00
Chris Lattner
a9a2b9a4cc
improve memdep to eliminate bitcasts (and aliases, and noop geps)
...
early for the stated reasons: this allows it to find more
equivalences and depend less on code layout.
llvm-svn: 82404
2009-09-20 21:00:18 +00:00
Victor Hernandez
66d4042178
Enhance analysis passes so that they apply the same analysis to malloc calls as to MallocInst.
...
Reviewed by Eli Friedman.
llvm-svn: 82281
2009-09-18 21:34:51 +00:00
Dan Gohman
5e41986999
Make TargetData optional in MemoryDependenceAnalysis.
...
llvm-svn: 77727
2009-07-31 20:53:12 +00:00
Dan Gohman
9c6c4d57be
Remove an unnecessary header.
...
llvm-svn: 77725
2009-07-31 20:47:45 +00:00
Chris Lattner
11cf698cf7
factor the 'optimized sort' code out into a static helper function
...
and use it from one more place. Patch by Jakub Staszak!
llvm-svn: 75478
2009-07-13 17:20:05 +00:00