Commit Graph

1014 Commits

Author SHA1 Message Date
Chris Lattner
05e47987ee This was implemented back in march
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15250 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-27 01:59:42 +00:00
Chris Lattner
61d462760b Add some new methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15230 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-26 05:50:23 +00:00
Chris Lattner
34a1005737 Fix a latent bug in the AliasSetTracker that was exposed by the FreeInst additions and broke a bunch of programs last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15214 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 18:32:01 +00:00
Chris Lattner
5c88260f70 Add support for free instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15197 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-25 07:57:37 +00:00
Chris Lattner
b8a31ace2c Clean up reference counting to stop "leaking" alias sets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15099 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-22 07:58:18 +00:00
Brian Gaeke
7848e68c16 These files don't need to include <iostream> since they include "Support/Debug.h".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15089 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 20:50:33 +00:00
Chris Lattner
6d4b0d723d Add capability to remove aliasing aliassets from an AST
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15066 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 07:04:26 +00:00
Chris Lattner
12c1155403 Make the AST interface a bit richer by returning whether an insertion caused
an insertion or not (because the pointer set already existed).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 05:18:04 +00:00
Chris Lattner
bb8f43c8fc Do not ignore casts unless they are pointer-pointer casts. This caused us
to miscompile the SingleSource/Regression/C++/pointer_member.cpp program.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15062 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-21 03:56:54 +00:00
Reid Spencer
e840434755 bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage
- Minimize redundant isa<GlobalValue> usage
- Correct isa<Constant> for GlobalValue subclass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14942 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-18 00:18:30 +00:00
Chris Lattner
cb19d67907 Fix incorrect computation of mod/ref sets. Do not ask for mod/ref information
for objects of size 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14908 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-17 07:40:34 +00:00
Chris Lattner
ad48cc71dc Print modref information in a useful way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14907 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-17 06:43:20 +00:00
Chris Lattner
0e872cb470 Cleanups: fold two loops into one
New features: -print-all-alias-modref-info option, print more info


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14906 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-17 06:28:49 +00:00
Chris Lattner
f99947c35f Be compatible with IA64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14864 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-16 00:04:13 +00:00
Chris Lattner
1ff1ff70e3 Fixes for PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14843 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 02:31:46 +00:00
Chris Lattner
f92791ace5 Fix for PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14842 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 02:26:49 +00:00
Chris Lattner
ce36d55cf8 Bug fixes for PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14838 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 01:29:12 +00:00
Chris Lattner
f70770abd5 Simplify logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14825 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 20:27:12 +00:00
Chris Lattner
5ace1e4f6f Disable some code that isn't helping matters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14682 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 07:25:51 +00:00
Chris Lattner
8adbec89ce Headers moved
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14665 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 06:35:22 +00:00
Chris Lattner
4dabb2c6f3 Move all of the DSA headers into the Analysis/DataStructure subdir.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14663 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 06:32:21 +00:00
Chris Lattner
eaef5685b8 Moving headers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14661 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 06:22:54 +00:00
Chris Lattner
efffdc9408 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14660 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-07 06:12:52 +00:00
Reid Spencer
954da37bb4 Add #include <iostream> since Value.h does not #include it any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14622 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 12:19:56 +00:00
Chris Lattner
3b04a8ac45 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14462 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 06:33:13 +00:00
Chris Lattner
e6afb74188 Moved IPModRef out of the public include dir
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14455 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 00:41:23 +00:00
Chris Lattner
b88fb055c4 Move DependenceGraph.* to lib/Analysis/DataStructure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14452 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 00:32:33 +00:00
Chris Lattner
2de1d32ce1 Moving to lib/Analysis/DataStructure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14450 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 00:29:42 +00:00
Chris Lattner
0ecdcbe63a Move MemoryDepAnalysis.h into lib/Analysis/DataStructure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14448 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 00:27:16 +00:00
Chris Lattner
71ef8f7adc Move PgmDependenceGraph.h out of the public include hierarchy
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14446 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-28 00:20:04 +00:00
Chris Lattner
af754dbf65 Simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14424 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-26 19:31:26 +00:00
Chris Lattner
d28b0d73da Fix header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14394 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-25 04:24:22 +00:00
Chris Lattner
5aa20212cc Remove distasteful method which is really part of the indvars pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14359 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-24 06:52:20 +00:00
Chris Lattner
37ec591c74 Fix merging of nodes whose incoming offset is not zero. This unbreaks DSA on
several mallocbench programs, including perl.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14342 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-23 06:29:59 +00:00
Misha Brukman
f05ff33d21 File requires IPA, moved to lib/Analysis/IPA
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14330 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-22 19:04:53 +00:00
Misha Brukman
952e38cf24 File depends on MemoryDepAnalysis (DSA); moved to lib/Analysis/DataStructure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14327 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-22 18:28:37 +00:00
Misha Brukman
bab75268f0 Files depend on DSA, moved to lib/Analysis/DataStructure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14326 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-22 18:13:24 +00:00
Chris Lattner
8e667cdc94 If an edge points to a field of another memory object, actually reflect this
in the DOT visualization of the DSGraphs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14316 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-22 07:13:10 +00:00
Chris Lattner
541ad5e19e REALLY fix PR378: crash in scalar evolution analysis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14275 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-20 20:32:16 +00:00
Chris Lattner
2d58452f39 Fix a bug in my change last night that caused a few test failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14270 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-20 17:01:44 +00:00
Chris Lattner
8d741b8bef 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14263 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-20 06:23:15 +00:00
Chris Lattner
689835a2d9 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14245 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-19 08:05:58 +00:00
Chris Lattner
f70c22b019 Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 18:19:28 +00:00
Chris Lattner
4ee623de0b isnan is dead
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14191 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-15 21:52:58 +00:00
Chris Lattner
9f35196fc2 llvm.isnan doesn't access memory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14151 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-11 06:17:13 +00:00
Chris Lattner
47c31a8248 Don't grab the condition of unconditional branches!
This fixes PR363


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14076 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-08 21:50:30 +00:00
Chris Lattner
c7ca32b203 Add some notes so I can throw away one of my many todo lists.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14046 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-05 20:12:36 +00:00
Chris Lattner
24527fd2ae Don't send random junk to CachedWriter's. Also remove a cast that could be
problematic when Type does not derive from Value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14022 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-04 20:25:55 +00:00
Chris Lattner
a5dcc4f7b2 Minor efficiency gain: do 1 nlogn lookup instead of two
Code cleanup


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13875 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-28 05:36:49 +00:00
Chris Lattner
1fc3739560 Fix warnings about reaching end of non-void function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13852 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 20:57:01 +00:00
Vikram S. Adve
e4e97ef64d Recognize memalign and friends, and handle them specially.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13741 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-25 08:14:52 +00:00
Chris Lattner
5a24d70d99 Changes to work with the changes to the AliasAnalysis interface. The -no-aa
class is now in the BasicAliasAnalysis.cpp file


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13684 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:15:48 +00:00
Chris Lattner
b52f440860 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13683 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:15:12 +00:00
Chris Lattner
484e3027b2 Updates to work with the new auto-forwarding AA interface changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13682 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:14:27 +00:00
Chris Lattner
2412a05b80 Fix a really nasty bug with the -disable-ds-field-sensitivity option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13681 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:14:09 +00:00
Chris Lattner
1bf3408f96 Update to match the autochaining interface that the AA interface uses
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13680 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:13:51 +00:00
Chris Lattner
0f312d6998 Implement the interfaces to update value numbering information. Add an
assert.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13679 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:13:24 +00:00
Chris Lattner
c43e0ae350 Rename a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13676 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:10:58 +00:00
Chris Lattner
e995a2abb3 Add a simple implementation of Andersen's interprocedural pointer analysis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13666 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 21:00:47 +00:00
Vikram S. Adve
052682f1c3 Inline both direct and indirect callees in the CBU phase because
a direct callee may have indirect callees and so may have changed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13649 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 08:00:34 +00:00
Vikram S. Adve
c5204fb6f8 Complete rewrite of the code that merges DS graphs for equivalence classes
of functions called at a common call site.  The rewrite inlines the
resulting graphs bottom-up on the SCCs of the CBU call graph.  It also
simplifies the merging of equivalence classes by exploiting the fact that
functions in non-trivial SCCs are already merged.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13645 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-23 07:54:02 +00:00
Chris Lattner
0555ed8bff Fine grainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13436 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-09 06:22:29 +00:00
Brian Gaeke
6178085cfd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13366 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-05 06:10:06 +00:00
Brian Gaeke
b171d7949d Add stub support for reading BBTraces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13352 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-04 17:11:14 +00:00
Brian Gaeke
660ef70b62 Share ProfilingType enum with the C profiling runtime libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13346 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-04 16:53:07 +00:00
Chris Lattner
7b11e339d2 Fix a problem with double freeing memory. For some reason, CallGraph is not
acting like a normal pass.  :(


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13318 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-02 16:06:18 +00:00
Chris Lattner
224f7e65e0 Plug a minor memory leak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13317 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-02 07:31:34 +00:00
Misha Brukman
96a8bd7f54 Wrapped code and comments at 80 cols; doxygenified some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13264 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-29 04:05:30 +00:00
Misha Brukman
bf94a1e22a Reorder #includes as per style guide.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13263 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-29 04:04:47 +00:00
Misha Brukman
8618e52be5 Send text and numbers directly to CachedWriter's contained ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13243 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-28 18:52:43 +00:00
Chris Lattner
6ffe551f65 Changes to fix up the inst_iterator to pass to boost iterator checks. This
patch was graciously contributed by Vladimir Prus.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13185 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-27 15:13:33 +00:00
Brian Gaeke
c6e2d8a2ff Add functions that return instances of these printer passes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13175 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-26 16:27:08 +00:00
Chris Lattner
bac7da8461 If an object is not in the scalar map then it must be a global from another
graph.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13173 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-26 14:44:08 +00:00
Chris Lattner
b06432c276 Eliminate all of the SCEV Expansion code which is really part of the
IndVars pass, not part of SCEV *analysis*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13134 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-23 21:29:03 +00:00
Chris Lattner
72035995d5 Pass the callgraph not the module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 21:52:26 +00:00
Chris Lattner
a10df50282 Add the ability for SCC passes to initialize and finalize themselves
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13084 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-20 21:30:06 +00:00
Chris Lattner
45a1cf87d4 It's not just a printer, it's actually an analysis too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13064 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:42:32 +00:00
Chris Lattner
446b86d381 Remove code to update loop depths
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13058 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-19 03:02:09 +00:00
Chris Lattner
85661d0978 Add new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13050 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:45:27 +00:00
Chris Lattner
343c0cfa19 Fix computation of exit blocks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13047 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:21:41 +00:00
Chris Lattner
f1ab4b4eac 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13045 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 22:14:10 +00:00
Chris Lattner
3048bd1d3e Implement method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13036 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 06:54:48 +00:00
Chris Lattner
24199db80e Add a new method, add a check missing that caused a segfault if a loop didn't
have a canonical indvar


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13032 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-18 05:38:05 +00:00
Chris Lattner
3221ad0db7 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13019 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-17 22:58:41 +00:00
Chris Lattner
7980fb9007 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13017 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-17 18:36:24 +00:00
Brian Gaeke
c598517c24 Include <cmath> for compatibility with gcc 3.0.x (the system compiler on
Debian.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12986 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-16 15:57:32 +00:00
Chris Lattner
92020faa2c add some helpful methods. Rearrange #includes to proper order
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12960 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-15 15:16:02 +00:00
Chris Lattner
0a7f98c80d Factor a bunch of classes out into a public header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12958 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-15 15:07:24 +00:00
Chris Lattner
0aa84fdd04 Unbreak the build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12956 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-15 14:17:43 +00:00
Chris Lattner
e9fc96e7cc Implement a FIXME: if we're going to insert a cast, we might as well only
insert it once!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12955 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-14 22:01:22 +00:00
Chris Lattner
16011e6201 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12952 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-14 21:11:25 +00:00
Chris Lattner
46758a894f Add some methods that are useful for updating loop information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12871 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-12 20:26:17 +00:00
Chris Lattner
b81c021f14 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12860 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-12 05:36:32 +00:00
Chris Lattner
7512c08bfd Hrm, operator new and new[] do not belong here. We should not CSE them! :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12859 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-12 05:16:42 +00:00
Chris Lattner
bec63d606f operator new & operator new[] do not kill any legal memory locations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12833 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-11 18:16:34 +00:00
Chris Lattner
65585aa3fc Allow clients to be more efficient.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12831 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-11 16:43:07 +00:00
Chris Lattner
b903fc5c1b Add a couple of more functions that cannot access memory (the intrinsics) and
don't write to memory


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12808 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-10 06:55:27 +00:00
Chris Lattner
627018b4b3 Fix a bug Brian found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12754 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-07 16:16:11 +00:00
Chris Lattner
ea9e005ce6 Sparc don't got not "sqrtl", bum bum bum
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12670 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-05 19:05:15 +00:00
Misha Brukman
bb2aff1e18 Kill warnings during an optimized compile where assert() disappears.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12669 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-05 19:00:46 +00:00