Commit Graph

172 Commits

Author SHA1 Message Date
Chris Lattner 652eb53dad Fix a tiny bug that caused an incorrect assertion failure poolallocating
boxed-sim.

llvm-svn: 12358
2004-03-13 01:14:23 +00:00
Chris Lattner b26b6fe9a7 implement new method
llvm-svn: 12264
2004-03-09 19:37:06 +00:00
Chris Lattner 84c697d520 Fix a bug handling globals that are constants, but are still external
llvm-svn: 12208
2004-03-08 03:52:24 +00:00
Chris Lattner 3562ea84ab Implement a FIXME, improving the efficiency of DSA on povray.
This reduces CBU time from 145s -> 122s (debug build), reduces # allocated nodes
from 129420 to 116477.

llvm-svn: 12125
2004-03-04 19:47:04 +00:00
Chris Lattner 536b131c9c Fix BU datastructures with povray!
The problem was that we were merging a field of a node with a value that was
deleted.  Thanks to bugpoint for reducing povray to a nice small 3 function
example.  :)

llvm-svn: 12116
2004-03-04 17:06:53 +00:00
Chris Lattner f48eb7519a Only clone nodes that are needed in the caller, don't clone ALL aux calls. This improves
povray from having ~600K nodes and 300K call nodes to 65K nodes and 25K call nodes.

llvm-svn: 12109
2004-03-04 03:57:53 +00:00
Chris Lattner d9da2678fc Fix a DSA bug that caused DSA to generate incredibly huge graphs and take forever to
do it on povray.  The problem is that we were not copying globals from callees to
callers unless the existed in both graphs.  We should have copied them in the case
where the global pointed to a node that was copied as well.

llvm-svn: 12104
2004-03-03 22:01:09 +00:00
Chris Lattner 5fc189157c Deinline methods, add fast exit
llvm-svn: 12102
2004-03-03 20:55:27 +00:00
Chris Lattner 140b2cbd28 Fix a node mapping problem that was causing the pool allocator to locally allocate
nodes that were globally live, thus breaking programs.

llvm-svn: 12094
2004-03-03 05:34:31 +00:00
Chris Lattner 06a573f63d Only clone global nodes between graphs if both graphs have the global.
llvm-svn: 11928
2004-02-27 20:05:15 +00:00
Chris Lattner 36ab728fe5 Fix typo
llvm-svn: 11864
2004-02-26 03:45:03 +00:00
Chris Lattner 128e84197b The node doesn't have to be _no_ node flags, it just has to be complete and
not have any globals.

llvm-svn: 11863
2004-02-26 03:43:43 +00:00
Chris Lattner 71626b8f36 Two changes:
1. Functions do not make things incomplete, only variables
 2. Constant global variables no longer need to be marked incomplete, because
    we are guaranteed that the initializer for the global will be in the
    graph we are hacking on now.  This makes resolution of indirect calls happen
    a lot more in the bu pass, supports things like vtables and the C counterparts
    (giant constant arrays of function pointers), etc...

Testcase here: test/Regression/Analysis/DSGraph/constant_globals.ll

llvm-svn: 11852
2004-02-25 23:36:08 +00:00
Chris Lattner 6ce59b4a03 Simplify the dead node elimination stuff
Make the incompleteness marker faster by looping directly over the globals
instead of over the scalars to find the globals

Fix a bug where we didn't mark a global incomplete if it didn't have any
outgoing edges.  This wouldn't break any current clients but is still wrong.

llvm-svn: 11848
2004-02-25 23:08:00 +00:00
Chris Lattner a376aae246 Use isNull instead of getNode() to test for existence of a node, this is cheaper.
FIX MAJOR BUG, whereby we didn't merge null edges correctly. Correcting this
fixes poolallocation on 175.vpr, and possibly others.

llvm-svn: 11695
2004-02-22 00:53:54 +00:00
Chris Lattner f3e2a6360c Fix an iterator invalidation problem which was causing some nodes to not be
correctly merged over!

llvm-svn: 11693
2004-02-21 22:28:26 +00:00
Chris Lattner ac6db755c3 Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
llvm-svn: 11228
2004-02-09 04:37:31 +00:00
Chris Lattner 9ab85275ef Instead of callign removeTriviallyDeadNodes on the global graph every time
removeDeadNodes is called, only call it at the end of the pass being run.
This saves 1.3 seconds running DSA on 177.mesa (5.3->4.0s), which is
pretty big.  This is only possible because of the automatic garbage
collection done on forwarding nodes.

llvm-svn: 11178
2004-02-08 01:51:48 +00:00
Chris Lattner b0f32183e4 Substantially improve the DSA code by removing 'forwarding' nodes from
DSGraphs while they are forwarding.  When the last reference to the forwarding
node is dropped, the forwarding node is autodeleted.  This should simplify
removeTriviallyDead nodes, and is only (efficiently) possible because we are
using an ilist of dsnodes now.

llvm-svn: 11175
2004-02-08 01:27:18 +00:00
Chris Lattner 5592af7927 Bugfix for ilist conversion. The ilist wants to make an 'end' node which has
G == 0

llvm-svn: 11174
2004-02-08 01:05:37 +00:00
Chris Lattner f3861ce4f6 Switch the Nodes list from being an std::vector<DSNode*> to an ilist<DSNode>
llvm-svn: 11173
2004-02-08 00:53:26 +00:00
Chris Lattner bd16efb88f Change to use node_iterators instead of direct access to Nodes
llvm-svn: 11171
2004-02-08 00:23:16 +00:00
Chris Lattner ce74c2f50b getNodes() is gone, use node_begin/end instead
Rename stats from dsnode -> dsa
Add a new stat

llvm-svn: 11167
2004-02-07 23:58:05 +00:00
Chris Lattner 40862c7578 There is no need to clone over nodes that are going to be dead anyway
llvm-svn: 11157
2004-02-07 22:00:03 +00:00
Chris Lattner 6c9861be68 Fix a bug aflicting 265.gap
llvm-svn: 11006
2004-01-29 08:36:22 +00:00
Chris Lattner c0f1e25c01 Minor bugfixes
llvm-svn: 11005
2004-01-29 03:32:15 +00:00
Chris Lattner 9412b70a4c Rename DSGraph::ScalarMapTy -> DSScalarMap
llvm-svn: 11001
2004-01-28 09:15:42 +00:00
Chris Lattner f30ae61683 Fix a bug
llvm-svn: 11000
2004-01-28 03:31:34 +00:00
Chris Lattner 68e4bb2b13 Eliminate the call to removeTriviallyDeadNodes from updateFromGlobals graph,
moving it to the start of removeDeadNodes.  This speeds up DSA by 2s on perlbmk
from 41s

llvm-svn: 10999
2004-01-28 03:24:41 +00:00
Chris Lattner 63c649a9fa In updateFromGlobalsGraph, instead of iterating over all of the scalars in the
function to find the globals, iterate over all of the globals directly.  This
speeds the function up from 14s to 6.3s on perlbmk, reducing DSA time from
53->46s.

llvm-svn: 10996
2004-01-28 03:03:06 +00:00
Chris Lattner 06a40fc140 Minor tweaks, eliminate useless integer pruning optimziation, turn on
timers by default

llvm-svn: 10993
2004-01-28 02:41:32 +00:00
Chris Lattner 9f0f7ca74e Further reduce the number of nodes cloned with getClonedNH, using merge instead.
This reduces the number of nodes allocated, then immediately merged and DNE'd
from 2193852 to 1298049.  unfortunately this only speeds DSA up by ~1.5s (of
53s), because it's spending most of its time waddling through the scalar map :(

llvm-svn: 10992
2004-01-28 02:11:49 +00:00
Chris Lattner 6ee2b154d4 Add a timer, fix a minor bug.
Also, use RC::merge when possible, reducing the number of nodes allocated, then immediately merged away from 2985444 to 2193852 on perlbmk.

llvm-svn: 10991
2004-01-28 02:05:05 +00:00
Chris Lattner f6f97f9f90 Another bugfix, disable "spurious" output.
You gotta love spurious

llvm-svn: 10990
2004-01-28 01:19:52 +00:00
Chris Lattner 26acc890f9 fix bug in previous checkin
llvm-svn: 10989
2004-01-27 22:54:56 +00:00
Chris Lattner 54a52e53f0 * Add a new commandline argument to control the "global roots hack". Default
it to be off.  If it looks like it's completely unnecessary after testing, I
  will remove it completely (which is the hope).
* Callers of the DSNode "copy ctor" can not choose to not copy links.
* Make node collapsing not create a garbage node in some cases, avoiding a
  memory allocation, and a subsequent DNE.
* When merging types, allow two functions of different types to be merged
  without collapsing.
* Use DSNodeHandle::isNull more often instead of DSNodeHandle::getNode() == 0,
  as it is much more efficient.
*** Implement the new, more efficient reachability cloner class
    In addition to only cloning nodes that are reachable from interesting
    roots, this also fixes the huge inefficiency we had where we cloned lots
    of nodes, only to merge them away immediately after they were cloned.
    Now we only actually allocate a node if there isn't one to merge it into.
* Eliminate the now-obsolete cloneReachable* and clonePartiallyInto methods
* Rewrite updateFromGlobalsGraph to use the reachability cloner
* Rewrite mergeInGraph to use the reachability cloner
* Disable the scalar map scanning code in removeTriviallyDeadNodes.  In large
  SCC's, this is extremely expensive.  We need a better data structure for the
  scalar map, because we really want to scan the unique node handles, not ALL
  of the scalars.
* Remove the incorrect SANER_CODE_FOR_CHECKING_IF_ALL_REFERRERS_ARE_FROM_SCALARMAP code.
* Move the code for eliminating integer nodes from the trivially dead
  eliminator to the dead node eliminator.
* removeDeadNodes no longer uses removeTriviallyDeadNodes, as it contains a
  superset of the node removal power.
* Only futz around with the globals graph in removeDeadNodes if it is modified

llvm-svn: 10987
2004-01-27 22:03:40 +00:00
Chris Lattner 78c36d2112 Initial support for implementing clonePartiallyInto in terms of cloneReachableSubgraph, though this support is currently disabled.
llvm-svn: 10970
2004-01-23 01:44:53 +00:00
Chris Lattner 80f89ea522 Eliminated the CompletedNodes argument to the cloneReachable* methods. This
map was only used to implement a marginal GlobalsGraph optimization, and it
actually slows the analysis down (due to the overhead of keeping it), so just
eliminate it entirely.

llvm-svn: 10955
2004-01-22 16:56:13 +00:00
Chris Lattner 5750d46ccd Ok, I'm tired of pulling out all my timers to check stuff in, just do it.
llvm-svn: 10954
2004-01-22 16:36:28 +00:00
Chris Lattner 2a0bc1224d Bug fix: X.mergeWith(Y) was not updating Y if Y was a null node handle!
llvm-svn: 10953
2004-01-22 16:31:08 +00:00
Chris Lattner e75ae61b47 Start implementing DSGraph::clonePartiallyInto and implement mergeInGraph
in terms of it.

Though clonePartiallyInto is not cloning partial graphs yet, this change
dramatically speeds up inlining of graphs with many scalars.  For example,
this change speeds up the BU pass on 253.perlbmk from 69s to 36s, because
it avoids iteration over the scalar map, which can get pretty large.

llvm-svn: 10951
2004-01-22 15:30:58 +00:00
Chris Lattner 9e876556fd Fine-grainify namespaces for this library
llvm-svn: 9948
2003-11-12 23:11:14 +00:00
Chris Lattner da03a8a792 Add new argument to disable checking
llvm-svn: 9922
2003-11-12 17:58:22 +00:00
Chris Lattner 12c71c00ef Don't crash if no gg
llvm-svn: 9913
2003-11-12 04:57:58 +00:00
Brian Gaeke 960707c335 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner da05b05197 Compute node offsets correctly
llvm-svn: 9895
2003-11-11 20:12:32 +00:00
Chris Lattner fdc8d6547b Add new method for computing node mappings. This is used by the pool allocator
llvm-svn: 9880
2003-11-11 05:08:59 +00:00
Chris Lattner 2b9926fc8e All DSGraphs keep a reference to the targetdata they are created with. This is
used to eliminate the hard coded, hacked in, sparc specific, global TargetData.
Changing the TargetData used to actually match the code fixes problems, and
eliminates a crash.

llvm-svn: 9659
2003-11-02 22:27:28 +00:00
Chris Lattner 53e8fab411 Fix bug: test/Regression/Analysis/DSGraph/2003-11-02-NodeCollapsing.ll
llvm-svn: 9658
2003-11-02 21:02:20 +00:00
John Criswell 482202a601 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00