Manman Ren
1a5ff287fd
TBAA: remove !tbaa from testing cases if not used.
...
This will make it easier to turn on struct-path aware TBAA since the metadata
format will change.
llvm-svn: 180796
2013-04-30 17:52:57 +00:00
Dmitri Gribenko
d7beca87f5
Tests: rewrite 'opt ... %s' to 'opt ... < %s' so that opt does not emit a ModuleID
...
This is done to avoid odd test failures, like the one fixed in r171243.
My previous regex was not good enough to find these.
llvm-svn: 171343
2013-01-01 13:57:25 +00:00
Dmitri Gribenko
b137c9e551
Tests: rewrite 'opt ... %s' to 'opt ... < %s' so that opt does not emit a ModuleID
...
This is done to avoid odd test failures, like the one fixed in r171243.
llvm-svn: 171246
2012-12-30 01:28:40 +00:00
Nick Lewycky
65b1f5055d
Make this test check the transforms it's actually doing. Also add a test that it
...
doesn't transform the trivially unsafe case.
llvm-svn: 164617
2012-09-25 18:17:38 +00:00
Nick Lewycky
42bca056e0
Don't forget that strcpy and friends return a pointer to the destination, so
...
it's not a dead store if that pointer is used. Whoops!
llvm-svn: 164583
2012-09-25 01:55:59 +00:00
Nick Lewycky
9f4729d331
Teach DSE that strcpy, strncpy, strcat and strncat are all stores which may be
...
dead.
llvm-svn: 164561
2012-09-24 22:09:10 +00:00
Bob Wilson
dcc54decd5
Fix more fallout from r158919, similar to PR13547.
...
This code used to only handle malloc-like calls, which do not read memory.
r158919 changed it to check isNoAliasFn(), which includes strdup-like and
realloc-like calls, but it was not checking for dependencies on the memory
read by those calls.
llvm-svn: 163106
2012-09-03 05:15:15 +00:00
Craig Topper
2a40418a99
Change greater than to greater than or equal so that an identical sized store to the same offset is treated as completing overwriting.
...
llvm-svn: 161857
2012-08-14 07:32:05 +00:00
Eli Friedman
08ec0a8122
isAllocLikeFn is allowed to return true for functions which read memory; make
...
sure we account for that correctly in DeadStoreElimination. Fixes a regression
from r158919. PR13547.
llvm-svn: 161468
2012-08-08 02:17:32 +00:00
Dan Gohman
ed7c24e2d9
Teach DeadStoreElimination to eliminate exit-block stores with phi addresses.
...
llvm-svn: 156558
2012-05-10 18:57:38 +00:00
Nuno Lopes
300d629924
teach DSE and isInstructionTriviallyDead() about calloc
...
llvm-svn: 156553
2012-05-10 17:14:00 +00:00
Pete Cooper
39b5255df4
Reverted r152620 - DSE: Shorten memset when a later store overwrites the start of it. There were all sorts of buildbot issues
...
llvm-svn: 151621
2012-02-28 05:06:24 +00:00
Pete Cooper
f3862f91de
DSE: Shorten memset when a later store overwrites the start of it
...
llvm-svn: 151620
2012-02-28 04:27:10 +00:00
Rafael Espindola
a640db900a
Add testcase for the previous commit.
...
llvm-svn: 151475
2012-02-26 05:49:57 +00:00
Eli Bendersky
924f9a671d
Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed.
...
Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches.
llvm-svn: 150664
2012-02-16 06:28:33 +00:00
Nick Lewycky
fe970725cc
Fix infinite loop in DSE when deleting a free in a reachable loop that's also
...
trivially infinite.
llvm-svn: 146197
2011-12-08 22:36:35 +00:00
Pete Cooper
e03fe83d98
Fixed deadstoreelimination bug where negative indices were incorrectly causing the optimisation to occur
...
Turns out long long + unsigned long long is unsigned. Doh!
Fixes http://llvm.org/bugs/show_bug.cgi?id=11455
llvm-svn: 145731
2011-12-03 00:04:30 +00:00
Nick Lewycky
db408f1857
Fix typo in test.
...
llvm-svn: 144774
2011-11-16 03:56:38 +00:00
Nick Lewycky
c7f1e7993c
Merge isObjectPointerWithTrustworthySize with getPointerSize. Use it when
...
looking at the size of the pointee. Fixes PR11390!
llvm-svn: 144773
2011-11-16 03:49:48 +00:00
Pete Cooper
856977cb15
DeadStoreElimination can now trim the size of a store if the end of the store is dead.
...
Currently checks alignment and killing stores on a power of 2 boundary as this is likely
to trim the size of the earlier store without breaking large vector stores into scalar ones.
Fixes <rdar://problem/10140300>
llvm-svn: 144239
2011-11-09 23:07:35 +00:00
Nick Lewycky
f2905afe62
Do simple cross-block DSE when we encounter a free statement. Fixes PR11240.
...
llvm-svn: 143808
2011-11-05 10:48:42 +00:00
Daniel Dunbar
e6d40de414
Speculatively revert "DeadStoreElimination can now trim the size of a store if
...
the end of it is dead.", which appears to break bootstrapping LLVM.
llvm-svn: 143668
2011-11-04 00:48:26 +00:00
Pete Cooper
8a95aedb5d
DeadStoreElimination can now trim the size of a store if the end of it is dead.
...
Only currently done if the later store is writing to a power of 2 address or
has the same alignment as the earlier store as then its likely to not break up
large stores into smaller ones
Fixes <rdar://problem/10140300>
llvm-svn: 143630
2011-11-03 18:01:56 +00:00
Nick Lewycky
dd1d3df524
A dead malloc, a free(NULL) and a free(undef) are all trivially dead
...
instructions.
This doesn't introduce any optimizations we weren't doing before (except
potentially due to pass ordering issues), now passes will eliminate them sooner
as part of their own cleanups.
llvm-svn: 142787
2011-10-24 04:35:36 +00:00
Nick Lewycky
32f8051d66
A non-escaping malloc in the entry block is not unlike an alloca. Do dead-store
...
elimination on them too.
llvm-svn: 142735
2011-10-22 21:59:35 +00:00
Owen Anderson
58704ee442
Try again at r138809 (make DSE more aggressive in removing dead stores at the end of a function), now with less deleting stores before memcpy's.
...
llvm-svn: 139150
2011-09-06 18:14:09 +00:00
Owen Anderson
b359367a3d
Remove empty file.
...
llvm-svn: 138830
2011-08-30 21:17:20 +00:00
Owen Anderson
e316e5b2ad
Speculatively revert r138809 in an attempt to fix DragonEgg.
...
llvm-svn: 138829
2011-08-30 21:11:06 +00:00
Owen Anderson
d708ec4c6a
When walking backwards to eliminate final stores to allocas at the end of a function, encountering an unrelated store should not cause us to give up like encountering a load does.
...
llvm-svn: 138809
2011-08-30 18:51:55 +00:00
Eli Friedman
9a468153e1
Atomic load/store handling for the passes using memdep (GVN, DSE, memcpyopt).
...
llvm-svn: 137888
2011-08-17 22:22:24 +00:00
Eli Friedman
02e737b08e
Move "atomic" and "volatile" designations on instructions after the opcode
...
of the instruction.
Note that this change affects the existing non-atomic load and store
instructions; the parser now accepts both forms, and the change is noted
in the release notes.
llvm-svn: 137527
2011-08-12 22:50:01 +00:00
Chris Lattner
80ed9dc9e5
rip out a ton of intrinsic modernization logic from AutoUpgrade.cpp, which is
...
for pre-2.9 bitcode files. We keep x86 unaligned loads, movnt, crc32, and the
target indep prefetch change.
As usual, updating the testsuite is a PITA.
llvm-svn: 133337
2011-06-18 06:05:24 +00:00
Chris Lattner
b90ed2233c
manually upgrade a bunch of tests to modern syntax, and remove some that
...
are either unreduced or only test old syntax.
llvm-svn: 133228
2011-06-17 03:14:27 +00:00
Chris Lattner
026f5e61f0
fix a really nasty basicaa mod/ref calculation bug that was causing miscompilation of
...
UnitTests/ObjC/messages-2.m with the recent optimizer improvements.
llvm-svn: 131897
2011-05-23 05:15:43 +00:00
Bill Wendling
5034159c5f
* The DSE code that tested for overlapping needed to take into account the fact
...
that one of the numbers is signed while the other is unsigned. This could lead
to a wrong result when the signed was promoted to an unsigned int.
* Add the data layout line to the testcase so that it will test the appropriate
thing.
Patch by David Terei!
llvm-svn: 128577
2011-03-30 21:37:19 +00:00
Bill Wendling
db40b5c899
PR9561: A store with a negative offset (via GEP) could erroniously say that it
...
completely overlaps a previous store, thus mistakenly deleting that store. Check
for this condition.
llvm-svn: 128319
2011-03-26 01:20:37 +00:00
Chris Lattner
94fbdf3814
Fix PR8728, a miscompilation I recently introduced. When optimizing
...
memcpy's like:
memcpy(A, B)
memcpy(A, C)
we cannot delete the first memcpy as dead if A and C might be aliases.
If so, we actually get:
memcpy(A, B)
memcpy(A, A)
which is not correct to transform into:
memcpy(A, A)
This patch was heavily influenced by Jakub Staszak's patch in PR8728, thanks
Jakub!
llvm-svn: 120974
2010-12-06 01:48:06 +00:00
Chris Lattner
903add84d9
Enhance DSE to handle the variable index case in PR8657.
...
llvm-svn: 120498
2010-11-30 23:43:23 +00:00
Chris Lattner
c0f3379ae0
teach DSE to use GetPointerBaseWithConstantOffset to analyze
...
may-aliasing stores that partially overlap with different base
pointers. This implements PR6043 and the non-variable part of
PR8657
llvm-svn: 120485
2010-11-30 23:05:20 +00:00
Chris Lattner
b63ba73b1b
enhance isRemovable to refuse to delete volatile mem transfers
...
now that DSE hacks on them. This fixes a regression I introduced,
by generalizing DSE to hack on transfers.
llvm-svn: 120445
2010-11-30 19:12:10 +00:00
Chris Lattner
58b779e9c2
Rewrite the main DSE loop to be written in terms of reasoning
...
about pairs of AA::Location's instead of looking for MemDep's
"Def" predicate. This is more powerful and general, handling
memset/memcpy/store all uniformly, and implementing PR8701 and
probably obsoleting parts of memcpyoptimizer.
This also fixes an obscure bug with init.trampoline and i8
stores, but I'm not surprised it hasn't been hit yet. Enhancing
init.trampoline to carry the size that it stores would allow
DSE to be much more aggressive about optimizing them.
llvm-svn: 120406
2010-11-30 07:23:21 +00:00
Chris Lattner
c2e3445273
merge one more away
...
llvm-svn: 120375
2010-11-30 01:06:43 +00:00
Chris Lattner
7578d0df51
I already merged partial-overwrite.ll -> PartialStore.ll
...
Merge context-sensitive.ll -> simple.ll and upgrade it.
llvm-svn: 120374
2010-11-30 01:05:07 +00:00
Chris Lattner
43e3a98675
clean up DSE tests, removing some poorly reduced and useless old test,
...
merging more into other larger .ll files, filecheckizing along the way.
llvm-svn: 120373
2010-11-30 01:00:34 +00:00
Chris Lattner
90c4947df7
enhance basicaa to return "Mod" for a memcpy call when the
...
queried location doesn't overlap the source, and add a testcase.
llvm-svn: 120370
2010-11-30 00:43:16 +00:00
Chris Lattner
9a146372b5
Teach basicaa that memset's modref set is at worst "mod" and never
...
contains "ref".
Enhance DSE to use a modref query instead of a store-specific hack
to generalize the "ignore may-alias stores" optimization to handle
memset and memcpy.
llvm-svn: 120368
2010-11-30 00:28:45 +00:00
Chris Lattner
c3c754f750
my previous patch would cause us to start deleting some volatile
...
stores, fix and add a testcase.
llvm-svn: 120363
2010-11-30 00:12:39 +00:00
Benjamin Kramer
e6840ef4b3
Fix some broken CHECK lines.
...
llvm-svn: 120332
2010-11-29 22:34:55 +00:00
Chris Lattner
2e8793482c
fix PR8677, patch by Jakub Staszak!
...
llvm-svn: 120325
2010-11-29 21:59:31 +00:00
Chris Lattner
e48c31ce33
implement PR8576, deleting dead stores with intervening may-alias stores.
...
llvm-svn: 119927
2010-11-21 07:34:32 +00:00