Chris Lattner
c27302c79f
Disable a previous patch that was causing indvars to loop infinitely :(
...
llvm-svn: 13108
2004-04-22 15:12:36 +00:00
Chris Lattner
c1a682dda0
Fix an extremely serious thinko I made in revision 1.60 of this file.
...
llvm-svn: 13106
2004-04-22 14:59:40 +00:00
Chris Lattner
af532f27e7
Implement a todo, rewriting all possible scev expressions inside of the
...
loop. This eliminates the extra add from the previous case, but it's
not clear that this will be a performance win overall. Tommorows test
results will tell. :)
llvm-svn: 13103
2004-04-21 23:36:08 +00:00
Chris Lattner
dc7cc35088
Implement a fixme. The helps loops that have induction variables of different
...
types in them. Instead of creating an induction variable for all types, it
creates a single induction variable and casts to the other sizes. This generates
this code:
no_exit: ; preds = %entry, %no_exit
%indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; <uint> [#uses=4]
*** %j.0.0 = cast uint %indvar to short ; <short> [#uses=1]
%indvar = cast uint %indvar to int ; <int> [#uses=1]
%tmp.7 = getelementptr short* %P, uint %indvar ; <short*> [#uses=1]
store short %j.0.0, short* %tmp.7
%inc.0 = add int %indvar, 1 ; <int> [#uses=2]
%tmp.2 = setlt int %inc.0, %N ; <bool> [#uses=1]
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=1]
br bool %tmp.2, label %no_exit, label %loopexit
instead of:
no_exit: ; preds = %entry, %no_exit
%indvar = phi ushort [ %indvar.next, %no_exit ], [ 0, %entry ] ; <ushort> [#uses=2]
*** %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ] ; <uint> [#uses=3]
%indvar = cast uint %indvar to int ; <int> [#uses=1]
%indvar = cast ushort %indvar to short ; <short> [#uses=1]
%tmp.7 = getelementptr short* %P, uint %indvar ; <short*> [#uses=1]
store short %indvar, short* %tmp.7
%inc.0 = add int %indvar, 1 ; <int> [#uses=2]
%tmp.2 = setlt int %inc.0, %N ; <bool> [#uses=1]
%indvar.next = add uint %indvar, 1
*** %indvar.next = add ushort %indvar, 1
br bool %tmp.2, label %no_exit, label %loopexit
This is an improvement in register pressure, but probably doesn't happen that
often.
The more important fix will be to get rid of the redundant add.
llvm-svn: 13101
2004-04-21 22:22:01 +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
a814080025
If the loop executes a constant number of times, try a bit harder to replace
...
exit values.
llvm-svn: 13018
2004-04-17 18:44:09 +00:00
Chris Lattner
885a6eb74d
Even if there are not any induction variables in the loop, if we can compute
...
the trip count for the loop, insert one so that we can canonicalize the exit
condition.
llvm-svn: 13015
2004-04-17 18:08:33 +00:00
Chris Lattner
9e9b2b7474
Fix some of the strange CBE-only failures that happened last night.
...
llvm-svn: 12980
2004-04-16 06:03:17 +00:00
Chris Lattner
d7a559e353
Fix a bug in the previous checkin: if the exit block is not the same as
...
the back-edge block, we must check the preincremented value.
llvm-svn: 12968
2004-04-15 20:26:22 +00:00
Chris Lattner
0cec5cb92c
Change the canonical induction variable that we insert.
...
Instead of producing code like this:
Loop:
X = phi 0, X2
...
X2 = X + 1
if (X != N-1) goto Loop
We now generate code that looks like this:
Loop:
X = phi 0, X2
...
X2 = X + 1
if (X2 != N) goto Loop
This has two big advantages:
1. The trip count of the loop is now explicit in the code, allowing
the direct implementation of Loop::getTripCount()
2. This reduces register pressure in the loop, and allows X and X2 to be
put into the same register.
As a consequence of the second point, the code we generate for loops went
from:
.LBB2: # no_exit.1
...
mov %EDI, %ESI
inc %EDI
cmp %ESI, 2
mov %ESI, %EDI
jne .LBB2 # PC rel: no_exit.1
To:
.LBB2: # no_exit.1
...
inc %ESI
cmp %ESI, 3
jne .LBB2 # PC rel: no_exit.1
... which has two fewer moves, and uses one less register.
llvm-svn: 12961
2004-04-15 15:21:43 +00:00
Chris Lattner
e61b67d7d5
Rewrite the indvars pass to use the ScalarEvolution analysis.
...
This also implements some new features for the indvars pass, including
linear function test replacement, exit value substitution, and it works with
a much more general class of induction variables and loops.
llvm-svn: 12620
2004-04-02 20:24:31 +00:00
Chris Lattner
59d2d7fc33
Improve encapsulation in the Loop and LoopInfo classes by eliminating the
...
getSubLoops/getTopLevelLoops methods, replacing them with iterator-based
accessors.
llvm-svn: 10714
2004-01-08 00:09:44 +00:00
Chris Lattner
7e755e443f
More minor non-functional changes. This now computes the exit condition, though
...
it doesn't do anything with it.
llvm-svn: 10590
2003-12-23 07:47:09 +00:00
Chris Lattner
a02d5aa6ce
Don't mind me, I'm just refactoring away. This patch makes room for LFTR, but
...
contains no functionality changes.
llvm-svn: 10583
2003-12-22 09:53:29 +00:00
Chris Lattner
6449dcefbc
Implement IndVarsSimplify/pointer-indvars.ll, transforming pointer
...
arithmetic into "array subscripts"
llvm-svn: 10580
2003-12-22 05:02:01 +00:00
Chris Lattner
d3678bc7c5
Fix PR194
...
llvm-svn: 10573
2003-12-22 03:58:44 +00:00
John Criswell
b22e9b4b35
Reverted back to previous revision - this was previously merged
...
according to the CVS log messages.
llvm-svn: 10517
2003-12-18 17:19:19 +00:00
John Criswell
86a3a48697
Merged in RELEASE_11.
...
llvm-svn: 10516
2003-12-18 16:43:17 +00:00
Chris Lattner
6c08bb8b8e
Fix for PR185 & IndVarsSimplify/2003-12-15-Crash.llx
...
llvm-svn: 10473
2003-12-15 17:34:02 +00:00
Chris Lattner
713907e2b8
Fix bug: IndVarsSimplify/2003-12-10-RemoveInstrCrash.llx
...
llvm-svn: 10385
2003-12-10 20:43:04 +00:00
Chris Lattner
ccd9f3c1f8
Finegrainify namespacification
...
Reorder #includes
Implement: IndVarsSimplify/2003-12-10-IndVarDeadCode.ll
llvm-svn: 10376
2003-12-10 18:06:47 +00:00
Brian Gaeke
960707c335
Put all LLVM code into the llvm namespace, as per bug 109.
...
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
John Criswell
482202a601
Added LLVM project notice to the top of every C++ source file.
...
Header files will be on the way.
llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner
72272a70b8
Rename loop preheaders pass to loop simplify
...
llvm-svn: 9061
2003-10-12 21:52:28 +00:00
Misha Brukman
8b2bd4ed47
Fix spelling.
...
llvm-svn: 9027
2003-10-10 17:57:28 +00:00
Chris Lattner
295b907cee
Fix bug: IndVarsSimplify/2003-09-23-NotAtTop.ll
...
llvm-svn: 8689
2003-09-23 20:26:48 +00:00
Chris Lattner
099ec07a95
Make sure to cannonicalize loops before running indvar simplify
...
llvm-svn: 8502
2003-09-12 16:45:01 +00:00
Chris Lattner
4e621cd861
Spelling fixes. I think that "cannonical" is ok, but "canonical" appears to
...
be the canonical form for the word
llvm-svn: 8430
2003-09-10 05:24:46 +00:00
Chris Lattner
36257f049e
Fix up file header
...
llvm-svn: 8428
2003-09-10 05:10:34 +00:00
Chris Lattner
8abcd56c74
DEBUG got moved to Support/Debug.h
...
llvm-svn: 7492
2003-08-01 22:15:03 +00:00
Chris Lattner
889f620841
Remove unnecesary &*'s
...
llvm-svn: 5872
2003-04-23 16:37:45 +00:00
Chris Lattner
820d971233
- Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to
...
setPreservesCFG to be less confusing.
llvm-svn: 4255
2002-10-21 20:00:28 +00:00
Chris Lattner
bf3a099a62
Updates to work with recent Statistic's changes:
...
* Renamed StatisticReporter.h/cpp to Statistic.h/cpp
* Broke constructor to take two const char * arguments instead of one, so
that indendation can be taken care of automatically.
* Sort the list by pass name when printing
* Make sure to print all statistics as a group, instead of randomly when
the statistics dtors are called.
* Updated ProgrammersManual with new semantics.
llvm-svn: 4002
2002-10-01 22:38:41 +00:00
Chris Lattner
28a8d2468a
Simplify code (somtimes dramatically), by using the new "auto-insert" feature
...
of instruction constructors.
llvm-svn: 3656
2002-09-10 17:04:02 +00:00
Chris Lattner
4184bcc701
* Clean up code a little bit
...
* Fix bug: test/Regression/Transforms/IndVarsSimplify/2002-09-09-PointerIndVar.ll
llvm-svn: 3644
2002-09-10 05:24:05 +00:00
Chris Lattner
f0ed55d1ee
- Cleaned up the interface to AnalysisUsage to take analysis class names
...
instead of ::ID's.
- Pass::getAnalysis<> now no longer takes an optional argument
llvm-svn: 3265
2002-08-08 19:01:30 +00:00
Chris Lattner
2675007573
* Standardize how analysis results/passes as printed with the print() virtual
...
methods
* Eliminate AnalysisID: Now it is just a typedef for const PassInfo*
* Simplify how AnalysisID's are initialized
* Eliminate Analysis/Writer.cpp/.h: incorporate printing functionality into
the analyses themselves.
llvm-svn: 3116
2002-07-27 01:12:17 +00:00
Chris Lattner
c8b7092e54
* Add support for different "PassType's"
...
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Add support for different "PassType's"
* Add new RegisterOpt/RegisterAnalysis templates for registering passes that
are to show up in opt or analyze
* Register Analyses now
* Change optimizations to use RegisterOpt instead of RegisterPass
* Remove getPassName implementations from various subclasses
llvm-svn: 3113
2002-07-26 21:12:46 +00:00
Chris Lattner
b28b680155
*** empty log message ***
...
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner
33422fedc2
*** empty log message ***
...
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Anand Shukla
2bc6419a82
changes to make it compatible with 64bit gcc
...
llvm-svn: 2792
2002-06-25 21:07:58 +00:00
Chris Lattner
113f4f4609
MEGAPATCH checkin.
...
For details, See: docs/2002-06-25-MegaPatchInfo.txt
llvm-svn: 2779
2002-06-25 16:13:24 +00:00
Chris Lattner
71cbd42b98
Use the new DEBUG(x) macro to allow debugging code to be enabled on the commandline
...
llvm-svn: 2713
2002-05-22 17:17:27 +00:00
Chris Lattner
0b18c1d64e
Add support for printing out statistics information when -stats is added to
...
the command line
llvm-svn: 2601
2002-05-10 15:38:35 +00:00
Chris Lattner
b4cfa7ff97
Merge all individual .h files into a single Scalar.h file
...
llvm-svn: 2537
2002-05-07 20:03:00 +00:00
Chris Lattner
d5a847057b
Eliminate duplicate or unneccesary #include's
...
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner
37104aace8
Add new optional getPassName() virtual function that a Pass can override
...
to make debugging output a lot nicer.
llvm-svn: 2395
2002-04-29 14:57:45 +00:00
Chris Lattner
f12cc842b3
Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate whether or not they invalidate the CFGA
...
llvm-svn: 2386
2002-04-28 21:27:06 +00:00
Chris Lattner
ca14237696
Split ConstantVals.h into Constant.h and Constants.h
...
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner
78dd56fe62
Eliminate the cfg namespace, moving LoopInfo, Dominators, Interval* classes
...
to the global namespace
llvm-svn: 2370
2002-04-28 16:21:30 +00:00
Chris Lattner
c8e665431b
* Rename MethodPass class to FunctionPass
...
- Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
- Method is now const
- It now takes one AnalysisUsage object to fill in instead of 3 vectors
to fill in
- Pass's now specify which other passes they _preserve_ not which ones
they modify (be conservative!)
- A pass can specify that it preserves all analyses (because it never
modifies the underlying program)
* s/Method/Function/g in other random places as well
llvm-svn: 2333
2002-04-27 06:56:12 +00:00
Chris Lattner
2716b5e524
Change Constant::getNullConstant to Constant::getNullValue
...
llvm-svn: 2323
2002-04-27 02:25:14 +00:00
Chris Lattner
f8e4dc33ab
s/Method/Function
...
Remove extraneous #includes of llvm/Assembly/Writer
llvm-svn: 2178
2002-04-08 22:03:00 +00:00
Chris Lattner
04805fa29c
Change over to use new style pass mechanism, now passes only expose small
...
creation functions in their public header file, unless they can help it.
llvm-svn: 1816
2002-02-26 21:46:54 +00:00
Chris Lattner
83d485b310
* Pull BasicBlock::pred_* and BasicBlock::succ_* out of BasicBlock.h and into
...
llvm/Support/CFG.h
* Make pred & succ iterators for intervals global functions
* Add #includes that are now neccesary because BasicBlock.h doesn't include
InstrTypes.h anymore
llvm-svn: 1750
2002-02-12 22:39:50 +00:00
Chris Lattner
60a6591d83
Method.h no longer includes BasicBlock.h
...
Method::inst_* is now in llvm/Support/InstIterator.h
GraphTraits specializations for BasicBlock and Methods are now in llvm/Support/CFG.h
llvm-svn: 1746
2002-02-12 21:07:25 +00:00
Chris Lattner
352151e222
MethodPass's are now guaranteed to not be run on external methods!
...
llvm-svn: 1611
2002-01-31 00:51:24 +00:00
Chris Lattner
d5d56780e2
Convert xforms over to new pass structure.
...
llvm-svn: 1605
2002-01-31 00:45:11 +00:00
Chris Lattner
7f74a56e24
Changes to build successfully with GCC 3.02
...
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner
674394077f
Actually return true when a change has been made
...
llvm-svn: 1425
2001-12-05 19:41:33 +00:00
Chris Lattner
d23d752dc5
Fix bugs, don't do external methods which causes segv.
...
llvm-svn: 1414
2001-12-04 08:13:06 +00:00
Chris Lattner
91daaabb56
Implement induction variable simplification
...
llvm-svn: 1411
2001-12-04 04:32:29 +00:00
Chris Lattner
476e6df794
Initial checkin of indvar stuff
...
llvm-svn: 1404
2001-12-03 17:28:42 +00:00