Commit Graph

1198 Commits

Author SHA1 Message Date
Chris Lattner 068c0cf56a 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 1feea5ffc9 Handle assert_fail special
llvm-svn: 17631
2004-11-08 21:08:28 +00:00
Chris Lattner 303bdd1e4b Remove dead var
llvm-svn: 17485
2004-11-05 04:52:08 +00:00
Chris Lattner a67a030d9d Don't call Constant::getNullValue when the argument could be VoidTy
llvm-svn: 17457
2004-11-03 18:51:26 +00:00
Chris Lattner e3c00e9eee Fix comment
llvm-svn: 17377
2004-10-31 21:54:51 +00:00
Chris Lattner 70fdac83e3 Improve comment
llvm-svn: 17375
2004-10-31 19:57:43 +00:00
Chris Lattner 3f7dbfc898 Add more paranoid assertions :)
llvm-svn: 17367
2004-10-31 17:45:40 +00:00
Chris Lattner c76fef1248 Fix some more problems where we called getOffset before getNode()
llvm-svn: 17358
2004-10-30 07:21:19 +00:00
Chris Lattner 8aa0bafe1a 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 bc740090a9 Fix more undefined behavior
llvm-svn: 17356
2004-10-30 04:22:45 +00:00
Chris Lattner ba96f0fd83 * 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 6bbc57ec12 Fix library name.
llvm-svn: 17306
2004-10-28 05:36:48 +00:00
Reid Spencer 57cbe39d1e Change Library Names Not To Conflict With Others When Installed
llvm-svn: 17286
2004-10-27 23:18:45 +00:00
Chris Lattner 7dfc2d29ac 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 fda51a5933 add support for UndefValue
llvm-svn: 17260
2004-10-26 16:23:03 +00:00
Chris Lattner 43df507fef Patch to support MSVC, contributed by Morten Ofstad
llvm-svn: 17214
2004-10-25 18:40:08 +00:00
Reid Spencer c1c320c335 We won't use automake
llvm-svn: 17155
2004-10-22 03:35:04 +00:00
Reid Spencer 6a11a75f31 Initial automake generated Makefile template
llvm-svn: 17136
2004-10-18 23:55:41 +00:00
Chris Lattner 98e541457b Add support for unreachable
llvm-svn: 17056
2004-10-16 18:21:33 +00:00
Chris Lattner 61753bf847 Add support for undef
llvm-svn: 17055
2004-10-16 18:19:26 +00:00
Chris Lattner 2978437b76 Add support
llvm-svn: 17052
2004-10-16 18:16:19 +00:00
Chris Lattner 3c3e058406 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 52a126cb3e 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 ace94df71f Update to reflect changes in Makefile rules.
llvm-svn: 16950
2004-10-13 11:46:52 +00:00
Chris Lattner ec901cc6cd 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 6faf3949f6 Fix SingleSource/Benchmarks/McGill/chomp
llvm-svn: 16912
2004-10-11 04:07:27 +00:00
Reid Spencer e2d1af8be0 Build both archive and relinked objects
llvm-svn: 16892
2004-10-10 22:17:39 +00:00
Reid Spencer b84cbf2725 Initial version of automake Makefile.am file.
llvm-svn: 16885
2004-10-10 20:43:57 +00:00
Chris Lattner 3ae7bb6b7c 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 af88fcd4c9 Dont' let null nodes sneak past cast instructions
llvm-svn: 16779
2004-10-06 19:29:13 +00:00
Chris Lattner 4f2cf030e8 '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 135419193e 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 d6d99dfa3f 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 824a21868b Add CallGraphNode::removeAnyCallEdgeTo method
llvm-svn: 16398
2004-09-18 21:34:34 +00:00
Chris Lattner 85d5ccc006 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 e81c2aa42a Implement new changeFunction method, nuke a never implemented one.
llvm-svn: 16386
2004-09-18 00:22:13 +00:00
Reid Spencer 6614946443 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 6fa9665095 Add some assertions
llvm-svn: 16366
2004-09-15 16:59:47 +00:00
Chris Lattner ab64481f1d Implement an AliasSetTracker::copyValue method
llvm-svn: 16344
2004-09-14 19:15:32 +00:00
Alkis Evlogimenos a5c04ee50f 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 7c16caa336 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 12324753f2 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 6b54110281 Add standard print/dump methods to CallGraph classes.
llvm-svn: 15569
2004-08-08 03:27:49 +00:00
Chris Lattner 7e36902bd9 Hide this option
llvm-svn: 15415
2004-08-02 20:16:21 +00:00
Misha Brukman 63b38bd2ed Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15334
2004-07-29 17:30:56 +00:00
Misha Brukman 2b3387a6d9 Fix #includes of i*.h => Instructions.h as per PR403.
llvm-svn: 15328
2004-07-29 17:05:13 +00:00
Alkis Evlogimenos fd7a2d4477 Merge i*.h headers into Instructions.h as part of bug403.
llvm-svn: 15325
2004-07-29 12:17:34 +00:00
Chris Lattner c21acbfea4 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 38b79e8fbc 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 036d2b0c4d nuke pointless -debug output
llvm-svn: 15267
2004-07-27 08:03:18 +00:00
Chris Lattner b696462260 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 731381dc0e Remove a bogus assertion
llvm-svn: 15261
2004-07-27 07:22:21 +00:00
Chris Lattner 3a353e84b7 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 9b323c3521 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 aa05a6e5a1 Make basicaa a bit more aggressive
llvm-svn: 15252
2004-07-27 02:18:52 +00:00
Chris Lattner 6b570266b8 basic-aa can actually provide simple mod/ref info
llvm-svn: 15251
2004-07-27 02:13:55 +00:00
Chris Lattner 782ab98c56 This was implemented back in march
llvm-svn: 15250
2004-07-27 01:59:42 +00:00
Chris Lattner bf8c3c405e Add some new methods
llvm-svn: 15230
2004-07-26 05:50:23 +00:00
Chris Lattner 0c73a1ff05 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 924c68dcb2 Add support for free instructions
llvm-svn: 15197
2004-07-25 07:57:37 +00:00
Chris Lattner 053427ff4f Clean up reference counting to stop "leaking" alias sets
llvm-svn: 15099
2004-07-22 07:58:18 +00:00
Brian Gaeke 902dcf0729 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 abc4f4523f Add capability to remove aliasing aliassets from an AST
llvm-svn: 15066
2004-07-21 07:04:26 +00:00
Chris Lattner 2cfaef23e4 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 fdcf624939 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 30d69a5af9 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 3bbaaaa940 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 2e8690bf57 Print modref information in a useful way.
llvm-svn: 14907
2004-07-17 06:43:20 +00:00
Chris Lattner eed1a6f3dc 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 597555fd45 Be compatible with IA64
llvm-svn: 14864
2004-07-16 00:04:13 +00:00
Chris Lattner 3c42077c37 Fixes for PR341
llvm-svn: 14843
2004-07-15 02:31:46 +00:00
Chris Lattner 558cebc775 Fix for PR341
llvm-svn: 14842
2004-07-15 02:26:49 +00:00
Chris Lattner cbdf371d30 Simplify logic.
llvm-svn: 14825
2004-07-14 20:27:12 +00:00
Chris Lattner b2db87a5ca Disable some code that isn't helping matters
llvm-svn: 14682
2004-07-08 07:25:51 +00:00
Chris Lattner 97cf20e1b8 Headers moved
llvm-svn: 14665
2004-07-07 06:35:22 +00:00
Chris Lattner f6118db088 Move all of the DSA headers into the Analysis/DataStructure subdir.
llvm-svn: 14663
2004-07-07 06:32:21 +00:00
Chris Lattner deb7676f0f 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 eb04d9bcb4 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 26dff501a4 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 9b55c11c56 Moved IPModRef out of the public include dir
llvm-svn: 14455
2004-06-28 00:41:23 +00:00
Chris Lattner 32c79788cc Move DependenceGraph.* to lib/Analysis/DataStructure
llvm-svn: 14452
2004-06-28 00:32:33 +00:00
Chris Lattner 135fb4be7c Moving to lib/Analysis/DataStructure
llvm-svn: 14450
2004-06-28 00:29:42 +00:00
Chris Lattner dfe8056225 Move MemoryDepAnalysis.h into lib/Analysis/DataStructure
llvm-svn: 14448
2004-06-28 00:27:16 +00:00
Chris Lattner f6729a3bcc Move PgmDependenceGraph.h out of the public include hierarchy
llvm-svn: 14446
2004-06-28 00:20:04 +00:00
Chris Lattner 74e2acfcdd Simplify code
llvm-svn: 14424
2004-06-26 19:31:26 +00:00
Chris Lattner f019e346f4 Fix header
llvm-svn: 14394
2004-06-25 04:24:22 +00:00
Chris Lattner 5e08b93a34 Remove distasteful method which is really part of the indvars pass
llvm-svn: 14359
2004-06-24 06:52:20 +00:00
Chris Lattner 0441388aff 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 44601805a6 File requires IPA, moved to lib/Analysis/IPA
llvm-svn: 14330
2004-06-22 19:04:53 +00:00
Misha Brukman c5300a4f04 File depends on MemoryDepAnalysis (DSA); moved to lib/Analysis/DataStructure
llvm-svn: 14327
2004-06-22 18:28:37 +00:00
Misha Brukman df6339bee7 Files depend on DSA, moved to lib/Analysis/DataStructure
llvm-svn: 14326
2004-06-22 18:13:24 +00:00
Misha Brukman ddc90adca3 File depends on DSA, moved to lib/Analysis/DataStructure
llvm-svn: 14325
2004-06-22 18:11:38 +00:00
Chris Lattner 881d959fd4 If an edge points to a field of another memory object, actually reflect this
in the DOT visualization of the DSGraphs.

llvm-svn: 14316
2004-06-22 07:13:10 +00:00
Chris Lattner baaed7ee90 REALLY fix PR378: crash in scalar evolution analysis
llvm-svn: 14275
2004-06-20 20:32:16 +00:00
Chris Lattner 6bfca8f5f1 Fix a bug in my change last night that caused a few test failures.
llvm-svn: 14270
2004-06-20 17:01:44 +00:00
Chris Lattner eb3e84078d Do not sort SCEV objects by address: instead sort by complexity and group
by address.  This prevents the resultant SCEV objects from depending on
where in memory other scev objects happen to live.

llvm-svn: 14263
2004-06-20 06:23:15 +00:00
Chris Lattner feda9d0583 Fix a tiny bug in the -no-aa pass, in which it did not ever get a target data.
This is a regression from 1.2, though noone uses -no-aa anyway

llvm-svn: 14245
2004-06-19 08:05:58 +00:00
Chris Lattner 6b7275996c Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
llvm-svn: 14201
2004-06-17 18:19:28 +00:00
Chris Lattner fbf4dc3bd0 isnan is dead
llvm-svn: 14191
2004-06-15 21:52:58 +00:00
Chris Lattner 66f313725c llvm.isnan doesn't access memory
llvm-svn: 14151
2004-06-11 06:17:13 +00:00
Chris Lattner 4c7a24af44 Don't grab the condition of unconditional branches!
This fixes PR363

llvm-svn: 14076
2004-06-08 21:50:30 +00:00
Chris Lattner 2738b7ea61 Add some notes so I can throw away one of my many todo lists.
llvm-svn: 14046
2004-06-05 20:12:36 +00:00
Chris Lattner 75019ba397 Don't send random junk to CachedWriter's. Also remove a cast that could be
problematic when Type does not derive from Value.

llvm-svn: 14022
2004-06-04 20:25:55 +00:00
Chris Lattner 49cdc6b564 Minor efficiency gain: do 1 nlogn lookup instead of two
Code cleanup

llvm-svn: 13875
2004-05-28 05:36:49 +00:00
Chris Lattner fc7509b7d4 Fix warnings about reaching end of non-void function
llvm-svn: 13852
2004-05-27 20:57:01 +00:00
Vikram S. Adve f6c4ee0744 Recognize memalign and friends, and handle them specially.
llvm-svn: 13741
2004-05-25 08:14:52 +00:00
Chris Lattner 62c37008a4 Changes to work with the changes to the AliasAnalysis interface. The -no-aa
class is now in the BasicAliasAnalysis.cpp file

llvm-svn: 13684
2004-05-23 21:15:48 +00:00
Chris Lattner 59c8ed8843 Move the -no-aa AA implementation into this file since both of these
alias analysis implementations are special: they do not autoforward to a
chained implementation of alias analysis

llvm-svn: 13683
2004-05-23 21:15:12 +00:00
Chris Lattner e345f6b5ab Updates to work with the new auto-forwarding AA interface changes
llvm-svn: 13682
2004-05-23 21:14:27 +00:00
Chris Lattner e657eb17cc Fix a really nasty bug with the -disable-ds-field-sensitivity option
llvm-svn: 13681
2004-05-23 21:14:09 +00:00
Chris Lattner befe4c510e Update to match the autochaining interface that the AA interface uses
llvm-svn: 13680
2004-05-23 21:13:51 +00:00
Chris Lattner 32502b8d4a Implement the interfaces to update value numbering information. Add an
assert.

llvm-svn: 13679
2004-05-23 21:13:24 +00:00
Chris Lattner 746e1e1808 Rename a method
llvm-svn: 13676
2004-05-23 21:10:58 +00:00
Chris Lattner 5758134505 Add a simple implementation of Andersen's interprocedural pointer analysis
llvm-svn: 13666
2004-05-23 21:00:47 +00:00
Vikram S. Adve 159ed21b67 Inline both direct and indirect callees in the CBU phase because
a direct callee may have indirect callees and so may have changed.

llvm-svn: 13649
2004-05-23 08:00:34 +00:00
Chris Lattner 17fcb67a20 Fine grainify namespacification
llvm-svn: 13436
2004-05-09 06:22:29 +00:00
Brian Gaeke e330adf842 Move the stuff that fixes the size, orientation & fonts of graphs to
the debugging functions that call "dot". These fixed settings have
various problems: for example, the fixed size that is set in the graph
traits classes is not appropriate for turning the dot file into a PNG,
and if TrueType font rendering is being used, the 'Courier' TrueType font
may not be installed. It seems easy enough to specify these things on the
command line, anyhow.

llvm-svn: 13366
2004-05-05 06:10:06 +00:00
Brian Gaeke 600f2045a9 Add stub support for reading BBTraces.
llvm-svn: 13352
2004-05-04 17:11:14 +00:00
Brian Gaeke 34c13fbe94 Share ProfilingType enum with the C profiling runtime libraries.
llvm-svn: 13346
2004-05-04 16:53:07 +00:00
Chris Lattner 6942946132 Fix a problem with double freeing memory. For some reason, CallGraph is not
acting like a normal pass.  :(

llvm-svn: 13318
2004-05-02 16:06:18 +00:00
Chris Lattner 929291aabb Plug a minor memory leak
llvm-svn: 13317
2004-05-02 07:31:34 +00:00
Misha Brukman 372d5bc9ab Wrapped code and comments at 80 cols; doxygenified some comments.
llvm-svn: 13264
2004-04-29 04:05:30 +00:00
Misha Brukman a70ae90722 Reorder #includes as per style guide.
llvm-svn: 13263
2004-04-29 04:04:47 +00:00
Misha Brukman 7e66438579 Send text and numbers directly to CachedWriter's contained ostream.
llvm-svn: 13243
2004-04-28 18:52:43 +00:00
Chris Lattner 2d3a7a6ff0 Changes to fix up the inst_iterator to pass to boost iterator checks. This
patch was graciously contributed by Vladimir Prus.

llvm-svn: 13185
2004-04-27 15:13:33 +00:00
Brian Gaeke 104341f31e Add functions that return instances of these printer passes
llvm-svn: 13175
2004-04-26 16:27:08 +00:00
Chris Lattner f374b3f304 If an object is not in the scalar map then it must be a global from another
graph.

llvm-svn: 13173
2004-04-26 14:44:08 +00:00
Chris Lattner 05ef97f994 Eliminate all of the SCEV Expansion code which is really part of the
IndVars pass, not part of SCEV *analysis*.

llvm-svn: 13134
2004-04-23 21:29:03 +00:00
Chris Lattner 99504890b7 Pass the callgraph not the module
llvm-svn: 13087
2004-04-20 21:52:26 +00:00
Chris Lattner 8d0838130c Add the ability for SCC passes to initialize and finalize themselves
llvm-svn: 13084
2004-04-20 21:30:06 +00:00
Chris Lattner 663ebc3ec6 It's not just a printer, it's actually an analysis too
llvm-svn: 13064
2004-04-19 03:42:32 +00:00
Chris Lattner 32447c55fe Remove code to update loop depths
llvm-svn: 13058
2004-04-19 03:02:09 +00:00
Chris Lattner 26ba2f5fe8 Add new method
llvm-svn: 13050
2004-04-18 22:45:27 +00:00
Chris Lattner d6ce359d3b Fix computation of exit blocks
llvm-svn: 13047
2004-04-18 22:21:41 +00:00
Chris Lattner d72c3eb54e Change the ExitBlocks list from being explicitly contained in the Loop
structure to being dynamically computed on demand.  This makes updating
loop information MUCH easier.

llvm-svn: 13045
2004-04-18 22:14:10 +00:00
Chris Lattner e375a4fdc2 Implement method
llvm-svn: 13036
2004-04-18 06:54:48 +00:00
Chris Lattner 1472c63fb9 Add a new method, add a check missing that caused a segfault if a loop didn't
have a canonical indvar

llvm-svn: 13032
2004-04-18 05:38:05 +00:00
Chris Lattner dd73047673 Add the ability to compute exit values for complex loop using unanalyzable
operations.  This allows us to compile this testcase:

int main() {
        int h = 1;
         do h = 3 * h + 1; while (h <= 256);
        printf("%d\n", h);
        return 0;
}

into this:

int %main() {
entry:
        call void %__main( )
        %tmp.6 = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([4 x sbyte]*  %.str_1, long 0, long 0), int 364 )        ; <int> [#uses=0]
        ret int 0
}

This testcase was taken directly from 256.bzip2, believe it or not.

This code is not as general as I would like.  Next up is to refactor it
a bit to handle more cases.

llvm-svn: 13019
2004-04-17 22:58:41 +00:00
Chris Lattner 4021d1af5a Add the ability to compute trip counts that are only controlled by constants
even if the loop is using expressions that we can't compute as a closed-form.
This allows us to calculate that this function always returns 55:

int test() {
  double X;
  int Count = 0;
  for (X = 100; X > 1; X = sqrt(X), ++Count)
    /*empty*/;
  return Count;
}

And allows us to compute trip counts for loops like:

        int h = 1;
         do h = 3 * h + 1; while (h <= 256);

(which occurs in bzip2), and for this function, which occurs after inlining
and other optimizations:

int popcount()
{
   int x = 666;
  int result = 0;
  while (x != 0) {
    result = result + (x & 0x1);
    x = x >> 1;
  }
  return result;
}

We still cannot compute the exit values of result or h in the two loops above,
which means we cannot delete the loop, but we are getting closer.  Being able to
compute a constant trip count for these two loops will allow us to unroll them
completely though.

llvm-svn: 13017
2004-04-17 18:36:24 +00:00
Brian Gaeke 174633b078 Include <cmath> for compatibility with gcc 3.0.x (the system compiler on
Debian.)

llvm-svn: 12986
2004-04-16 15:57:32 +00:00
Chris Lattner d9dc425376 add some helpful methods. Rearrange #includes to proper order
llvm-svn: 12960
2004-04-15 15:16:02 +00:00
Chris Lattner b4f681b42b Factor a bunch of classes out into a public header
llvm-svn: 12958
2004-04-15 15:07:24 +00:00
Chris Lattner a4e4a63856 Unbreak the build
llvm-svn: 12956
2004-04-15 14:17:43 +00:00
Chris Lattner d420fe63ea Implement a FIXME: if we're going to insert a cast, we might as well only
insert it once!

llvm-svn: 12955
2004-04-14 22:01:22 +00:00
Chris Lattner 8a9fd94cfe This is a trivial tweak to the addrec insertion code: insert the increment
at the bottom of the loop instead of the top.  This reduces the number of
overlapping live ranges a lot, for example, eliminating a spill in an important
loop in 183.equake with linear scan.

I still need to make the exit comparison of the loop use the post-incremented
version of this variable, but this is an easy first step.

llvm-svn: 12952
2004-04-14 21:11:25 +00:00
Chris Lattner 55b7ef5a81 Add some methods that are useful for updating loop information.
llvm-svn: 12871
2004-04-12 20:26:17 +00:00
Chris Lattner 8b6db18ac3 Change the call graph class to have TWO external nodes, making call graph
SCC passes much more useful.  In particular, this should fix the incredibly
stupid missed inlining opportunities that the inliner suffered from.

llvm-svn: 12860
2004-04-12 05:36:32 +00:00
Chris Lattner c9e37d7cc9 Hrm, operator new and new[] do not belong here. We should not CSE them! :)
llvm-svn: 12859
2004-04-12 05:16:42 +00:00
Chris Lattner 403abb824f operator new & operator new[] do not kill any legal memory locations.
llvm-svn: 12833
2004-04-11 18:16:34 +00:00
Chris Lattner c5fad355f8 Allow clients to be more efficient.
llvm-svn: 12831
2004-04-11 16:43:07 +00:00
Chris Lattner 4a1b03c773 Add a couple of more functions that cannot access memory (the intrinsics) and
don't write to memory

llvm-svn: 12808
2004-04-10 06:55:27 +00:00
Chris Lattner 74498e1066 Fix a bug Brian found.
llvm-svn: 12754
2004-04-07 16:16:11 +00:00
Chris Lattner d4f78f270b Sparc don't got not "sqrtl", bum bum bum
llvm-svn: 12670
2004-04-05 19:05:15 +00:00
Misha Brukman 5ebc25c818 Kill warnings during an optimized compile where assert() disappears.
llvm-svn: 12669
2004-04-05 19:00:46 +00:00
Chris Lattner 29153fc2e5 Fix PR312 and IndVarsSimplify/2004-04-05-InvokeCastCrash.llx
llvm-svn: 12668
2004-04-05 18:46:55 +00:00
Chris Lattner 69193f93b6 Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

llvm-svn: 12653
2004-04-05 01:30:19 +00:00
Chris Lattner 8ed3c8aa13 Implement test/Regression/Transforms/GCSE/undefined_load.ll
llvm-svn: 12641
2004-04-03 00:45:16 +00:00
Chris Lattner 0defaa1cbc Add a break in the default case
llvm-svn: 12639
2004-04-03 00:43:03 +00:00
Chris Lattner 6748cca268 Remove obsolete files
llvm-svn: 12633
2004-04-02 20:56:24 +00:00
Chris Lattner 0916921332 Comment out debugging printouts
llvm-svn: 12623
2004-04-02 20:26:46 +00:00
Chris Lattner d934c70cf8 Add a new analysis
llvm-svn: 12619
2004-04-02 20:23:17 +00:00
Chris Lattner 82d34eb470 Minor efficiency improvement, finegrainify namespacification
llvm-svn: 12517
2004-03-25 22:56:03 +00:00
Chris Lattner 3022b1bc2c Fix a HORRIBLY NASTY bug that caused siod to stop working last night.
llvm-svn: 12479
2004-03-17 23:22:04 +00:00
Chris Lattner 8ad948ddbd Add some missing functions. Make sure to handle calls together in case the
client has another VN implementation that can VN calls.

llvm-svn: 12427
2004-03-16 03:41:35 +00:00
Chris Lattner 7f04ebc858 Ok, the assertion was bogus. Calls that do not read/write memory should not
have an alias set, just like adds and subtracts don't.

llvm-svn: 12422
2004-03-15 06:28:07 +00:00
Chris Lattner f5c8f4cea6 This assertion is bogus now that calls do not necessarily read/write memory
llvm-svn: 12421
2004-03-15 06:24:15 +00:00
Chris Lattner 53a3587997 Implement CSE of call instructions in the most trivial case. This implements
GCSE/call_cse.ll

llvm-svn: 12419
2004-03-15 05:44:59 +00:00
Chris Lattner ea42c857d6 Fix a minor bug, implementing GCSE/call_pure_function.ll
Also, add some stuff I missed before.

llvm-svn: 12417
2004-03-15 04:18:28 +00:00
Chris Lattner 21c60f1549 Don't be COMPLETELY pessimistic in the face of function calls
llvm-svn: 12413
2004-03-15 04:08:36 +00:00
Chris Lattner a67dbd02cf Deinline some virtual methods, provide better mod/ref answers through the
use of the boolean queries

llvm-svn: 12410
2004-03-15 04:07:29 +00:00
Chris Lattner d441444234 Pass through the boolean queries
llvm-svn: 12409
2004-03-15 04:06:46 +00:00
Chris Lattner d82256a7a1 Teach basicaa about some stdc functions.
llvm-svn: 12408
2004-03-15 03:36:49 +00:00
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 071a5e5649 Rename the intrinsic enum values for llvm.va_* from Intrinsic::va_* to
Intrinsic::va*.  This avoid conflicting with macros in the stdlib.h file.

llvm-svn: 12356
2004-03-13 00:24:00 +00:00
Chris Lattner f9e69b4553 Fix a couple of minor problems. Because PHI nodes can use themselves, this
could cause infinite loops.  Also, getUnderlyingObject can return null

llvm-svn: 12351
2004-03-12 23:12:55 +00:00
Chris Lattner a036253872 Implement mod/ref analysis for a trivial case where locals don't escape.
This comes up when you have a local array on the stack and you never pass
the address of elements around.

llvm-svn: 12349
2004-03-12 22:39:00 +00:00
Misha Brukman 4483c9b864 Simplify code to process CallSites (thanks to Chris).
llvm-svn: 12334
2004-03-12 16:20:49 +00:00
Misha Brukman bf28cf6b7d Evaluate ModRef information in addition to regular ol' pointer analysis.
llvm-svn: 12331
2004-03-12 06:15:08 +00:00
Misha Brukman 362841dccc Implement getModRefInfo() for DSA to calculate whether a function modifies or
references a pointer.

llvm-svn: 12330
2004-03-12 06:14:22 +00:00
Misha Brukman 96d3b0a6de Make code more readable.
llvm-svn: 12305
2004-03-12 00:58:41 +00:00
Chris Lattner 61f57617d7 Fix PR284: [indvars] Induction variable analysis violates LLVM invariants
llvm-svn: 12275
2004-03-10 21:42:19 +00:00
Chris Lattner b26b6fe9a7 implement new method
llvm-svn: 12264
2004-03-09 19:37:06 +00:00
Chris Lattner 9bde783c5c Switch to using edge profiling information as the basic source of profile info
from using basic block counts.

llvm-svn: 12242
2004-03-08 22:04:08 +00:00
Chris Lattner bd481d588a Refactor implementations
llvm-svn: 12240
2004-03-08 21:30:35 +00:00
Chris Lattner 63b49d0574 Import the trace class from the reoptimizer
llvm-svn: 12236
2004-03-08 20:57:27 +00:00
Chris Lattner 5302943ff7 If we have edge counts, we can produce block counts. I've verified that
using an edge profile to produce block counts gives the exact same numbers
as using a block count directly.

llvm-svn: 12232
2004-03-08 20:03:52 +00:00
Chris Lattner 8b8a0641a1 Add initial support for reading edge counts. This will be improved to enable
translation of edge counts into block/function counts when possible.

llvm-svn: 12229
2004-03-08 18:20:18 +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 2cb2905c96 Fix a minor bug
llvm-svn: 12169
2004-03-05 22:04:07 +00:00
Misha Brukman d2e88a21b7 Unbreak the build on Sparc.
llvm-svn: 12161
2004-03-05 20:04:40 +00:00
Chris Lattner 6c271edcd7 Fix a bug in a previous checkin that broke 175.vpr
llvm-svn: 12128
2004-03-04 21:36:57 +00:00
Chris Lattner bc3381f267 Add support for strto* and v*printf
llvm-svn: 12127
2004-03-04 21:03:54 +00:00
Chris Lattner 0ed8162c1a Add non-crappy support for varargs
llvm-svn: 12126
2004-03-04 20:33:47 +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 30f94a72f4 Speed up the cbu pass from taking somewhere near the age of the universe to about 90s on povray
llvm-svn: 12123
2004-03-04 19:16:35 +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 8db52980b7 Minor changes, remove some debugging code that got checked in somehow.
Make sure to scope the NodeMap passed into cloneInto so that it doesn't point
to nodes that are deleted.  Add some FIXME's for future performance enhancements.

llvm-svn: 12115
2004-03-04 17:05:28 +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 559487301f Fix a minor bug handling incomplete programs
llvm-svn: 12105
2004-03-03 23:00:19 +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 2e92b469c8 FINALLY be able to get symbolic type names in the globals graph!
llvm-svn: 12082
2004-03-02 21:39:43 +00:00
Chris Lattner 9e100fc3f7 Really, only if reopen
llvm-svn: 12080
2004-03-02 20:46:18 +00:00
Chris Lattner c8d23b19fb Correctly add an array marker on a node when appropriate!
llvm-svn: 12055
2004-03-01 19:02:54 +00:00
Chris Lattner 6f6e0f29ad Expand on my note-to-self
llvm-svn: 12029
2004-03-01 02:44:44 +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 98f8ca4017 ADD MORE FUNCTIONS!
llvm-svn: 11927
2004-02-27 20:04:48 +00:00
Chris Lattner 5ef1638da2 Be a good little compiler and handle direct calls efficiently, even if there
are beastly ConstantPointerRefs in the way...

llvm-svn: 11883
2004-02-26 22:07:22 +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 c8167b0e7e Add _more_ functions
llvm-svn: 11862
2004-02-26 03:43:08 +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 fab2872b6c When building local graphs, clone the initializer for constant globals into each
local graph that uses the global.

llvm-svn: 11850
2004-02-25 23:31:02 +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 5e5e060618 Add a bunch more functions
llvm-svn: 11847
2004-02-25 23:06:40 +00:00
Chris Lattner 17bce88100 Try harder to get symbol info
llvm-svn: 11846
2004-02-25 23:06:30 +00:00
Chris Lattner 864c901444 Add a bunch more functions used by perlbmk
llvm-svn: 11824
2004-02-25 17:43:20 +00:00
Chris Lattner 9ccb1af08f Add support for 'rename'
llvm-svn: 11813
2004-02-24 22:17:00 +00:00
Chris Lattner 396cdaf067 Add support for remove, fwrite, and fread
Also fix problem where we didn't check to see if a node pointer was null.
Though fclose(null) doesn't make a lot of sense, 300.twolf does it.

llvm-svn: 11810
2004-02-24 22:02:48 +00:00
Chris Lattner 494d510769 Fix a soon-to-be-missing #include
llvm-svn: 11707
2004-02-22 06:26:17 +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 eeb69197bf Use handy method
llvm-svn: 11692
2004-02-21 22:27:31 +00:00
Chris Lattner ab66f3d143 Instead of cloning the globals for main into the globals graph at the end of
BU propagation, clone the globals into the GG of EACH FUNCTION that finishes
processing!  The GlobalsGraph *must* include all globals and effects from
all functions in the program.  Fixing this makes pool allocation work better
on 175.vpr, but it still ultimately crashes.

llvm-svn: 11686
2004-02-21 00:30:28 +00:00
Chris Lattner 6a4e39677e There is no need to merge the globals graph into the function graphs at the
end of the BU and CBU passes.  The globals will be marked incomplete, so it
doesn't matter if they are missing some info, and merging isn't guaranteed
to bring everything in anyway!

llvm-svn: 11684
2004-02-20 23:52:15 +00:00
Chris Lattner 7b0368ee16 Add two missing returns, which caused us to be very pessimistic about the
printf and scanf families!

llvm-svn: 11683
2004-02-20 23:27:09 +00:00
Chris Lattner a061c3b25b Add support for some string functions, the scanf family, and sprintf
llvm-svn: 11673
2004-02-20 20:27:11 +00:00
Chris Lattner 2a6802ff41 When we complete the bottom-up pass, make sure to merge the globals in 'main' into
the globals graph.

llvm-svn: 11562
2004-02-17 19:06:47 +00:00
Chris Lattner 0cb8855a1c Only spit out warning for functions that take pointers, not for sin and the like
Add more special case handling for stdio functions.  I feel dirty, how about you?

llvm-svn: 11506
2004-02-16 22:57:19 +00:00
Chris Lattner cedfcf5bca memset and bcopy and now unified by the llvm.memset intrinsic
llvm-svn: 11503
2004-02-16 18:37:40 +00:00
Chris Lattner 218eb798a2 No need to scan zero initializers. This should make DSA a bit faster.
llvm-svn: 11471
2004-02-15 05:53:42 +00:00
Chris Lattner d17e15eddd Add support for a bunch more functions
llvm-svn: 11395
2004-02-13 21:21:48 +00:00
Chris Lattner e00227248e Add support for fopen/fclose. Specifically with fopen, we were marking all of the
operands as incomplete, though fopen is known to only read them.  This just adds
fclose for symmetry, though it doesn't gain anything.  This makes the dsgraphs for
181.mcf much more precise.

llvm-svn: 11390
2004-02-13 20:05:32 +00:00
Chris Lattner 9761271f0f Restructure code to handle memcpy/memmove
llvm-svn: 11374
2004-02-13 16:09:54 +00:00
Chris Lattner 4b095b937e Cosmetic improvements to this option.
llvm-svn: 11331
2004-02-11 19:14:04 +00:00
Chris Lattner f10f6b10f9 Actually load profiling information now! Block layout can use real, live,
actual profile info, and works!  :)

llvm-svn: 11324
2004-02-11 18:21:05 +00:00
Chris Lattner fa9a8f83a5 Fix a typeo
llvm-svn: 11323
2004-02-11 18:20:41 +00:00
Chris Lattner b8263bb809 Fix copy-and-pastos
llvm-svn: 11319
2004-02-11 06:10:18 +00:00
Chris Lattner f7a5d9874c Add skeleton profileinfoloader pass. This will be enhanced to actually LOAD
a profile tommorow.  :)

llvm-svn: 11318
2004-02-11 06:10:05 +00:00
Chris Lattner ddfc5506a7 Factor this code out of llvm-prof
llvm-svn: 11314
2004-02-11 05:54:25 +00:00
Chris Lattner 0c26f0048f Make sure to register the 'no profile' implementation as the default for ProfileInfo
llvm-svn: 11309
2004-02-11 04:47:54 +00:00
Chris Lattner 6e445dc299 Simplify implementation, and probably speed things up too.
llvm-svn: 11308
2004-02-11 03:57:16 +00:00
Chris Lattner 1f4f70425d An initial implementation of an LLVM ProfileInfo class which is designed to
eventually allow Passes to use profiling information to direct them.

llvm-svn: 11294
2004-02-10 22:11:42 +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 fa616e14fc Add one that I missed
llvm-svn: 11179
2004-02-08 01:53:10 +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 e1531f3eb1 Remove another unneeded call.
llvm-svn: 11177
2004-02-08 01:40:40 +00:00
Chris Lattner 985282c78e This call is no longer needed now that merging does not produce garbage
llvm-svn: 11176
2004-02-08 01:38:34 +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