1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

1930 Commits

Author SHA1 Message Date
Chris Lattner
35095d7722 Some internal refactoring to make it easier to cache results.
llvm-svn: 60650
2008-12-07 02:56:57 +00:00
Chris Lattner
ad82419b46 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
8e8a6b4ec3 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
d14e6778c6 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
ddfcaff37c rename some variables for consistency
llvm-svn: 60644
2008-12-07 00:39:19 +00:00
Chris Lattner
e4c5f66b3b 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
20b7d9667d 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
dc8cf1fa91 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
a04521164c 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
d33c83b1af 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
2b5e1b5263 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
08ad59d631 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
0a0e2b1033 Make the debugging dump be a full line.
llvm-svn: 60509
2008-12-03 22:45:31 +00:00
Nick Lewycky
81635468b3 Add a new SCEV representing signed division.
llvm-svn: 60407
2008-12-02 08:05:48 +00:00
Chris Lattner
bd1bc4a75e 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
36257aabe4 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
9f7facc8eb 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
baf3cdd3a1 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
90904fda3c introduce a typedef, no functionality change.
llvm-svn: 60272
2008-11-30 02:30:50 +00:00
Chris Lattner
a772cad6ff 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
2e3c1d37d9 calls never depend on allocations.
llvm-svn: 60268
2008-11-30 01:44:00 +00:00
Chris Lattner
2f7da36732 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
ae0e214d84 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
Chris Lattner
20e7b9bf7e Move the getNonLocalDependency method to a more logical place in
the file, no functionality change.

llvm-svn: 60265
2008-11-30 01:18:27 +00:00
Chris Lattner
9be5c5c763 REmove an old fixme, resolve another fixme by adding liberal
comments about what this class does.

llvm-svn: 60264
2008-11-30 01:17:08 +00:00
Chris Lattner
214e6decde remove a bit of incorrect code that tried to be tricky about speeding up
dependencies.  The basic situation was this: consider if we had:

  store1
  ...
  store2
  ...
  store3

Where memdep thinks that store3 depends on store2 and store2 depends 
on store1.  The problem happens when we delete store2: The code in 
question was updating dep info for store3 to be store1.  This is a
spiffy optimization, but is not safe at all, because aliasing isn't
transitive.  This bug isn't exposed today with DSE because DSE will only
zap store2 if it is identifical to store 3, and in this case, it is 
safe to update it to depend on store1.  However, memcpyopt is not so
fortunate, which is presumably why the "dropInstruction" code used to
exist.

Since this doesn't actually provide a speedup in practice, just rip the
code out.

llvm-svn: 60263
2008-11-30 01:09:30 +00:00
Chris Lattner
adf33d42ed Eliminate the dropInstruction method, which is not needed any more.
Fix a subtle iterator invalidation bug I introduced in the last commit.

llvm-svn: 60258
2008-11-29 23:30:39 +00:00
Chris Lattner
6d2b59a58f implement some fixme's: when deleting an instruction with
an entry in the nonlocal deps map, don't reset entries
referencing that instruction to [dirty, null], instead, set
them to [dirty,next] where next is the instruction after the
deleted one.  Use this information in the non-local deps
code to avoid rescanning entire blocks.

This speeds up GVN slightly by avoiding pointless work.  On
403.gcc this makes GVN 1.5% faster. 

llvm-svn: 60256
2008-11-29 22:02:15 +00:00
Chris Lattner
3e86ec7289 Change MemDep::getNonLocalDependency to return its results as
a smallvector instead of a DenseMap.  This speeds up GVN by 5%
on 403.gcc.

llvm-svn: 60255
2008-11-29 21:33:22 +00:00
Chris Lattner
b19c015a87 move MemoryDependenceAnalysis::verifyRemoved to the end of the file,
no functionality/code change.

llvm-svn: 60254
2008-11-29 21:25:10 +00:00
Chris Lattner
ffc1af1619 reimplement getNonLocalDependency with a simpler worklist
formulation that is faster and doesn't require nonLazyHelper.
Much less code.

llvm-svn: 60253
2008-11-29 21:22:42 +00:00
Chris Lattner
5feffd1b9b rename some maps.
llvm-svn: 60242
2008-11-29 09:20:15 +00:00
Chris Lattner
9427fbc5a2 rename some variables.
llvm-svn: 60241
2008-11-29 09:15:21 +00:00
Chris Lattner
a0265f808f eliminate a bunch of code in favor of using AliasAnalysis::getModRefInfo.
Put a some code back to handle buggy behavior that GVN expects: it wants
loads to depend on each other, and accesses to depend on their allocations.

llvm-svn: 60240
2008-11-29 09:09:48 +00:00
Chris Lattner
98eee41567 simplify some code and rename some variables. Reduce nesting.
Use getTypeStoreSize instead of ABITypeSize for in-memory size
in a couple places.

llvm-svn: 60238
2008-11-29 08:51:16 +00:00
Chris Lattner
96c72eef4b Split getDependency into getDependency and getDependencyFrom, the
former does caching, the later doesn't.  This dramatically simplifies
the logic in getDependency and getDependencyFrom.

llvm-svn: 60234
2008-11-29 03:47:00 +00:00
Chris Lattner
9e956ef129 Now that DepType is private, we can start cleaning up some of its uses:
Document the Dirty value more precisely, use it for the uninitialized
DepResultTy value.  Change reverse mappings to be from an instruction*
instead of DepResultTy, and stop tracking other forms.  This makes it more
clear that we only care about the instruction cases.

Eliminate a DepResultTy,bool pair by using Dirty in the local case as well,
shrinking the map and simplifying the code.

This speeds up GVN by ~3% on 403.gcc.

llvm-svn: 60232
2008-11-29 03:22:12 +00:00
Chris Lattner
6bf62f050c Introduce and use a new MemDepResult class to hold the results of a memdep
query.  This makes it crystal clear what cases can escape from MemDep that
the clients have to handle.  This also gives the clients a nice simplified
interface to it that is easy to poke at.

This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.

llvm-svn: 60231
2008-11-29 02:29:27 +00:00
Chris Lattner
e9295510b5 Reimplement the internal abstraction used by MemDep in terms
of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the 
appropriate pieces and will be useful for internal 
implementation improvements later.

I'm not particularly happy with this.  After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all.  I'll fix this in a subsequent commit.

This has no functionality change.

llvm-svn: 60230
2008-11-29 01:43:36 +00:00
Chris Lattner
494758e720 Fix PR3141 by ensuring that MemoryDependenceAnalysis::removeInstruction
properly updates the reverse dependency map when it installs updated 
dependencies for instructions that depend on the removed instruction.

llvm-svn: 60222
2008-11-28 22:51:08 +00:00
Chris Lattner
219e9af693 more cleanups for MemoryDependenceAnalysis::removeInstruction,
no functionality change.

llvm-svn: 60219
2008-11-28 22:28:27 +00:00
Chris Lattner
7b984beb45 random cleanups, no functionality change.
llvm-svn: 60218
2008-11-28 22:04:47 +00:00
Chris Lattner
ef04ddf87c Run verifyRemoved from removeInstruction when -debug is specified.
This shows the root problem behind PR3141.

llvm-svn: 60216
2008-11-28 21:45:17 +00:00
Chris Lattner
cc3a3c0c98 rename "ping" to "verifyRemoved". I don't know why 'ping' what chosen,
but it doesn't make any sense at all.

Also make the method const, private, and fit in 80 cols while we're at it.

llvm-svn: 60215
2008-11-28 21:42:09 +00:00
Chris Lattner
ad6c575105 remove mysterious escaped newlines.
llvm-svn: 60211
2008-11-28 21:16:44 +00:00
Nick Lewycky
b8b082166a Seriously strengthen the guarantee offered by noalias on a function's return
value. It must now be as if the pointer were allocated and has not escaped to
the caller. Thanks to Dan Gohman for pointing out the error in the original
and helping devise this definition.

llvm-svn: 59940
2008-11-24 05:00:44 +00:00
Nick Lewycky
47fa9bd187 Extend the 'noalias' attribute to function return values. This is intended to
indicate functions that allocate, such as operator new, or list::insert. The
actual definition is slightly less strict (for now).

No changes to the bitcode reader/writer, asm printer or verifier were needed.

llvm-svn: 59934
2008-11-24 03:41:24 +00:00
Chris Lattner
08bdf9dfab reapply Sanjiv's patch to genericize memcpy/memset/memmove to take an
arbitrary integer width for the count.

llvm-svn: 59823
2008-11-21 16:42:48 +00:00
Bill Wendling
4c5afef830 Revert r59802. It was breaking the build of llvm-gcc:
g++ -m32 -c -g -DIN_GCC -W -Wall -Wwrite-strings -Wmissing-format-attribute -fno-common -mdynamic-no-pic -DHAVE_CONFIG_H -Wno-unused -DTARGET_NAME=\"i386-apple-darwin9.5.0\" -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include -DENABLE_LLVM -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/../llvm.src/include  -D_DEBUG  -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS   -I. -I. -I../../llvm-gcc.src/gcc -I../../llvm-gcc.src/gcc/. -I../../llvm-gcc.src/gcc/../include -I./../intl -I../../llvm-gcc.src/gcc/../libcpp/include  -I../../llvm-gcc.src/gcc/../libdecnumber -I../libdecnumber -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.obj/include -I/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/include ../../llvm-gcc.src/gcc/llvm-types.cpp -o llvm-types.o
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemCpy(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1496: error: 'memcpy_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemMove(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1512: error: 'memmove_i64' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp: In member function 'void TreeToLLVM::EmitMemSet(llvm::Value*, llvm::Value*, llvm::Value*, unsigned int)':
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i32' is not a member of 'llvm::Intrinsic'
../../llvm-gcc.src/gcc/llvm-convert.cpp:1528: error: 'memset_i64' is not a member of 'llvm::Intrinsic'
make[3]: *** [llvm-convert.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm fsf-funding.pod gcov.pod gfdl.pod cpp.pod gpl.pod gcc.pod
make[2]: *** [all-stage1-gcc] Error 2
make[1]: *** [stage1-bubble] Error 2
make: *** [all] Error 2

llvm-svn: 59809
2008-11-21 09:09:41 +00:00
Sanjiv Gupta
89a7e67578 Make mem[cpy,move,set] intrinsics overloaded.
llvm-svn: 59802
2008-11-21 07:49:09 +00:00