Commit Graph

173 Commits

Author SHA1 Message Date
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
Chris Lattner cc81b798e4 Remove trivially dead nodes was not removing nodes that were dead due to forwarding!
llvm-svn: 8634
2003-09-20 21:34:07 +00:00
Chris Lattner 04d9cb6770 Switch from using CallInst's to represent call sites to using the LLVM
CallSite class.  Now we can represent function calls by invoke instructions
too!

llvm-svn: 8629
2003-09-20 16:34:13 +00:00
Misha Brukman 329983228f Fixed spelling and grammar.
llvm-svn: 8478
2003-09-11 18:14:24 +00:00
Chris Lattner 61182a2021 Add more verbose comment
llvm-svn: 7610
2003-08-05 18:38:37 +00:00
Sumant Kowshik 1d869b78f5 Added function mergeInGlobalsGraph which merges in the entire globals graph with the graph of a function
llvm-svn: 7606
2003-08-05 17:04:41 +00:00
Chris Lattner 8abcd56c74 DEBUG got moved to Support/Debug.h
llvm-svn: 7492
2003-08-01 22:15:03 +00:00
Vikram S. Adve eb04c29378 Fix comment.
llvm-svn: 7227
2003-07-22 12:08:58 +00:00
Vikram S. Adve dce6694ff4 Implement 2 important changes: (1) rematerialization from the globals graph,
and (2) faster inlining by cloning only reachable nodes.  In particular:
(1) Added DSGraph::cloneReachableSubgraph and DSGraph::cloneReachableNodes
    to clone the subgraph reachable from a set of root nodes, into the
    current graph, merging the global nodes into thos in the current graph.
    The TD pass now uses this for faster inlining, and so does the
    next function.
(2) Added DSGraph::updateFromGlobalGraph() to rematerialize nodes from the
    globals graph into the current graph in both BU and TD passes.
(3) `I' flags are removed from all nodes in the globals graph, because they
    are difficult to maintain correctly and are not needed anyway.
(4) Aux. function calls are only removed to the globals graph if they
    will never be resovled.  (This is what fixed gap.)  The immediate
    reason is that if we took these out of a function (and moved them to
    the globals graph) we would need to rematerialize these nodes into the
    function graph for every function in the BU pass.  The longer term
    problem is that we would need to find a way to remove them from the
    globals graph iff they have been resolved on all paths through the
    call graph.

llvm-svn: 7187
2003-07-16 21:36:31 +00:00
Chris Lattner 117da20334 Remove globals more aggressively from graphs.
Fix a bug where we removed nodes that were marked U.

llvm-svn: 7090
2003-07-03 02:03:53 +00:00
Chris Lattner c812e5f44e INCLUDE_PARENT_GRAPH is required!
llvm-svn: 7088
2003-07-02 23:57:05 +00:00
Chris Lattner 03f3cb1af7 Add support for ParentGraph only when building in debug mode
Minor cleanups, reenable folding of call nodes to external functions

llvm-svn: 7061
2003-07-02 04:38:49 +00:00
Chris Lattner 23428214e9 Rework TD pass to work with the precise call graph constructed by the BU phase
llvm-svn: 7031
2003-07-01 16:28:11 +00:00
Chris Lattner bfce1115e3 Add new method
llvm-svn: 7007
2003-06-30 05:57:30 +00:00
Chris Lattner fa52af4fb0 Be more const-correct
llvm-svn: 7005
2003-06-30 05:27:18 +00:00
Chris Lattner 0929c5ef68 Fix bug in last checkin
llvm-svn: 7003
2003-06-30 05:18:26 +00:00
Chris Lattner 348d93c8c2 Handle the case where OldNodeMap == &ScalarMap correctly
llvm-svn: 7000
2003-06-30 05:09:29 +00:00
Chris Lattner 6d187fdc5a Move usages of explicit hash_* datastructures to use typedefs
llvm-svn: 6996
2003-06-30 03:36:09 +00:00
Chris Lattner 63aeacfe3d Revamp DSGraphs so that they can support multiple functions in the same
DSGraph at one time

llvm-svn: 6994
2003-06-30 03:15:25 +00:00
Chris Lattner 205d1acfba Fix minor bug in previous checkin
llvm-svn: 6986
2003-06-29 22:36:31 +00:00
Chris Lattner 16e3c398c8 Add support for "physical subtyping", which fixes:
DSGraph/2003-06-29-NodeCollapsing2.ll & DSGraph/PhysicalSubtyping.ll

llvm-svn: 6982
2003-06-29 20:27:45 +00:00
Chris Lattner 856a6cbb80 Avoid double negatives
llvm-svn: 6945
2003-06-28 21:58:28 +00:00
Chris Lattner d791d8e427 Remove support for the MultiObject flag, which was fundamentally broken
llvm-svn: 6840
2003-06-22 03:03:52 +00:00
Chris Lattner 4853d162af * Changes to make NodeType be private to DSNode.
* Add new MultiObject flag to DSNode which keeps track of whether or not
  multiple objects have been merged into the node, allowing must-alias info
  to be tracked.

llvm-svn: 6794
2003-06-19 21:15:11 +00:00
Chris Lattner 82f4f85f6d Remove bogus assertion: a node with no referrers could be collapsed if field-sensitivity was disabled
llvm-svn: 6695
2003-06-16 12:07:39 +00:00
Misha Brukman e5838c4d72 s/convertable/convertible/g
llvm-svn: 6248
2003-05-20 18:45:36 +00:00
Chris Lattner c12e5ccdb5 Don't apply type information to load instructions if it will cause collapsing
llvm-svn: 5684
2003-03-03 17:13:31 +00:00
Chris Lattner b39d6355e1 Fix resolution of indirect function calls... whoops
llvm-svn: 5576
2003-02-14 23:27:18 +00:00
Chris Lattner 8acdca64fd - Eliminate provably non-pointer nodes from graphs.
This helps a lot of testcases, for example:
            New Time  New #Nodes     Old Time    Old #Nodes
254.gap:    91.1024     21605        91.1397     22657
povray31:    2.7807      8613         3.0152     10338
255.vortex:  1.2034      8153         1.2172     8822
moria:        .6756      3150          .7054     3877
300.twolf:    .1652      2010          .1851     3270

Typically, testcases which use long and ulong integers a lot get better, f.e. povray above.

llvm-svn: 5566
2003-02-14 06:28:00 +00:00
Chris Lattner a17866894a Move node forwarding code from being inlined to being out-of-line.
This brings a 11.6% speedup to steens, and a 3.6 overall speedup to ds-aa

llvm-svn: 5552
2003-02-13 19:09:00 +00:00
Chris Lattner 7127d7db7a Implement a "union-findy" version of DS-Analysis, which eliminates the
Referrers list on DSNodes.

llvm-svn: 5536
2003-02-11 23:11:51 +00:00
Chris Lattner e715357909 Modest speedup which seems to help steens quite a bit on large graphs
llvm-svn: 5532
2003-02-10 18:47:23 +00:00
Chris Lattner f8292feb04 Fix problem breaking GAP, use hasNoReferrers more
llvm-svn: 5530
2003-02-10 18:18:18 +00:00
Chris Lattner 0eee7eb390 * Fix a bug where global incompleteness marking would not mark the global
itself incomplete!
* Allow incompleteness callers to specify they don't want globals to be
  considered sources of incompleteness.

llvm-svn: 5513
2003-02-09 18:41:49 +00:00
Chris Lattner 26bd24cd81 Add a special case for main because we know it's incoming arguments don't alias
llvm-svn: 5511
2003-02-08 23:08:02 +00:00
Chris Lattner f7979c2f2b Fix an assertion failure
llvm-svn: 5496
2003-02-06 00:15:08 +00:00
Chris Lattner 80614ee5ef Implement optimization for direct function call case. This dramatically
reduces the number of function nodes created and speeds up analysis by
about 10% overall.

llvm-svn: 5495
2003-02-05 21:59:58 +00:00
Chris Lattner a0e9e6ec8c Add sanity check
llvm-svn: 5489
2003-02-04 00:03:57 +00:00
Chris Lattner 1d3922ac0b * Fix a bug introduced in the last checkin wrt Stack markers
* Make cloning more efficient in the process...

llvm-svn: 5479
2003-02-03 20:08:51 +00:00
Chris Lattner 8bb9513bd8 Implement the globals graph!
llvm-svn: 5477
2003-02-03 19:12:15 +00:00
Chris Lattner 9e75f38bb9 Fix a bug where we would delete neccesary calls in bu pass
llvm-svn: 5465
2003-02-01 06:54:31 +00:00
Chris Lattner 5965bbb02f Fix a bug where we would incorrectly delete globals which had edges to alive nodes in
a graph in the t-d pass.  This slows down the TD pass by quite a bit (1/3), but is
needed for correctness.

llvm-svn: 5464
2003-02-01 06:51:17 +00:00
Chris Lattner c154bdcd4c Delete nodes more efficiently
llvm-svn: 5463
2003-02-01 06:41:15 +00:00
Chris Lattner 71449ba556 Remove dead nodes more efficiently
llvm-svn: 5462
2003-02-01 06:23:33 +00:00
Chris Lattner 4f276cc4dd Improve efficiency of aliveness traversal code
llvm-svn: 5461
2003-02-01 06:17:02 +00:00
Chris Lattner c44c04af44 Change DSGraph stuff to use hash_(set|map) instead of std::(set|map)
This change provides a small (3%) but consistent speedup

llvm-svn: 5460
2003-02-01 04:52:08 +00:00
Chris Lattner ee97c8b08a Remove using declarations
llvm-svn: 5456
2003-02-01 04:01:21 +00:00
Chris Lattner 87d76c7f01 Remove globals on the bottom up pass which do not contain any information
llvm-svn: 5451
2003-01-31 23:57:36 +00:00
Chris Lattner c5497c816f Use and implement API for graph traversals
llvm-svn: 5431
2003-01-29 21:10:20 +00:00
Chris Lattner a1d9011d6e * Eliminate boolean arguments in favor of using enums
* T-D pass now eliminates unreachable globals

llvm-svn: 5419
2003-01-23 22:05:33 +00:00
Chris Lattner 2d4945580f Fix analysis of the Burg program
llvm-svn: 5401
2003-01-22 22:00:24 +00:00
Vikram S. Adve 0d5559fdfb Fix several related bugs in DSNode::mergeWith() caused by the
fact that the incoming nodes may be merged away at intermediate
steps.  Use an extra level of indirection via DSNodeHandles
to track the nodes being merged.  All this now happens in a
static helper function MergeNodes().

llvm-svn: 4947
2002-12-06 21:15:21 +00:00
Vikram S. Adve bfff743897 Cute bug fix: when moving links from N to this, some links could have
been missed if node *this got merged away due to recursive merging!
Also, links were not moved correctly if a node is collapsed.

llvm-svn: 4933
2002-12-05 17:17:26 +00:00
Vikram S. Adve 2d2303db22 Fix logical error in TD pass: we should clear Mod/Ref bits of each caller
before inlining their graphs into a function.  To support this,
added flags to CloneFlags to strip/keep Mod/Ref bits.

llvm-svn: 4836
2002-11-27 17:41:13 +00:00
Vikram S. Adve 68690673ad Keep global nodes in each DS Graph (by forcing them to be marked live).
llvm-svn: 4831
2002-11-25 18:21:25 +00:00
Chris Lattner 79d943eb67 Add peak memory usage measurement stuff
Add structure padding optimizations

llvm-svn: 4749
2002-11-18 21:44:46 +00:00
Chris Lattner dcb4ac9594 Fix two bugs:
* The globals vector was getting broken and unsorted, this caused vortex
   to get badly pessimized
 * Node offset handling was being handled really poorly, and in particular
   we were not merging types with offsets right.  This causes several graphs
   to be non-merged.

llvm-svn: 4699
2002-11-12 07:20:45 +00:00
Chris Lattner 8aed9820e2 Elimiante calls to a node with nothing in it.
llvm-svn: 4695
2002-11-11 21:35:38 +00:00
Chris Lattner dd3dd4abeb Mark stuff reachable by _AUX_ calls as incomplete in the BU graph
llvm-svn: 4690
2002-11-11 03:36:55 +00:00
Chris Lattner 6fa9a7f7f4 Use call site mergeWith method to simplify code
llvm-svn: 4687
2002-11-11 00:00:46 +00:00
Chris Lattner d7f9f635ec Fix a bug that could trigger when varargs call sites had non-matching number of arguments
llvm-svn: 4683
2002-11-10 07:46:08 +00:00
Chris Lattner 7b61563d99 * Dramatically rework liveness evaluation.
* Implement the first step of the Globals graph: Deleting nodes from function
  graphs.  In practice, these nodes need to be moved to the globals graph, but
  this will be taken care of later.  Note that the graphs computed right now are
  not strictly correct!

llvm-svn: 4681
2002-11-10 06:59:55 +00:00
Chris Lattner 715a3a3b5c eliminate the ability to remove global nodes from deadNodeElminate... for now.
This slows stuff down a bit, but it should get much better before it gets any
worse.

llvm-svn: 4666
2002-11-09 22:07:02 +00:00
Chris Lattner 0de21ea32d Move maskNodeTypes to header file
llvm-svn: 4661
2002-11-09 21:02:26 +00:00
Chris Lattner 380d1ad4ab Clean up DSGraph::removeDeadNodes interface
llvm-svn: 4660
2002-11-09 21:00:49 +00:00
Chris Lattner e703c52b20 Make removeTriviallyDeadNodes a private interface of DSGraph
llvm-svn: 4659
2002-11-09 20:55:24 +00:00
Chris Lattner e742f31e0c Add initial support for a globals graph
llvm-svn: 4656
2002-11-09 20:01:01 +00:00
Chris Lattner 5737a600d7 Tighten up array handling
llvm-svn: 4655
2002-11-09 19:25:27 +00:00
Chris Lattner 63aeefeafb Fix warning & release build
llvm-svn: 4648
2002-11-09 00:49:05 +00:00
Chris Lattner be46569ba1 Fold arrays down to a single element. This causes huge wins on some benchmarks
for example: 197.parser (64M->14M), 164.gzip (14M->2.7M).  The actual graphs
represented should not change at all.

llvm-svn: 4643
2002-11-08 22:49:57 +00:00
Chris Lattner 56363a05e6 Allow specification of whether the call sites should be copied, AND whether
the aux call sites should be copied

llvm-svn: 4639
2002-11-08 22:27:09 +00:00
Chris Lattner c20122732e - Add a bunch of checking to make sure that dead nodes are not used after they
are marked DEAD.  This helped track down some bugs
- Fix a bunch of bugs where we were doing work on nodes after they became dead
- Add support for aux function call sites
- Add support for not cloning call sites

llvm-svn: 4633
2002-11-08 21:27:12 +00:00
Chris Lattner a075a5801b Use DSNodeHandleMap instead to be safe
llvm-svn: 4622
2002-11-08 05:01:14 +00:00
Chris Lattner b0c9b37048 Add flush
llvm-svn: 4619
2002-11-08 01:21:07 +00:00
Chris Lattner 5e865cdbe2 Instead of using a bool that constant has to be explained, use a self
explanitory enum instead.

llvm-svn: 4600
2002-11-07 07:06:20 +00:00
Chris Lattner df307e6fd0 Implement a new mergeInGraph method, which basically factors code out of
the BU class.

This will be used by the IPModRef class to do stuff, eventually perhaps the
TD pass will use it also.

Speaking of the TD pass, this also eliminates the self recursive case, which
was broken, and couldn't occur anyway.

llvm-svn: 4599
2002-11-07 06:31:54 +00:00
Chris Lattner ca03c3b516 Rename DataStructureAnalysis namespace to DS
llvm-svn: 4596
2002-11-07 05:20:53 +00:00
Chris Lattner f9d29b3299 Minor bugfix to enable generation of methcall.llvm.lib, objinst.llvm.lib, and
The problem was merging two unsized types like function's, ie int (int*) with
int (uint *)

llvm-svn: 4594
2002-11-07 04:59:28 +00:00
Chris Lattner 4f8e2acaa2 Move printouts to be wrapped in DEBUG() macros
llvm-svn: 4588
2002-11-07 01:54:56 +00:00
Chris Lattner 2b79f4b7c3 Make PointerSize & Shift be enums
Fix problem with recursive merging

llvm-svn: 4570
2002-11-06 18:01:39 +00:00
Chris Lattner 48e37d9b97 Dramatically simplify internal DSNode representation, get implementation
*FULLY OPERATIONAL* and safe.  We are now capable of completely analyzing
at LEAST the Olden benchmarks + 181.mcf

llvm-svn: 4562
2002-11-06 06:20:27 +00:00
Chris Lattner 6c213d673b Attempted fixes to the mergemap to make it work better.
Ended up disabling merge map merging completely.  It shall be removed.

llvm-svn: 4550
2002-11-05 00:01:58 +00:00
Chris Lattner 7e8b76009f Change the "Cannot merge two portions of the same node yet" from an assertion
into a "oh crap, lets collapse" case

llvm-svn: 4530
2002-11-04 06:48:26 +00:00
Chris Lattner a20fabc7ec Rename ValueMap to ScalarMap
llvm-svn: 4516
2002-11-03 21:27:48 +00:00
Chris Lattner bd7af8e664 Rename NewNode flag to HeapNode
llvm-svn: 4515
2002-11-03 21:24:04 +00:00
Chris Lattner a7b0d4eb08 Stop representing scalars as explicit nodes in the graph. Now the only
nodes in the graph are memory objects, which is very nice.  This also greatly
reduces the size and memory footprint for DSGraphs.  For example, the local
DSGraph for llu went from 65 to 13 nodes with this change.  As a side bonus,
dot seems to lay out the graphs slightly better too.  :)

llvm-svn: 4488
2002-11-02 00:13:20 +00:00
Chris Lattner c1d8820711 * Minor optimization: when merging nodes, merge the smaller one into the
larger one.
     * Handle the case where we are merging two nodes of different size better.

llvm-svn: 4476
2002-10-31 22:41:15 +00:00
Chris Lattner 7d5f19886d This fixes all kinds of problems with array handling. There are still bugs to
be fixed, but we are getting much closer now.

    * Make DSNode::TypeRec a full fledged DSTypeRec type.
    * Add methods used to update and access the typerecords elements
    * Add methods to query if and to cause a node to be completely folded
    * DSGraph construction doesn't use the allocation type for anything at all,
      now nodes get their type information based on how they are used.
    * Fixed a bug with global value handling introduced in the last checkin
    * GEP support is now much better, arrays are handled correctly.  The array
      flag is now updated in type records.  There are still cases that are not
      handled yet (we do not detect pessimizations), but getting much closer.

llvm-svn: 4465
2002-10-31 05:45:02 +00:00
Chris Lattner 155fffd350 Delete unused arguments to DSGraph::cloneInto method
llvm-svn: 4253
2002-10-21 19:50:29 +00:00
Chris Lattner c6191df9af Add another copy ctor form
llvm-svn: 4251
2002-10-21 15:32:34 +00:00
Chris Lattner 78c1e7d83c As it turns out, we don't need a fully generic mapping copy ctor, we just need
something that maps through a std::map.  Since this simplified the client and
implementation code, do so now.

llvm-svn: 4250
2002-10-21 15:04:18 +00:00
Chris Lattner 2f5a6d46ae Remove some unneccesary 'using' directives
llvm-svn: 4246
2002-10-21 13:31:48 +00:00
Chris Lattner 80e1a74820 Fix bug with prior checkin
llvm-svn: 4242
2002-10-21 02:18:55 +00:00
Chris Lattner 5c3ce31e1f - Make DSCallSite not inherit from std::vector. Renamed methods slightly.
Make copy ctor have two versions to avoid dealing with conditional template
    argument.  DSCallSite ctor now takes all arguments instead of taking one
    and being populated later.

llvm-svn: 4240
2002-10-21 02:08:03 +00:00
Chris Lattner 3af17ce2cf Simplify code a bit, add comment flyer
llvm-svn: 4238
2002-10-20 22:11:44 +00:00
Vikram S. Adve e85319693e Remove spurious caller pointer in DSCallSite.
Also add functions to access pointer argument nodes cleanly.

llvm-svn: 4235
2002-10-20 21:41:02 +00:00
Chris Lattner c94855e46b This function can be static
llvm-svn: 4234
2002-10-20 20:39:31 +00:00
Vikram S. Adve dc9e142686 Added a first-class representation for each call site that can be
used in the DS graphs.  Essentially, what was vector<DSNodeHandle>
before is now a DSCallSite with the same vector, plus pointers to the
CallInst and the caller Function.  The special-purpose class
BUDataStructure::CallSite is no longer needed.

llvm-svn: 4228
2002-10-20 18:07:37 +00:00
Chris Lattner f931f6b5c7 Convert typerec to be a structure instead of a pair
llvm-svn: 4226
2002-10-18 18:22:46 +00:00
Chris Lattner b182216df8 * Make the DSGraph cloner automatically merge global nodes
* BUClosure doesn't have to worry about global nodes
 * TDClosure now works with global nodes
 * Reenable DNE on TD pass, now that globals work right

llvm-svn: 4220
2002-10-17 20:09:52 +00:00