1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

1259 Commits

Author SHA1 Message Date
Chris Lattner
2a3687ecb0 use simpler methods.
llvm-svn: 20706
2005-03-20 02:41:16 +00:00
Chris Lattner
dddb514aa9 method was renamed.
llvm-svn: 20705
2005-03-20 02:40:27 +00:00
Chris Lattner
4c11b8e07d print out equiv class info.
llvm-svn: 20704
2005-03-20 02:40:11 +00:00
Chris Lattner
73ae41b317 some methods got renamed
llvm-svn: 20703
2005-03-20 02:40:04 +00:00
Chris Lattner
da7b948969 Make use of simpler DSNode methods.
llvm-svn: 20702
2005-03-20 02:39:49 +00:00
Chris Lattner
51f7c8a068 #ifdef out a function only used by #ifdef'd code.
llvm-svn: 20700
2005-03-20 02:14:15 +00:00
Chris Lattner
904a0ddcc5 comment cleanup
llvm-svn: 20699
2005-03-20 01:18:00 +00:00
Chris Lattner
f17cd879c0 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
773569df86 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
54b0239649 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
a9f266472f fix a bogus assertion
llvm-svn: 20675
2005-03-18 23:18:30 +00:00
Chris Lattner
1ebf12b477 another fastpath
llvm-svn: 20674
2005-03-18 23:18:20 +00:00
Chris Lattner
7a4832c53a expose this pass to both opt and analyze
llvm-svn: 20672
2005-03-18 05:27:57 +00:00
Chris Lattner
c2d54235d7 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
57989f2b9a 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
a7e0e70f53 implement a new method.
llvm-svn: 20668
2005-03-17 23:45:54 +00:00
Chris Lattner
be0eb11431 add some possibly bogus assertions.
llvm-svn: 20665
2005-03-17 20:33:27 +00:00
Chris Lattner
097c55f578 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
5368664b75 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
430c826ae1 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
44cbb1f79f 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
c9a3ea81bf 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
1a8b3193af 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
46930f8df5 remove use of compat_iterator.
llvm-svn: 20643
2005-03-16 22:42:19 +00:00
Chris Lattner
b40e34bd44 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
cece5dd244 fix crashes when we only have a prototype for main.
llvm-svn: 20627
2005-03-15 22:10:04 +00:00
Chris Lattner
9802eb4351 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
ca69a3542e Make computeGGToGMapping compute an invnodemap
llvm-svn: 20622
2005-03-15 17:52:18 +00:00
Chris Lattner
5eeae726e3 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
f4c515e54a Start using retnodes_* for iteration.
llvm-svn: 20618
2005-03-15 16:55:04 +00:00
Chris Lattner
7277bd8606 avoid varialbe name collisions
llvm-svn: 20606
2005-03-15 06:29:12 +00:00
Chris Lattner
4b688a1c70 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
02d1cf3df0 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
5b39119085 rename method, add counterpart
llvm-svn: 20593
2005-03-15 00:58:16 +00:00
Chris Lattner
751bada498 add a method to compute a commonly used mapping.
llvm-svn: 20588
2005-03-14 19:22:47 +00:00
Chris Lattner
65fc185896 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
361e6704b4 Make sure to remove incomplete markers before we add to them! :)
llvm-svn: 20585
2005-03-13 20:32:26 +00:00
Chris Lattner
faf51a28e7 The incoming arguments to main (the argv list) are not complete!
llvm-svn: 20584
2005-03-13 20:22:10 +00:00
Chris Lattner
cd69084e0e 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
a1c07236db ADd support for printing eqgraphs.
llvm-svn: 20582
2005-03-13 19:51:24 +00:00
Chris Lattner
55e0a19572 Replace linear search with logrithmic one.
llvm-svn: 20580
2005-03-13 19:05:05 +00:00
Chris Lattner
9e6d9d0b72 make sure to mark nodes returned from functions as incomplete
llvm-svn: 20576
2005-03-12 14:58:28 +00:00
Chris Lattner
a4bd8bd9b0 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
848760c21f 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
30ac52c4b4 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
4d755dc735 Export two methods for getting -X and A-B.
llvm-svn: 20527
2005-03-09 05:34:41 +00:00
Chris Lattner
05e4fe5ef3 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
0864ad52d4 Trivial cleanup patch
llvm-svn: 20436
2005-03-04 20:27:46 +00:00
Chris Lattner
cf3862ce8d Fix spelling, patch contributed by Gabor Greif
llvm-svn: 20342
2005-02-27 06:15:51 +00:00
Chris Lattner
2311dcd08d DCE a dead function
llvm-svn: 20339
2005-02-26 23:36:45 +00:00
Chris Lattner
cf3cda8125 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
9340ba4bf9 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
16f321bbe7 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
085b39c9e0 Fix a bug introduced by revision 1.187 of this file.
llvm-svn: 20308
2005-02-24 18:48:07 +00:00
Chris Lattner
1969249f13 Remove use of bind_obj, deleter, and finegrainify namespacification.
llvm-svn: 20277
2005-02-22 23:27:21 +00:00
Chris Lattner
2198bb53ee 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
c5646b3a15 Add a sanity check.
llvm-svn: 20195
2005-02-15 18:48:48 +00:00
Chris Lattner
e7d2b05fb0 Add a new method to make it easy to update graphs.
llvm-svn: 20194
2005-02-15 18:40:55 +00:00
Chris Lattner
63d47e902f 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
82ef7e89fd Use new edge iterators to simplify some code.
llvm-svn: 20086
2005-02-09 03:20:43 +00:00
Chris Lattner
bfd643f504 IndCallGraphMap is now a pointer to a new'd map.
llvm-svn: 20065
2005-02-07 16:09:15 +00:00
Chris Lattner
43b0441ccb If we have an indirect call site that calls N functions, inline the N functions
into a temporary graph, remember it for later, then inline the tmp graph into
the call site.

In the case where there are other call sites to the same set of functions, this
permits us to just inline the temporary graph instead of all of the callees.

This turns N*M inlining situations into an N+M inlining situation.

llvm-svn: 20036
2005-02-04 19:59:49 +00:00
Chris Lattner
5f8b7b03b0 Split mergeInGraph into two methods.
llvm-svn: 20035
2005-02-04 19:58:28 +00:00
Chris Lattner
48828f062c Fix the Regression/Transforms/DSAnalysis/recursion.ll regression.
llvm-svn: 20031
2005-02-04 18:58:04 +00:00
Chris Lattner
15151dbff8 Refactor getFunctionArgumentsForCall out of mergeInGraph.
llvm-svn: 20018
2005-02-03 18:40:25 +00:00
Chris Lattner
56e08cc9a3 Eliminate some duplicated debug code
llvm-svn: 19980
2005-02-01 21:55:40 +00:00
Chris Lattner
57cdba4154 Eliminate self-recursion as a special case.
llvm-svn: 19979
2005-02-01 21:49:43 +00:00
Chris Lattner
b35595d4c0 Eliminate use of DSCallSiteIterator in key loop. This is a half step to
a tasty speedup.

llvm-svn: 19978
2005-02-01 21:37:27 +00:00
Chris Lattner
028a8a8f56 Signficantly speed up printing by not emitting the same file twice with
different names.  Large SCC's tend to be big, so this saves a lot of time.

llvm-svn: 19970
2005-02-01 19:10:48 +00:00
Chris Lattner
26d4a4b2d2 Do not revisit nodes in the SCC traversal. This speeds up the BU pass a bit.
llvm-svn: 19968
2005-02-01 17:35:52 +00:00
Chris Lattner
d9b3839cec Fix a problem where we could infinitely recurse on phi nodes.
llvm-svn: 19955
2005-02-01 00:18:30 +00:00
Chris Lattner
11a25d99d7 Rename variables to work with VC++'s hokey scoping rules.
llvm-svn: 19942
2005-01-31 00:10:58 +00:00
Chris Lattner
86f89c506f Fix some scary bugs that VC++ detected.
llvm-svn: 19941
2005-01-31 00:10:45 +00:00
Chris Lattner
ee6bc42f3e * Make some methods more const correct.
* Change the FunctionCalls and AuxFunctionCalls vectors into std::lists.
  This makes many operations on these lists much more natural, and avoids
  *exteremely* expensive copying of DSCallSites (e.g. moving nodes around
  between lists, erasing a node from not the end of the vector, etc).

With a profile build of analyze, this speeds up BU DS from 25.14s to
12.59s on 176.gcc.  I expect that it would help TD even more, but I don't
have data for it.

This effectively eliminates removeIdenticalCalls and children from the
profile, going from 6.53 to 0.27s.

llvm-svn: 19939
2005-01-30 23:51:02 +00:00
Chris Lattner
703dfdda2a Due to previous simplifications, we can simplify the data structures being
used here.

llvm-svn: 19913
2005-01-29 07:04:10 +00:00
Chris Lattner
0823ac4234 Properly handle volatile.
llvm-svn: 19912
2005-01-29 06:42:34 +00:00
Chris Lattner
8df4ba51b4 Remove some useless map operations. Loads/stores that are in the same
BB as the load are not included in the Cand* sets at all.

llvm-svn: 19911
2005-01-29 06:39:25 +00:00
Chris Lattner
af286e3600 Before doing expensive global analysis, check to make sure the pointer is
not invalidated on entry and on exit of the block.  This fixes some N^2
behavior in common cases, and speeds up gcc another 5% to 22.35s.

llvm-svn: 19910
2005-01-29 06:31:53 +00:00
Chris Lattner
43ccc5c945 Minor simplification/speedup. Replaces a set lookup with a pointer comparison.
This speeds up 176.gcc from 25.73s to 23.48s, which is 9.5%

llvm-svn: 19907
2005-01-29 06:20:55 +00:00
Chris Lattner
ae8d4bb675 Eliminate generality that is not buying us anything. In particular, this
will cause us to miss cases where the input pointer to a load could be value
numbered to another load.  Something like this:


  %X = load int* %P1
  %Y = load int* %P2

Those are obviously the same if P1/P2 are the same.  The code this patch
removes attempts to handle that.  However, since GCSE iterates, this doesn't
actually buy us anything: GCSE will first replace P1 or P2 with the other
one, then the load can be value numbered as equal.

Removing this code speeds up gcse a lot.  On 176.gcc in debug mode, this
speeds up gcse from 29.08s -> 25.73s, a 13% savings.

llvm-svn: 19906
2005-01-29 06:11:16 +00:00
Chris Lattner
68d73bed4a If we see:
%A = alloca int
  %V = load int* %A

value number %V to undef, not 0.

llvm-svn: 19905
2005-01-29 05:57:01 +00:00
Chris Lattner
fadcc07232 Remove this code as it is currently completely broken and unmaintained.
If needed, this can be resurrected from CVS.

Note that several of the interfaces (e.g. the IPModRef ones) are supersumed
by generic AliasAnalysis interfaces that have been written since this code
was developed (and they are not DSA specific).

llvm-svn: 19864
2005-01-28 06:12:46 +00:00
Chris Lattner
f03b87704f Make -ds-aa more useful, allowing it to be updated as xforms hack on the program.
llvm-svn: 19818
2005-01-24 20:00:14 +00:00
Chris Lattner
c9b64b9749 Silence VC++ warnings.
llvm-svn: 19506
2005-01-12 04:51:37 +00:00
Jeff Cohen
a7f1ae5dc0 Apply feed back from Chris:
1. Rename createLoaderPass to CreateProfileLoaderPass
  2. Opt shouldn't use the pass registered in CodeGen.

llvm-svn: 19431
2005-01-10 03:56:27 +00:00
Jeff Cohen
f692cd303d Add last four createXxxPass functions
llvm-svn: 19424
2005-01-09 20:42:52 +00:00
Jeff Cohen
6827f061cc Get lib/Analysis/DataStructure to compile with VC++
llvm-svn: 19412
2005-01-09 04:18:28 +00:00
Jeff Cohen
6c0db8d863 Add even more missing createXxxPass functions.
llvm-svn: 19402
2005-01-08 22:01:16 +00:00
Misha Brukman
0424fc40fa Wrap at 80 cols
llvm-svn: 19121
2004-12-23 21:17:41 +00:00
Reid Spencer
351a3efea1 Try to speed up gccld hot spot in BasicVN::getEqualNumberNodes by making
a function call at the core of the loop inline and removing unused
stack variables from an often called function. This doesn't improve things
much, the real saving will be by reducing the number of calls to this
function (100K+ when linking kimwitu++).

llvm-svn: 19119
2004-12-23 21:13:26 +00:00
Chris Lattner
a2afb3775e Actually overload the virtual method. This fixes
Regression/Analysis/GlobalsModRef/purecse.ll.  Isn't this what the
-Woverload-whatever flag would warn about :)

llvm-svn: 19018
2004-12-17 17:12:24 +00:00
Chris Lattner
be18a7e20a Eliminate a virtual method call
llvm-svn: 18964
2004-12-15 18:14:04 +00:00
Chris Lattner
6fe0ea70e2 Fix a bug in -no-aa that caused two DSGraph tests to XPASS.
llvm-svn: 18962
2004-12-15 17:13:24 +00:00
Chris Lattner
8139749984 Adjust to new alias analysis interfaces
llvm-svn: 18957
2004-12-15 07:22:13 +00:00
Alkis Evlogimenos
8547388d22 Add testcase and fix for yet another case where we query the size an
abstract type.

llvm-svn: 18678
2004-12-08 23:56:15 +00:00
Alkis Evlogimenos
b00f884344 Add testcase and fix for another case where we query the size an
abstract type.

llvm-svn: 18676
2004-12-08 23:42:11 +00:00
Chris Lattner
31ba7367aa Move method out of line for better ICC support
Add some ifdefs for some stuff I like to be able to toggle easily

llvm-svn: 18665
2004-12-08 21:03:56 +00:00
Chris Lattner
458286d514 Properly extern this.
llvm-svn: 18664
2004-12-08 21:00:59 +00:00
Chris Lattner
6ebc142507 Work correctly with ICC, Patch contributed by Bjørn Wennberg
llvm-svn: 18630
2004-12-08 16:22:26 +00:00
Reid Spencer
d0d846cd06 For PR387:\
Add getModRefInfo method to avoid overloaded virtuals

llvm-svn: 18601
2004-12-07 08:11:24 +00:00
Reid Spencer
d50c86f078 For PR387:\
Make only one print method to avoid overloaded virtual warnings when \
compiled with -Woverloaded-virtual

llvm-svn: 18589
2004-12-07 04:03:45 +00:00
Chris Lattner
17ebff094f This patch prevents an infinite recursion while compiling 103.su2cor.
All SPEC CFP 95 programs now work, though the JIT isn't loading -lf2c right
so they aren't testing correctly.

llvm-svn: 18499
2004-12-04 20:54:32 +00:00
Chris Lattner
e65724d6eb Fix DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll
llvm-svn: 18308
2004-11-28 20:30:15 +00:00
Chris Lattner
3c35e1e02b When merging to alias sets, if they are both must alias, the result is not
a must alias set unless all of the pointers in the resultant set are must
aliased together.

llvm-svn: 18275
2004-11-27 18:37:42 +00:00
Chris Lattner
ab36efe42b Add a new interface
llvm-svn: 18266
2004-11-26 21:36:25 +00:00
Chris Lattner
fca424bb51 When evaluating an AA, pass in size info
llvm-svn: 18264
2004-11-26 21:05:39 +00:00
Chris Lattner
aecb6daf08 The trick with globals actually works with allocas and malloc too
llvm-svn: 18262
2004-11-26 20:01:48 +00:00
Chris Lattner
e076e608d8 A store or load cannot alias a global if the accessed amount is larger then
the global.

This implements Regression/Analysis/BasicAA/global-size.ll

llvm-svn: 18261
2004-11-26 19:20:01 +00:00
Chris Lattner
598ab60438 Mission accomplished!
llvm-svn: 17990
2004-11-19 16:22:24 +00:00
Chris Lattner
bd02c10b87 Simplify conditional and fix LICM/2004-11-17-UndefIndexCrash.ll
by saying what we mean

llvm-svn: 17913
2004-11-17 17:39:39 +00:00
Reid Spencer
cdc0b6d962 Standardize on 'class' instead of 'struct'. Gets rid of warnings in VC++
Patch contributed by Jeff Cohen.

llvm-svn: 17889
2004-11-16 06:58:55 +00:00
Chris Lattner
0efef015fa Fix a bug that was preventing povray and namd from pool allocating correctly.
llvm-svn: 17632
2004-11-08 21:08:46 +00:00
Chris Lattner
dcee21898f Handle assert_fail special
llvm-svn: 17631
2004-11-08 21:08:28 +00:00
Chris Lattner
9f23af6d68 Remove dead var
llvm-svn: 17485
2004-11-05 04:52:08 +00:00
Chris Lattner
3b6d1045d3 Don't call Constant::getNullValue when the argument could be VoidTy
llvm-svn: 17457
2004-11-03 18:51:26 +00:00
Chris Lattner
8572d582cf Fix comment
llvm-svn: 17377
2004-10-31 21:54:51 +00:00
Chris Lattner
d72b6b1e77 Improve comment
llvm-svn: 17375
2004-10-31 19:57:43 +00:00
Chris Lattner
14d85c9b09 Add more paranoid assertions :)
llvm-svn: 17367
2004-10-31 17:45:40 +00:00
Chris Lattner
29b6259de3 Fix some more problems where we called getOffset before getNode()
llvm-svn: 17358
2004-10-30 07:21:19 +00:00
Chris Lattner
4b741eab69 Fix three bugs:
1. Calls to external global VARIABLES should not be treated as a call to an
    external function
 2. Efficiently deleting an element from a vector by using std::swap with
    the back, then pop_back is NOT a good way to keep the vector sorted.
 3. Our hope of having stuff get deleted by making them redundant just won't
    work.  In particular, if we have three calls in sequence that should be
    merged: A, B, C   first we unify B into A.  To be sure that they appeared
    identical (so B would be erased) we set B = A.  On the next step, we
    unified C into A and set C = A.  Unfortunately, this is no guarantee that
    C = B, so we would fail to delete the dead call.  Switch to a more
    explicit scheme.

llvm-svn: 17357
2004-10-30 05:41:23 +00:00
Chris Lattner
14dfc01ad5 Fix more undefined behavior
llvm-svn: 17356
2004-10-30 04:22:45 +00:00
Chris Lattner
c17cd85776 * Add a method
* change some uses of NH.getNode() in a bool context to use !NH.isNull()
* Fix a bunch of places where we depended on the (undefined) order of
  evaluation of arguments to function calls to ensure that getNode() was
  called before getOffset().  In practice, this was NOT happening.

llvm-svn: 17354
2004-10-30 04:05:01 +00:00
Alkis Evlogimenos
1162280a0d Fix library name.
llvm-svn: 17306
2004-10-28 05:36:48 +00:00
Reid Spencer
d3f7233495 Change Library Names Not To Conflict With Others When Installed
llvm-svn: 17286
2004-10-27 23:18:45 +00:00
Chris Lattner
dd0094e4ed Convert 'struct' to 'class' in various places to adhere to the coding standards
and work better with VC++.  Patch contributed by Morten Ofstad!

llvm-svn: 17281
2004-10-27 16:14:51 +00:00
Chris Lattner
3a79669263 add support for UndefValue
llvm-svn: 17260
2004-10-26 16:23:03 +00:00
Chris Lattner
1cef20bac1 Patch to support MSVC, contributed by Morten Ofstad
llvm-svn: 17214
2004-10-25 18:40:08 +00:00
Reid Spencer
e48ba34fd4 We won't use automake
llvm-svn: 17155
2004-10-22 03:35:04 +00:00
Reid Spencer
ce514b1c2c Initial automake generated Makefile template
llvm-svn: 17136
2004-10-18 23:55:41 +00:00
Chris Lattner
2fae8a1ef9 Add support for unreachable
llvm-svn: 17056
2004-10-16 18:21:33 +00:00
Chris Lattner
8d479b62ad Add support for undef
llvm-svn: 17055
2004-10-16 18:19:26 +00:00
Chris Lattner
cbdf19fed2 Add support
llvm-svn: 17052
2004-10-16 18:16:19 +00:00
Chris Lattner
b3a86dc93f Be more careful about looking for constants when we really want constantint's.
llvm-svn: 17029
2004-10-16 16:07:10 +00:00
Chris Lattner
3fc5e3778f Do not use the same variable name for two different variables in the
same scope.  This confused VC++ (and probably people too!).  Patch by
Morten Ofstad!

llvm-svn: 16985
2004-10-14 14:59:16 +00:00
Reid Spencer
e6418ec30f Update to reflect changes in Makefile rules.
llvm-svn: 16950
2004-10-13 11:46:52 +00:00
Chris Lattner
6b6e5a5815 This nutty patch has been in my tree since before 1.3 went out, and it needs
to go in.  This patch allows us to compute the trip count of loops controlled
by values loaded from constant arrays.  The cannonnical example of this is
strlen when passed a constant argument:

for (int i = 0; "constantstring"[i]; ++i) ;
return i;

In this case, it will compute that the loop executes 14 times, which means
that the exit value of i is 14.  Because of this, the loop gets DCE'd and
we are happy.  This also applies to anything that does similar things, e.g.
loops like this:

  const float Array[] = { 0.1, 2.1, 3.2, 23.21 };
  for (int i = 0; Array[i] < 20; ++i)

and is actually fairly general.

The problem with this is that it almost never triggers.  The reason is that
we run indvars and the loop optimizer only at compile time, which is before
things like strlen and strcpy have been inlined into the program from libc.
Because of this, it almost never is used (it triggers twice in specint2k).

I'm committing it because it DOES work, may be useful in the future, and
doesn't slow us down at all.  If/when we start running the loop optimizer
at link-time (-O4?) this will be very nice indeed :)

llvm-svn: 16926
2004-10-12 01:49:27 +00:00
Chris Lattner
f8dab00902 Fix SingleSource/Benchmarks/McGill/chomp
llvm-svn: 16912
2004-10-11 04:07:27 +00:00
Reid Spencer
bc135b067a Build both archive and relinked objects
llvm-svn: 16892
2004-10-10 22:17:39 +00:00
Reid Spencer
7d9cba7a0f Initial version of automake Makefile.am file.
llvm-svn: 16885
2004-10-10 20:43:57 +00:00
Chris Lattner
d15e144241 Fix a nasty dangling pointer problem, due to a free'd pointer being left in
a map.  This caused problems if a later object happened to be allocated at
the free'd object's address.

llvm-svn: 16813
2004-10-07 20:01:31 +00:00
Chris Lattner
e412d10cc0 Dont' let null nodes sneak past cast instructions
llvm-svn: 16779
2004-10-06 19:29:13 +00:00
Chris Lattner
43c0372c0b 'Pass' should now not be derived from by clients. Instead, they should derive
from ModulePass.  Instead of implementing Pass::run, then should implement
ModulePass::runOnModule.

llvm-svn: 16436
2004-09-20 04:48:05 +00:00
Chris Lattner
01bbefa96c Finegrainify namespacification
'Pass' should now not be derived from by clients.  Instead, they should derive
from ModulePass.  Instead of implementing Pass::run, then should implement
ModulePass::runOnModule.

llvm-svn: 16434
2004-09-20 04:44:31 +00:00
Chris Lattner
e6755fe307 Fix a nasty iterator invalidation problem I introduced yesterday. This
unfortunately is the cause of a bunch of failures from tonight, and the
reason the tester is running so slow :(

llvm-svn: 16407
2004-09-19 19:01:06 +00:00
Chris Lattner
110bbafcf7 Add CallGraphNode::removeAnyCallEdgeTo method
llvm-svn: 16398
2004-09-18 21:34:34 +00:00
Chris Lattner
53dea1ce37 When changing a function, make sure to update the CallGraphNode for the
function, not just the CallGraph.

llvm-svn: 16388
2004-09-18 00:27:20 +00:00
Chris Lattner
a9b80a3258 Implement new changeFunction method, nuke a never implemented one.
llvm-svn: 16386
2004-09-18 00:22:13 +00:00
Reid Spencer
c6a8d70cff Convert code to compile with vc7.1.
Patch contributed by Paolo Invernizzi. Thanks Paolo!

llvm-svn: 16368
2004-09-15 17:06:42 +00:00
Chris Lattner
f1a0bf88c5 Add some assertions
llvm-svn: 16366
2004-09-15 16:59:47 +00:00
Chris Lattner
606caa617e Implement an AliasSetTracker::copyValue method
llvm-svn: 16344
2004-09-14 19:15:32 +00:00
Alkis Evlogimenos
0c50e0f211 Fixes to make LLVM compile with vc7.1.
Patch contributed by Paolo Invernizzi!

llvm-svn: 16152
2004-09-03 18:19:51 +00:00
Reid Spencer
c4abcbefb1 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.

llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Chris Lattner
818ac2d5e2 Fix a bug that caused the pass to go into infinite loops on trivial testcases.
This is fallout of the Bug 122 changes.

llvm-svn: 15811
2004-08-16 05:38:02 +00:00
Chris Lattner
0b9b58e550 Add standard print/dump methods to CallGraph classes.
llvm-svn: 15569
2004-08-08 03:27:49 +00:00
Chris Lattner
13e1bc338d Hide this option
llvm-svn: 15415
2004-08-02 20:16:21 +00:00
Misha Brukman
58104df77b Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15334
2004-07-29 17:30:56 +00:00
Misha Brukman
2a80e53645 Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15328
2004-07-29 17:05:13 +00:00
Alkis Evlogimenos
fb27f702ca Merge i*.h headers into Instructions.h as part of bug403.
llvm-svn: 15325
2004-07-29 12:17:34 +00:00
Chris Lattner
b2cf39d1a4 Fix test/Regression/Analysis/BasicAA/2004-07-28-MustAliasbug.llx
This also fixes the miscompilation of MallocBench/gs with dead store
elimination enabled.

llvm-svn: 15324
2004-07-29 07:56:39 +00:00
Brian Gaeke
45adb41f46 Make the create...() functions for some of these passes return a FunctionPass *.
llvm-svn: 15276
2004-07-27 17:43:21 +00:00
Chris Lattner
81f96c5a79 nuke pointless -debug output
llvm-svn: 15267
2004-07-27 08:03:18 +00:00
Chris Lattner
6a1dd59421 Fix conservative assumption, which was quite broken. Also, notice that
functions known to not access memory (like sin/cos) don't access memory! :)

llvm-svn: 15264
2004-07-27 07:46:26 +00:00
Chris Lattner
e921652646 Remove a bogus assertion
llvm-svn: 15261
2004-07-27 07:22:21 +00:00
Chris Lattner
c76d21f55d Complete rewrite of this pass to be faster, use less memory, be easier to
understand, and more accurate to boot!  This implements
GlobalModRef/purecse.ll over the previous impl.

llvm-svn: 15260
2004-07-27 06:40:37 +00:00
Chris Lattner
550242f7ec Use context-sensitive alias analysis to avoid pessimization in clients of
AliasSetTracker (dse and licm).  This implements
DeadStoreElimination/context-sensitive.llx

llvm-svn: 15254
2004-07-27 02:20:26 +00:00
Chris Lattner
40bd881142 Make basicaa a bit more aggressive
llvm-svn: 15252
2004-07-27 02:18:52 +00:00
Chris Lattner
fe3fff9354 basic-aa can actually provide simple mod/ref info
llvm-svn: 15251
2004-07-27 02:13:55 +00:00
Chris Lattner
9cfa22fb48 This was implemented back in march
llvm-svn: 15250
2004-07-27 01:59:42 +00:00
Chris Lattner
8b2590f09f Add some new methods
llvm-svn: 15230
2004-07-26 05:50:23 +00:00
Chris Lattner
447e112745 Fix a latent bug in the AliasSetTracker that was exposed by the FreeInst additions and broke a bunch of programs last night.
llvm-svn: 15214
2004-07-25 18:32:01 +00:00
Chris Lattner
31d9cbf7bb Add support for free instructions
llvm-svn: 15197
2004-07-25 07:57:37 +00:00
Chris Lattner
e3adc34ea7 Clean up reference counting to stop "leaking" alias sets
llvm-svn: 15099
2004-07-22 07:58:18 +00:00
Brian Gaeke
f18cdca667 These files don't need to include <iostream> since they include "Support/Debug.h".
llvm-svn: 15089
2004-07-21 20:50:33 +00:00
Chris Lattner
195950df76 Add capability to remove aliasing aliassets from an AST
llvm-svn: 15066
2004-07-21 07:04:26 +00:00
Chris Lattner
f9976c5dbf Make the AST interface a bit richer by returning whether an insertion caused
an insertion or not (because the pointer set already existed).

llvm-svn: 15064
2004-07-21 05:18:04 +00:00
Chris Lattner
36940c22f7 Do not ignore casts unless they are pointer-pointer casts. This caused us
to miscompile the SingleSource/Regression/C++/pointer_member.cpp program.

llvm-svn: 15062
2004-07-21 03:56:54 +00:00
Reid Spencer
b339652b44 bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass

llvm-svn: 14942
2004-07-18 00:18:30 +00:00
Chris Lattner
74807fe1a3 Fix incorrect computation of mod/ref sets. Do not ask for mod/ref information
for objects of size 0.

llvm-svn: 14908
2004-07-17 07:40:34 +00:00
Chris Lattner
2b68acbfe0 Print modref information in a useful way.
llvm-svn: 14907
2004-07-17 06:43:20 +00:00
Chris Lattner
49fd294675 Cleanups: fold two loops into one
New features: -print-all-alias-modref-info option, print more info

llvm-svn: 14906
2004-07-17 06:28:49 +00:00
Chris Lattner
763d51409f Be compatible with IA64
llvm-svn: 14864
2004-07-16 00:04:13 +00:00
Chris Lattner
bb7fe18493 Fixes for PR341
llvm-svn: 14843
2004-07-15 02:31:46 +00:00
Chris Lattner
d7d7bc70fd Fix for PR341
llvm-svn: 14842
2004-07-15 02:26:49 +00:00
Chris Lattner
fb6e1c2007 Simplify logic.
llvm-svn: 14825
2004-07-14 20:27:12 +00:00
Chris Lattner
203cdb2e64 Disable some code that isn't helping matters
llvm-svn: 14682
2004-07-08 07:25:51 +00:00
Chris Lattner
dce7977318 Headers moved
llvm-svn: 14665
2004-07-07 06:35:22 +00:00
Chris Lattner
7e0d8f8084 Move all of the DSA headers into the Analysis/DataStructure subdir.
llvm-svn: 14663
2004-07-07 06:32:21 +00:00
Chris Lattner
fb2f56c7c8 As much as I hate to say it, the whole setNode interface for DSNodeHandles
is HOPELESSLY broken.  The problem is that the embedded getNode call can
change the offset of the node handle in unpredictable ways.

As it turns out, all of the clients of this method really want to set
both the node and the offset, thus it is more efficient (and less buggy)
to just do both of them in one method call.  This fixes some obscure bugs
handling non-forwarded node handles.

llvm-svn: 14660
2004-07-07 06:12:52 +00:00
Reid Spencer
50ec3f9325 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Chris Lattner
7d6a9bf05c Initial checkin of a simple mod/ref analysis for global variables. This is
still overly conservative and uses very simple data structures, but it is a
start, and allows elimination of a lot of loads.

llvm-svn: 14462
2004-06-28 06:33:13 +00:00
Chris Lattner
548171248d Moved IPModRef out of the public include dir
llvm-svn: 14455
2004-06-28 00:41:23 +00:00
Chris Lattner
6eb1e76227 Move DependenceGraph.* to lib/Analysis/DataStructure
llvm-svn: 14452
2004-06-28 00:32:33 +00:00
Chris Lattner
a77dd6edec Moving to lib/Analysis/DataStructure
llvm-svn: 14450
2004-06-28 00:29:42 +00:00
Chris Lattner
f914ccfa2a Move MemoryDepAnalysis.h into lib/Analysis/DataStructure
llvm-svn: 14448
2004-06-28 00:27:16 +00:00
Chris Lattner
244d5fba00 Move PgmDependenceGraph.h out of the public include hierarchy
llvm-svn: 14446
2004-06-28 00:20:04 +00:00
Chris Lattner
850f1967b6 Simplify code
llvm-svn: 14424
2004-06-26 19:31:26 +00:00
Chris Lattner
d6e23a5104 Fix header
llvm-svn: 14394
2004-06-25 04:24:22 +00:00
Chris Lattner
228e6d64d0 Remove distasteful method which is really part of the indvars pass
llvm-svn: 14359
2004-06-24 06:52:20 +00:00
Chris Lattner
4e431080a9 Fix merging of nodes whose incoming offset is not zero. This unbreaks DSA on
several mallocbench programs, including perl.

llvm-svn: 14342
2004-06-23 06:29:59 +00:00
Misha Brukman
699226cbe4 File requires IPA, moved to lib/Analysis/IPA
llvm-svn: 14330
2004-06-22 19:04:53 +00:00