Commit Graph

1957 Commits

Author SHA1 Message Date
Nick Lewycky e88d388fb9 Fix whitespace in comment.
Remove TODO; icmp isn't a binary operator, so this function will never deal
with them.

llvm-svn: 61020
2008-12-15 01:35:36 +00:00
Torok Edwin 040688f1b2 Fix getFieldAs() to use the parameter instead of 6.
Add missing DIType constructor, needed by DIVariable::getType().

llvm-svn: 60976
2008-12-13 08:25:29 +00:00
Nick Lewycky 729bf137a8 Revert my re-instated reverted commit, fixes the bootstrap build on x86-64 linux.
llvm-svn: 60951
2008-12-12 17:09:07 +00:00
Nick Lewycky 6a344e097c Sneaky, sneaky: move the -1 to the outside of the SMax. Reinstate the
optimization of SGE/SLE with unit stride, now that it works properly.

llvm-svn: 60881
2008-12-11 17:40:14 +00:00
Duncan Sands c52b616ccf Don't dereference the end() iterator. This was
causing a bunch of failures when running
"make ENABLE_EXPENSIVE_CHECKS=1 check".

llvm-svn: 60832
2008-12-10 09:38:36 +00:00
Chris Lattner 2e84a548d6 Allow basicaa to walk through geps with identical indices in
parallel, allowing it to decide that P/Q must alias if A/B
must alias in things like:
 P = gep A, 0, i, 1
 Q = gep B, 0, i, 1

This allows GVN to delete 62 more instructions out of 403.gcc.

llvm-svn: 60820
2008-12-10 01:04:47 +00:00
Chris Lattner 0318b56f0e loosen up an assertion that isn't valid when called from
invalidateCachedPointerInfo.  Thanks to Bill for sending me
a testcase.

llvm-svn: 60805
2008-12-09 22:45:32 +00:00
Chris Lattner fa9f99aa12 Teach GVN to invalidate some memdep information when it does an RAUW
of a pointer.  This allows is to catch more equivalencies.  For example,
the type_lists_compatible_p function used to require two iterations of
the gvn pass (!) to delete its 18 redundant loads because the first pass
would CSE all the addressing computation cruft, which would unblock the
second memdep/gvn passes from recognizing them.  This change allows
memdep/gvn to catch all 18 when run just once on the function (as is 
typical :) instead of just 3.

On all of 403.gcc, this bumps up the # reundandancies found from:

     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted
to:
     63 gvn    - Number of instructions PRE'd
 154137 gvn    - Number of instructions deleted
  50185 gvn    - Number of loads deleted

+120 loads deleted isn't bad.

llvm-svn: 60799
2008-12-09 22:06:23 +00:00
Chris Lattner 702e46ed54 Teach BasicAA::getModRefInfo(CallSite, CallSite) some
tricks based on readnone/readonly functions.

Teach memdep to look past readonly calls when analyzing
deps for a readonly call.  This allows elimination of a
few more calls from 403.gcc:

before:
     63 gvn    - Number of instructions PRE'd
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

after:
     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

5 calls isn't much, but this adds plumbing for the next change.

llvm-svn: 60794
2008-12-09 21:19:42 +00:00
Chris Lattner 41efb68c44 Fix a fixme: allow memdep to see past read-only calls when doing
load dependence queries.  This allows GVN to eliminate a few more
instructions on 403.gcc:

 152598 gvn    - Number of instructions deleted
  49240 gvn    - Number of loads deleted
after:
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

llvm-svn: 60786
2008-12-09 19:47:40 +00:00
Chris Lattner 254314e6bc rename getNonLocalDependency -> getNonLocalCallDependency, and remove
pointer stuff from it, simplifying the code a bit.

llvm-svn: 60783
2008-12-09 19:38:05 +00:00
Evan Cheng 8f81e4e31b Back out 60748 for now. It's breaking SPASS, 254.gap, and 464.h264ref.
llvm-svn: 60776
2008-12-09 18:21:49 +00:00
Chris Lattner 4f10733cf3 fix typos gabor noticed
llvm-svn: 60754
2008-12-09 08:38:36 +00:00
Chris Lattner 75510d8d5c restructure the top level non-local ptr dep query to handle
the first block of a query specially.  This makes the "complete query
caching" subsystem more effective, avoiding predecessor queries.  This
speeds up GVN another 4%.

llvm-svn: 60752
2008-12-09 07:52:59 +00:00
Chris Lattner f903fe1df0 rename getNonLocalPointerDepInternal -> getNonLocalPointerDepFromBB
and split its inner loop out into a new GetNonLocalInfoForBlock
function.  No functionality change.

llvm-svn: 60751
2008-12-09 07:47:11 +00:00
Nick Lewycky f545749f2b It's easy to handle SLE/SGE when the loop has a unit stride.
llvm-svn: 60748
2008-12-09 07:25:04 +00:00
Chris Lattner aeaec0838b if we have two elements, insert both, don't use std::sort.
This speeds up the new GVN by another 3%

llvm-svn: 60747
2008-12-09 07:05:45 +00:00
Chris Lattner 4d1281cdf2 If we're only adding one new element to 'Cache', insert it into its known
position instead of using a full sort. This speeds up GVN by ~4% with the
new memdep stuff.

llvm-svn: 60746
2008-12-09 06:58:04 +00:00
Chris Lattner e8113a70fa convert a couple other places that use pred_iterator to use the caching
pred iterator.

llvm-svn: 60745
2008-12-09 06:44:17 +00:00
Chris Lattner 768e5bcafc use hte new pred cache to speed up the new non-local memdep
queries.  This speeds up GVN using the new queries (not yet
checked in) by just over 10%.

llvm-svn: 60743
2008-12-09 06:28:49 +00:00
Duncan Sands 714ffa36d3 Fix comment typo.
llvm-svn: 60697
2008-12-08 14:01:59 +00:00
Chris Lattner 5ed409edfa add another level of caching for non-local pointer queries, keeping
track of whether the CachedNonLocalPointerInfo for a block is specific
to a block.  If so, just return it without any pred scanning.  This is
good for a 6% speedup on GVN (when it uses this lookup method, which
it doesn't right now).

llvm-svn: 60695
2008-12-08 07:31:50 +00:00
Chris Lattner 2f9d8458c8 Some minor optimizations for isObjectSmallerThan.
llvm-svn: 60687
2008-12-08 06:28:54 +00:00
Chris Lattner fdb8843133 add an assert. the cast<> below would catch this but a message is more
useful.

llvm-svn: 60674
2008-12-07 18:45:15 +00:00
Chris Lattner 82b7034753 factor some code better.
llvm-svn: 60673
2008-12-07 18:42:51 +00:00
Chris Lattner de4440c24b factor some code, fixing some fixme's.
llvm-svn: 60672
2008-12-07 18:39:13 +00:00
Chris Lattner a28355de14 add support for caching pointer dependence queries. Nothing uses this yet
so it "can't" break anything.  That said, it does appear to work.

llvm-svn: 60654
2008-12-07 08:50:20 +00:00
Chris Lattner 7564a3b81b Some internal refactoring to make it easier to cache results.
llvm-svn: 60650
2008-12-07 02:56:57 +00:00
Chris Lattner 2faa2c724a Introduce a new MemDep::getNonLocalPointerDependency
method.  This will eventually take over load/store dep
queries from getNonLocalDependency.  For now it works
fine, but is incredibly slow because it does no caching.
Lets not switch GVN to use it until that is fixed :)

llvm-svn: 60649
2008-12-07 02:15:47 +00:00
Chris Lattner 5a78604e39 push the "pointer case" up the analysis stack a bit. This causes
duplication of logic (in 2 places) to determine what pointer a 
load/store touches.  This will be addressed in a future commit.

llvm-svn: 60648
2008-12-07 01:50:16 +00:00
Chris Lattner ed494f791e make clients have to know how to call getCallSiteDependencyFrom
instead of making getDependencyFrom do it.

llvm-svn: 60647
2008-12-07 01:21:14 +00:00
Chris Lattner ccb9c3370a rename some variables for consistency
llvm-svn: 60644
2008-12-07 00:39:19 +00:00
Chris Lattner e2069a6949 I love how using out of scope variables is not an error with GCC, no really I do.
llvm-svn: 60643
2008-12-07 00:38:27 +00:00
Chris Lattner 056c090c67 Rename getCallSiteDependency -> getCallSiteDependencyFrom to
emphasize the scanning and make it more similar to 
getDependencyFrom
 

llvm-svn: 60642
2008-12-07 00:35:51 +00:00
Chris Lattner d4d9588abc a memdep query on a volatile load/store will always return
clobber with the current implementation.  Instead of returning
a "precise clobber" just return a fuzzy one.  This doesn't 
matter to any clients anyway and should speed up analysis time
very very slightly.

llvm-svn: 60641
2008-12-07 00:28:02 +00:00
Chris Lattner f5891941b4 remove the ability to get memdep info for vaarg. I don't think the
original impl was correct and noone actually makes the query anyway.

llvm-svn: 60639
2008-12-07 00:21:18 +00:00
Nick Lewycky 1f6a7b5002 Minor cleanup. Use dyn_cast, not isa/cast pairs. No functionality change.
llvm-svn: 60623
2008-12-06 17:57:05 +00:00
Chris Lattner 0e3d6337c6 Make a few major changes to memdep and its clients:
1. Merge the 'None' result into 'Normal', making loads
   and stores return their dependencies on allocations as Normal.
2. Split the 'Normal' result into 'Clobber' and 'Def' to
   distinguish between the cases when memdep knows the value is
   produced from when we just know if may be changed.
3. Move some of the logic for determining whether readonly calls
   are CSEs into memdep instead of it being in GVN.  This still
   leaves verification that the arguments are hte same to GVN to
   let it know about value equivalences in different contexts.
4. Change memdep's call/call dependency analysis to use 
   getModRefInfo(CallSite,CallSite) instead of doing something 
   very weak.  This only really matters for things like DSA, but
   someday maybe we'll have some other decent context sensitive
   analyses :)
5. This reimplements the guts of memdep to handle the new results.
6. This simplifies GVN significantly:
   a) readonly call CSE is slightly simpler
   b) I eliminated the "getDependencyFrom" chaining for load 
      elimination and load CSE doesn't have to worry about 
      volatile (they are always clobbers) anymore.
   c) GVN no longer does any 'lastLoad' caching, leaving it to 
      memdep.
7. The logic in DSE is simplified a bit and sped up.  A potentially
   unsafe case was eliminated.

llvm-svn: 60607
2008-12-05 21:04:20 +00:00
Chris Lattner eda6432beb Make it illegal to call getDependency* on non-memory instructions
like binary operators.

llvm-svn: 60600
2008-12-05 18:46:19 +00:00
Dale Johannesen 941c37c2f6 Make the debugging dump be a full line.
llvm-svn: 60509
2008-12-03 22:45:31 +00:00
Nick Lewycky 4d9966dd2d Add a new SCEV representing signed division.
llvm-svn: 60407
2008-12-02 08:05:48 +00:00
Chris Lattner 7e61dafc95 Reimplement the non-local dependency data structure in terms of a sorted
vector instead of a densemap.  This shrinks the memory usage of this thing
substantially (the high water mark) as well as making operations like
scanning it faster.  This speeds up memdep slightly, gvn goes from
3.9376 to 3.9118s on 403.gcc

This also splits out the statistics for the cached non-local case to
differentiate between the dirty and clean cached case.  Here's the stats
for 403.gcc:

  6153 memdep - Number of dirty cached non-local responses
169336 memdep - Number of fully cached non-local responses
162428 memdep - Number of uncached non-local responses

yay for caching :)

llvm-svn: 60313
2008-12-01 01:15:42 +00:00
Chris Lattner 47e81d0e90 Eliminate the DepResultTy abstraction. It is now completely
redundant with MemDepResult, and MemDepResult has a nicer interface.

llvm-svn: 60308
2008-11-30 23:17:19 +00:00
Chris Lattner 13cae612b9 Cache TargetData/AliasAnalysis in the pass instead of calling
getAnalysis<>.  getAnalysis<> is apparently extremely expensive.
Doing this speeds up GVN on 403.gcc by 16%!

llvm-svn: 60304
2008-11-30 19:24:31 +00:00
Chris Lattner 441042796d Two changes: Make getDependency remove QueryInst for a dirty record's
ReverseLocalDeps when we update it.  This fixes a regression test
failure from my last commit.

Second, for each non-local cached information structure, keep a bit that
indicates whether it is dirty or not.  This saves us a scan over the whole
thing in the common case when it isn't dirty.

llvm-svn: 60274
2008-11-30 02:52:26 +00:00
Chris Lattner fc678e2af5 introduce a typedef, no functionality change.
llvm-svn: 60272
2008-11-30 02:30:50 +00:00
Chris Lattner 1b810bd5e6 Change NonLocalDeps to be a densemap of pointers to densemap
instead of containing them by value.  This increases the density
(!) of NonLocalDeps as well as making the reallocation case 
faster.  This speeds up gvn on 403.gcc by 2% and makes room for
future improvements.

I'm not super thrilled with having to explicitly manage the new/delete
of the map, but it is necesary for the next change.

llvm-svn: 60271
2008-11-30 02:28:25 +00:00
Chris Lattner ff862c4e88 calls never depend on allocations.
llvm-svn: 60268
2008-11-30 01:44:00 +00:00
Chris Lattner 3ff6d01586 Fix a fixme by making memdep's handling of allocations more logical.
If we see that a load depends on the allocation of its memory with no
intervening stores, we now return a 'None' depedency instead of "Normal".
This tweaks GVN to do its optimization with the new result.

llvm-svn: 60267
2008-11-30 01:39:32 +00:00
Chris Lattner 60444f8aa5 implement a fixme by introducing a new getDependencyFromInternal
method that returns its result as a DepResultTy instead of as a
MemDepResult.  This reduces conversion back and forth.

llvm-svn: 60266
2008-11-30 01:26:32 +00:00