Commit Graph

1198 Commits

Author SHA1 Message Date
Chris Lattner 9f9da538d6 a hack to allow count-aa to work with ds-aa :(
llvm-svn: 20791
2005-03-23 21:59:34 +00:00
Chris Lattner ccb6faad7e Add two options to allow -count-aa to print queries either (1) all queries,
or (2) only queries that are not successful (e.g. return may alias)

llvm-svn: 20790
2005-03-23 21:59:07 +00:00
Chris Lattner 61130216ec turn a dead conditional into an assert.
llvm-svn: 20787
2005-03-23 20:12:08 +00:00
Chris Lattner 01f0879c48 Totally gut mergeInGraph. There is absolutely no reason to be merging
global roots in from callees to callers.  The BU graphs do not have accurate
globals information and all of the clients know it.  Instead, just make sure
the GG is up-to-date, and they will be perfectly satiated.

This speeds up the BU pass on 176.gcc from 5.5s to 1.5s, and Loc+BU+TD
from 7s to 2.7s.

llvm-svn: 20786
2005-03-23 20:08:59 +00:00
Chris Lattner 048ae36b93 wrap a long line
llvm-svn: 20785
2005-03-23 16:43:11 +00:00
Chris Lattner e36d77b726 Make -steens-aa more conservative (aka correct) by making sure to obey
incompleteness flags.

Make it more aggressive by taking field sensitive information into
account.

llvm-svn: 20781
2005-03-23 01:48:09 +00:00
Chris Lattner 7d3df410ab implement Analysis/DSGraph/field-sensitive.ll
llvm-svn: 20779
2005-03-23 01:47:19 +00:00
Chris Lattner 310d1a3882 Several changes here:
1. Increase max node size from 64->256 to avoid collapsing an important
   structure in 181.mcf
2. If we have multiple calls to an indirect call node with an indirect
   callee, fold these call nodes together, to avoid DSA turning apoc into
   a flaming fireball of death when analyzing 176.gcc.
  With this change, 176.gcc now takes ~7s to analyze for loc+bu+td, with
  5.7s of that in the BU pass.

llvm-svn: 20775
2005-03-22 23:54:52 +00:00
Chris Lattner ca174306f0 Mark external globals incomplete in the BU Globals graph, fixing
Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll

llvm-svn: 20773
2005-03-22 22:10:22 +00:00
Chris Lattner f00684079a Directly count the number of memory instructions.
llvm-svn: 20766
2005-03-22 03:55:10 +00:00
Chris Lattner 495f00946e Remove an iteration pass over the entire scalarmap for each function created
by not allowing integer constants to get into the scalar map in the first
place.

llvm-svn: 20764
2005-03-22 02:45:13 +00:00
Chris Lattner 250726ec25 When making a clone of a DSGraph from the BU pass, make sure to remember that
this clone is supposed to be used for *ALL* of the functions in the SCC.

This fixes the memory explosion problem the TD pass was having, reducing the
memory growth from 24MB -> 3.5MB on povray and 270MB ->8.3MB on perlbmk!
This obviously also speeds up the TD pass *a lot*.

llvm-svn: 20763
2005-03-22 01:50:42 +00:00
Chris Lattner e05c633099 Don't use operator[], use the new method instead, which is faster. This speeds
up the TD pass about 30% for povray and perlbmk.  It's still not clear why
copying a 5MB set of graphs turns into a 25MB set of graphs though :(

llvm-svn: 20762
2005-03-22 01:42:59 +00:00
Chris Lattner fcae88f280 Now that the dead ctor is gone, nothing uses the old node mapping exported by
cloneInto: make it an internally used mapping.

llvm-svn: 20760
2005-03-22 00:36:51 +00:00
Chris Lattner 8016c975c9 remove a dead ctor
llvm-svn: 20759
2005-03-22 00:33:35 +00:00
Chris Lattner ea2c02bcca now that the second argument is always this->ReturnNodes, don't bother passing it.
llvm-svn: 20758
2005-03-22 00:29:44 +00:00
Chris Lattner 571578143c instead of using a local RetValMap, just use the graph we are cloning into
for the return node map.

llvm-svn: 20757
2005-03-22 00:25:52 +00:00
Chris Lattner d05ab9cab4 now that the valuemapping is always the local scalar map, we can eliminate
this identity merge.

llvm-svn: 20755
2005-03-22 00:22:45 +00:00
Chris Lattner 19944fade3 remove the second argument to cloneInto
llvm-svn: 20754
2005-03-22 00:21:05 +00:00
Chris Lattner 03b7f99338 add some timers, don't clone aux nodes
llvm-svn: 20752
2005-03-22 00:12:00 +00:00
Chris Lattner 410da35a1f move this out of line
llvm-svn: 20751
2005-03-22 00:09:45 +00:00
Chris Lattner 5f10e6dda1 don't generate temporary scalarmaps.
llvm-svn: 20749
2005-03-22 00:04:21 +00:00
Chris Lattner 848ef879c5 allow passing clone flags down to cloneInto
llvm-svn: 20748
2005-03-21 22:49:53 +00:00
Chris Lattner c1439d539f Enhance the TD pass to build composite graphs when we have indirect call
sites that target multiple callees.  If we have a function table, for
example, with N callees, and M callers call through it, we used to have
to perform O(M*N) graph inlinings.  Now we perform O(M+N) inlinings.

This speeds up the td pass on perlbmk from 36.26s to 25.75s.

llvm-svn: 20743
2005-03-21 20:31:29 +00:00
Chris Lattner d90f5bab82 make this const correct
llvm-svn: 20741
2005-03-21 20:28:50 +00:00
Chris Lattner 040426aee0 Fix a major problem where we didn't add call graph edges for call sites with
more than 1 callee.  This fixes Analysis/DSGraph/FunctionPointerTable-const.ll

llvm-svn: 20740
2005-03-21 20:20:49 +00:00
Chris Lattner e8a43291cd Ugh, for some reason, I can't call this unless the reference is const!?!?!?
llvm-svn: 20732
2005-03-21 10:00:45 +00:00
Chris Lattner 13429dc5af The reachability cloner should add arguments to merged calls when the RHS of
the merge has more operands than the LHS.

llvm-svn: 20731
2005-03-21 09:39:51 +00:00
Chris Lattner 7269f15e8f 'note to self'
llvm-svn: 20727
2005-03-21 08:43:32 +00:00
Chris Lattner 98f7e1c370 Change the way that the TD pass inlines graphs. Instead of inlining each
graph into all of the functions it calls when we visit a graph, change it so
that the graph visitor inlines all of the callers of a graph into the current
graph when it visits it.

While we're at it, inline global information from the GG instead of from each
of the callers.  The GG contains a superset of the info that the callers do
anyway, and this way we only need to do it one time (not one for each caller).

This speeds up the TD pass substantially on several programs, and there is
still room for improvement.  For example, the TD pass used to take 147s
on perlbmk, it now takes 36s.  On povray, we went from about 5s to 1.97s.
134.perl is down from ~1s for Loc+BU+TD to .6s.

The TD pass needs a lot of improvement though, which will occur with later
patches.

llvm-svn: 20723
2005-03-21 04:55:35 +00:00
Chris Lattner c5cdc2260d Don't strip modref bits when inlining down the call graph. This fixes
the DSGraph/2003-06-30-TopDownResolve.ll regression from last night.

llvm-svn: 20717
2005-03-20 18:02:56 +00:00
Chris Lattner 21ef7678d6 Remove the ability to keep track of inlined globals, which is always dead.
llvm-svn: 20716
2005-03-20 04:30:30 +00:00
Chris Lattner 571c62a008 This call is always a noop, remove it.
llvm-svn: 20714
2005-03-20 04:29:54 +00:00
Chris Lattner b1cabb6541 remove some pointless asserts
llvm-svn: 20713
2005-03-20 04:29:39 +00:00
Chris Lattner ded489ec3b -steens doesn't use the inlined globals facility.
llvm-svn: 20712
2005-03-20 04:23:57 +00:00
Chris Lattner ff634f4e32 Build EC's for globals twice. The first is after constructing the initial
Globals Graph for the local pass, the second is after all of the locals
graphs have been constructed.  This allows for many additional global EC's
to be recognized that weren't before.  This speeds up analysis of programs
like 177.mesa, where it changes DSA from taking 0.712s to 0.4018s.

llvm-svn: 20711
2005-03-20 03:32:35 +00:00
Chris Lattner 36a810ac40 Add a new DSNode::removeGlobal method.
llvm-svn: 20710
2005-03-20 03:29:54 +00:00
Chris Lattner 5ae215248f Transform BU pass to not use the horrible DSCallSiteIterator class.
llvm-svn: 20708
2005-03-20 02:42:07 +00:00
Chris Lattner a550a5b173 Implement new methods for dealing with DSNode global lists, rename uses of
old methods.

llvm-svn: 20707
2005-03-20 02:41:38 +00:00
Chris Lattner e68e808bcd use simpler methods.
llvm-svn: 20706
2005-03-20 02:41:16 +00:00
Chris Lattner 1ffdd57e0a method was renamed.
llvm-svn: 20705
2005-03-20 02:40:27 +00:00
Chris Lattner 5635a88fcb print out equiv class info.
llvm-svn: 20704
2005-03-20 02:40:11 +00:00
Chris Lattner e7a8e8677e some methods got renamed
llvm-svn: 20703
2005-03-20 02:40:04 +00:00
Chris Lattner 711e083c26 Make use of simpler DSNode methods.
llvm-svn: 20702
2005-03-20 02:39:49 +00:00
Chris Lattner 61f3befdc8 #ifdef out a function only used by #ifdef'd code.
llvm-svn: 20700
2005-03-20 02:14:15 +00:00
Chris Lattner e965bd16bb comment cleanup
llvm-svn: 20699
2005-03-20 01:18:00 +00:00
Chris Lattner 9379e69af9 Create an equivalence class of global variables that DSA will never be able
to tell apart anyway, and only track the leader for of these equivalence
classes in our graphs.

This dramatically reduces the number of GlobalValue*'s that appear in scalar
maps, which A) reduces memory usage, by eliminating many many scalarmap entries
and B) reduces time for operations that need to execute an operation for each
global in the scalar map.

As an example, this reduces the memory used to analyze 176.gcc from 1GB to
511MB, which (while it's still way too much) is better because it doesn't hit
swap anymore.  On eon, this shrinks the local graphs from 14MB to 6.8MB,
shrinks the bu+td graphs of povray from 50M to 40M, shrinks the TD graphs of
130.li from 8.8M to 3.6M, etc.

This change also speeds up DSA on large programs where this makes a big
difference.  For example, 130.li goes from 1.17s -> 0.56s, 134.perl goes
from 2.14 -> 0.93s, povray goes from 15.63s->7.99s (!!!).

This also apparently either fixes the problem that caused DSA to crash on
perlbmk and gcc, or it hides it, because DSA now works on these.  These
both take entirely too much time in the TD pass (147s for perl, 538s for
gcc, vs 7.67/5.9s in the bu pass for either one), but this is a known
problem that I'll deal with later.

llvm-svn: 20696
2005-03-19 22:23:45 +00:00
Chris Lattner c1b9b56a2c Switch to use the new interface for the EquivalenceClasses class, and fix
a bug involving SCC's who have multiple members that are part of an EC.

llvm-svn: 20678
2005-03-19 05:15:27 +00:00
Chris Lattner bed1c18a44 do not bother inlining nullary functions without return values. The only
effect these calls can have is due to global variables, and these passes
all use the globals graph to capture their effect anyway.  This speeds up
the BU pass very slightly on perlbmk, reducing the number of dsnodes
allocated from 98913 to 96423.

llvm-svn: 20676
2005-03-18 23:19:47 +00:00
Chris Lattner 30525a04c1 fix a bogus assertion
llvm-svn: 20675
2005-03-18 23:18:30 +00:00
Chris Lattner 5bd948b4d7 another fastpath
llvm-svn: 20674
2005-03-18 23:18:20 +00:00
Chris Lattner e29503a805 expose this pass to both opt and analyze
llvm-svn: 20672
2005-03-18 05:27:57 +00:00
Chris Lattner a8e1a5250a remove a bogus optimization. This only works if there are no globals in the
graph, and the combination of a function that does not reference globals, takes
not arguments and returns no value is pretty rare.

llvm-svn: 20670
2005-03-18 00:23:59 +00:00
Chris Lattner 3f181d7880 Rewrite DSAA::getModRefInfo to compute the mapping between caller and callee
to determine mod/ref behavior, instead of creating a *copy* of the caller
graph and inlining the callee graph into the copy.

This speeds up aa-eval on Ptrdist/yacr2 from 109.13s to 3.98s, and gives
identical results.  The speedup is similar on other programs.

llvm-svn: 20669
2005-03-18 00:21:03 +00:00
Chris Lattner b8d85c1a74 implement a new method.
llvm-svn: 20668
2005-03-17 23:45:54 +00:00
Chris Lattner 488a80a292 add some possibly bogus assertions.
llvm-svn: 20665
2005-03-17 20:33:27 +00:00
Chris Lattner 9c9f68c42f Do not include the Function* for direct call/invoke instructions in the
alias evaluation.  Clients really don't care.

llvm-svn: 20664
2005-03-17 20:25:04 +00:00
Chris Lattner b5525529bd simplify this function a bit, allow DS-AA to build on/improve the mod/ref
results returned by AA, not just use one or the other.

llvm-svn: 20662
2005-03-17 20:16:58 +00:00
Chris Lattner 8dd1491e71 Clean up some code, handle null pointer specially to avoid an assertion
llvm-svn: 20660
2005-03-17 19:56:56 +00:00
Chris Lattner ea7e6548dc Two changes:
1. Chain to the parent implementation of M/R analysis if we can't find
     any information.  It has some heuristics that often do well.
  2. Do not clear all flags, this can make invalid nodes by turning nodes
     that used to be collapsed into non-collapsed nodes (fixing crashes)

llvm-svn: 20659
2005-03-17 19:56:18 +00:00
Chris Lattner 7b9020a059 Fix the missing symbols problem Bill was hitting. Patch contributed by
Bill Wendling!!

llvm-svn: 20649
2005-03-17 15:38:16 +00:00
Chris Lattner 5251047abd Do not create ridiculously huge DSNodes, as described in the comments.
This speeds up the BU pass on 172.mgrid from 62.3 -> 0.1242s.

llvm-svn: 20648
2005-03-17 05:25:34 +00:00
Chris Lattner 62462c2314 remove use of compat_iterator.
llvm-svn: 20643
2005-03-16 22:42:19 +00:00
Chris Lattner f901355379 make sure to mark nodes in the globals graph incomplete after computing it
so that external globals (and whatever they point to) are marked incomplete.

llvm-svn: 20628
2005-03-15 22:47:18 +00:00
Chris Lattner 21a79edb27 fix crashes when we only have a prototype for main.
llvm-svn: 20627
2005-03-15 22:10:04 +00:00
Chris Lattner dadf4b369e Fix a crash that happens when mapping something like this:
{ short, short }

to
  short

where the second short maps onto the second field of the first struct.  In
this case, the struct index is not aligned, so we should avoid calling
getLink(2), which asserts out.

llvm-svn: 20626
2005-03-15 21:36:50 +00:00
Chris Lattner dd3fb83f32 Make computeGGToGMapping compute an invnodemap
llvm-svn: 20622
2005-03-15 17:52:18 +00:00
Chris Lattner d31a3d0e82 Finally fix (the right way) the problem where functions like this:
void foo() {
  G = 1;
}

would have an empty DSGraph even though G (a global) is directly used
in the function.

llvm-svn: 20619
2005-03-15 17:14:09 +00:00
Chris Lattner 92d0c1c1ba Start using retnodes_* for iteration.
llvm-svn: 20618
2005-03-15 16:55:04 +00:00
Chris Lattner 451fa32685 avoid varialbe name collisions
llvm-svn: 20606
2005-03-15 06:29:12 +00:00
Chris Lattner 531f9e92d4 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!

llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner 28f1caa639 Don't crash if computing a mapping to a node with zero size
llvm-svn: 20595
2005-03-15 04:40:24 +00:00
Chris Lattner 26415d7432 rename method, add counterpart
llvm-svn: 20593
2005-03-15 00:58:16 +00:00
Chris Lattner 1bdb8b7e7e add a method to compute a commonly used mapping.
llvm-svn: 20588
2005-03-14 19:22:47 +00:00
Chris Lattner 9071175625 regardless of whether or not the client things we should mark globals incomplete,
ALWAYS mark them incomplete if they are external!

llvm-svn: 20586
2005-03-13 20:36:01 +00:00
Chris Lattner b9e2a4dec0 Make sure to remove incomplete markers before we add to them! :)
llvm-svn: 20585
2005-03-13 20:32:26 +00:00
Chris Lattner 5a6609771a The incoming arguments to main (the argv list) are not complete!
llvm-svn: 20584
2005-03-13 20:22:10 +00:00
Chris Lattner 2eff970892 After finishing BU analysis, move all global variables from the globals
graph into main and mark them complete.

llvm-svn: 20583
2005-03-13 20:15:06 +00:00
Chris Lattner 68c3caccb1 ADd support for printing eqgraphs.
llvm-svn: 20582
2005-03-13 19:51:24 +00:00
Chris Lattner 9cc2c3e9d6 Replace linear search with logrithmic one.
llvm-svn: 20580
2005-03-13 19:05:05 +00:00
Chris Lattner 97ac0a8780 make sure to mark nodes returned from functions as incomplete
llvm-svn: 20576
2005-03-12 14:58:28 +00:00
Chris Lattner dd6bcbe820 remove this from the PA namespace, leaving it in the llvm ns
llvm-svn: 20574
2005-03-12 12:08:52 +00:00
Chris Lattner 2dd9a09837 Move this from the pool allocator project to here, where it logically belongs.
llvm-svn: 20570
2005-03-12 11:51:30 +00:00
Chris Lattner 562c180879 Fix Regression/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll, a miscompilation
that Alkis found with Java, thanks Alkis!

llvm-svn: 20531
2005-03-09 16:29:52 +00:00
Chris Lattner adb043c2d8 Export two methods for getting -X and A-B.
llvm-svn: 20527
2005-03-09 05:34:41 +00:00
Chris Lattner 7c832fb0b2 Make sure the two arguments of a setcc instruction point to the same node.
llvm-svn: 20462
2005-03-05 19:04:31 +00:00
Chris Lattner c01e2f76c3 Trivial cleanup patch
llvm-svn: 20436
2005-03-04 20:27:46 +00:00
Chris Lattner dc166eb8f7 Fix spelling, patch contributed by Gabor Greif
llvm-svn: 20342
2005-02-27 06:15:51 +00:00
Chris Lattner 0b0f3520cb DCE a dead function
llvm-svn: 20339
2005-02-26 23:36:45 +00:00
Chris Lattner f05d2b3178 1 + 100 + 51 == 152, not 52.
If we fold three constants together (c1+c2+c3), make sure to keep
LHSC updated, instead of reusing (in this case), the 1 instead of the
partial sum.

llvm-svn: 20337
2005-02-26 18:50:19 +00:00
Chris Lattner e99ee2b35d Handle null a bit more carefully.
Actually teach dsa about select instructions.  This doesn't affect the
graph in any way other than not setting a spurious U marker on pointer
nodes that are selected.

llvm-svn: 20324
2005-02-25 01:27:48 +00:00
Chris Lattner 468fd33abb This instruction:
X = gep null, ...

Used to not create a scalar map entry for X, which caused clients to barf.
This is bad.

llvm-svn: 20316
2005-02-24 19:55:31 +00:00
Chris Lattner d13cc49e19 Fix a bug introduced by revision 1.187 of this file.
llvm-svn: 20308
2005-02-24 18:48:07 +00:00
Chris Lattner 3166471603 Remove use of bind_obj, deleter, and finegrainify namespacification.
llvm-svn: 20277
2005-02-22 23:27:21 +00:00
Chris Lattner 47555decfb Scary typo that fixes Regression/Transforms/IndVarsSimplify/2005-02-17-TruncateExprCrash.ll
and PR515.

llvm-svn: 20224
2005-02-17 16:54:16 +00:00
Chris Lattner 3e708301d2 Add a sanity check.
llvm-svn: 20195
2005-02-15 18:48:48 +00:00
Chris Lattner 219002ed8f Add a new method to make it easy to update graphs.
llvm-svn: 20194
2005-02-15 18:40:55 +00:00
Chris Lattner 7b0fbe7ccf Correct the recursive PHI node handling routines in a way that CANNOT induce
infinite loops (using the new replaceSymbolicValuesWithConcrete method).

This patch reverts this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050131/023830.html

... which was an attempted fix for this problem.  Unfortunately, that patch
caused test/Regression/Transforms/IndVarsSimplify/exit_value_tests.llx to fail
and slightly castrated the entire analysis.  This patch fixes it right.

This patch is dedicated to jeffc, for making me deal with this.  :)

llvm-svn: 20146
2005-02-13 04:37:18 +00:00
Chris Lattner 5ce5a094aa Use new edge iterators to simplify some code.
llvm-svn: 20086
2005-02-09 03:20:43 +00:00
Chris Lattner 863d9c9068 IndCallGraphMap is now a pointer to a new'd map.
llvm-svn: 20065
2005-02-07 16:09:15 +00:00