1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 13:02:52 +02:00
Commit Graph

607 Commits

Author SHA1 Message Date
Chris Lattner
c4bd846e84 - Split Dominators.h into Dominators.h & PostDominators.h
llvm-svn: 3432
2002-08-21 23:43:50 +00:00
Chris Lattner
a154f5fa97 Remove an optimization that isn't.
llvm-svn: 3419
2002-08-21 22:10:06 +00:00
Chris Lattner
ad92b604b5 - instcombine (~(a < b)) into (a >= b)
llvm-svn: 3406
2002-08-20 18:24:26 +00:00
Chris Lattner
22116975ce - implemented instcombine of phi (X, X, X) -> X
llvm-svn: 3397
2002-08-20 15:35:35 +00:00
Chris Lattner
04d2780d12 Promote getelementptr instructions to constexprs if we can.
llvm-svn: 3368
2002-08-17 22:21:59 +00:00
Chris Lattner
caaca8d4c9 Handle more cases of cast-of-cast in more general forms.
llvm-svn: 3347
2002-08-15 16:15:25 +00:00
Chris Lattner
83f92a7237 Implement capability to fold this:
uint %test4(int %A, int %B) {
        %COND = setlt int %A, %B                ; <bool> [#uses=1]
        %result = cast bool %COND to uint               ; <uint> [#uses=1]
        ret uint %result
}
into a single cast instruction.

llvm-svn: 3339
2002-08-14 23:21:10 +00:00
Chris Lattner
80b897953e Avoid inserting an entry block unless we need it
llvm-svn: 3336
2002-08-14 21:35:02 +00:00
Chris Lattner
760f32d641 Fix bug introduced in last checkin due to CastInst not being visible
llvm-svn: 3327
2002-08-14 18:22:19 +00:00
Chris Lattner
980bf4b44d Remove support for NOT instruction
llvm-svn: 3323
2002-08-14 18:18:02 +00:00
Chris Lattner
34a9a81756 Remove extra #includes
llvm-svn: 3322
2002-08-14 18:17:32 +00:00
Chris Lattner
c264beb7c5 Remove support for unary operators
llvm-svn: 3318
2002-08-14 17:53:45 +00:00
Chris Lattner
890adeb7a2 - Fix InstCombine pass to not generate or process NOT instructions
- Fixed testcases to not use them either.

llvm-svn: 3315
2002-08-14 17:51:49 +00:00
Chris Lattner
b6a04772b5 - Rename ConstantGenericIntegral -> ConstantIntegral
llvm-svn: 3300
2002-08-13 17:50:24 +00:00
Chris Lattner
a6ba1b74ac * Factor a bunch of code by using ReplaceInstUsesWith
* Move isMaxValue, isMinValue, isAllOnesValue to Constants.h

llvm-svn: 3290
2002-08-12 21:17:25 +00:00
Chris Lattner
0a51808266 New functionality for instcombine:
* New ReplaceInstUsesWith function to factor out tons of common code
     This needs to be used more in the future still, but it's a good start
   * New InsertNewInstBefore to allow multi-instruction replacements
   * Change getMaxValue functions to isAllOnesValue function, which doesn't
     have to CREATE/lookup a new constant.  Also the name is accurate
   * Add new isMaxValue, isMinValue, isMaxValueMinusOne, isMinValuePlusOne
     functions:  This should be moved to Constant* classes eventually
   * Implement xor X, ALLONES -> not X
   * Fold ALL setcc's of booleans away
   * Handle various SetCC's for integers against values at the end of their
     ranges, possibly off by one.  This implements the setcc-strength-reduce.ll
     testcase.

llvm-svn: 3286
2002-08-09 23:47:40 +00:00
Chris Lattner
a21e315db4 - 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
62fb7f0304 Remove extraneous #includes
llvm-svn: 3262
2002-08-08 19:00:34 +00:00
Vikram S. Adve
bbe47f2e7d Eliminate cast instructions: use only GEPs in decomposed sequence.
Don't decompose if there are 2 indices with 0 as first index.
Compute Changed flag correctly in runOnBasicBlock().

llvm-svn: 3233
2002-08-03 13:21:15 +00:00
Chris Lattner
c840f0ec2a Fix bug: test/Regression/Transforms/InstCombine/2002-08-02-CastTest.ll
Implement feature: Cast's can now be converted to bitwise AND expressions.

llvm-svn: 3225
2002-08-02 20:00:25 +00:00
Chris Lattner
5d9be21256 * Cleanups of instcombine
- Reenable gep (gep x) -> x
   - Make instcombine do dead instruction elimination where it's really
     easy.  Now visitors don't have to ensure they aren't not processing
     dead instructions.

llvm-svn: 3222
2002-08-02 19:29:35 +00:00
Chris Lattner
b55222222e Fix bug: test/Regression/Transforms/GCSE/2002-05-21-NoSharedDominator.ll
llvm-svn: 3215
2002-08-02 18:06:01 +00:00
Chris Lattner
b9052f081a * Fix bug: test/Regression/Transforms/ADCE/2002-07-17-AssertionFailure.ll
which was caused by us not running the "drop references of dead
  instructions" code when there were no basic blocks that were dead.

  We still don't want to do some of the stuff we do if there are dead
  basic blocks, but we DO want to drop references of dead instructions,
  so we factor the common code out to a new method.

llvm-svn: 3137
2002-07-30 00:22:34 +00:00
Chris Lattner
72b8a38a26 Add code to ensure that no PHI nodes are left laying around with their
arguments dropped.  This fixes bug:
   test/Regression/Transforms/ADCE/2002-07-17-PHIAssertion.ll

llvm-svn: 3134
2002-07-29 23:40:46 +00:00
Chris Lattner
5aef91b716 Fix bug: test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll
llvm-svn: 3129
2002-07-29 22:31:39 +00:00
Chris Lattner
ec2780457d * 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
7a9eb848cd * 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
ec1a192b16 *** empty log message ***
llvm-svn: 3105
2002-07-26 18:40:14 +00:00
Chris Lattner
05fe67c0d2 *** empty log message ***
llvm-svn: 3075
2002-07-25 06:17:51 +00:00
Chris Lattner
921e366a5c Merge ChangeAllocations into scalar.h
llvm-svn: 3038
2002-07-23 22:04:17 +00:00
Chris Lattner
c482880f9e *** empty log message ***
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner
606421d005 * Remove getPassName implementation
* Register all Passes

llvm-svn: 3015
2002-07-23 18:06:30 +00:00
Chris Lattner
24bcbdd155 *** empty log message ***
llvm-svn: 3002
2002-07-23 17:52:38 +00:00
Chris Lattner
83577a047e Disable folding g-e-p instructions into loads and stores.
llvm-svn: 2870
2002-07-10 22:37:17 +00:00
Chris Lattner
a590093513 *** empty log message ***
llvm-svn: 2813
2002-06-30 16:25:25 +00:00
Anand Shukla
85065832f1 changes to make it compatible with 64bit gcc
llvm-svn: 2792
2002-06-25 21:07:58 +00:00
Chris Lattner
dfd421a7df MEGAPATCH checkin.
For details, See: docs/2002-06-25-MegaPatchInfo.txt

llvm-svn: 2779
2002-06-25 16:13:24 +00:00
Chris Lattner
779f966ce5 Avoid deleting individual instructions until AFTER dead blocks have dropped
their references.  This fixes bug:
    test/Regression/Transforms/ADCE/2002-05-28-Crash*.ll

llvm-svn: 2753
2002-05-28 21:38:16 +00:00
Chris Lattner
b95dde758a Simplify the interface to local DCE and Constant prop
llvm-svn: 2749
2002-05-26 20:18:18 +00:00
Chris Lattner
9dde5c9df7 Fold add X, 0 for floating point types as well
llvm-svn: 2734
2002-05-23 17:11:38 +00:00
Chris Lattner
1f66858791 Fix and implement ADCE to finally work!
llvm-svn: 2720
2002-05-22 21:32:16 +00:00
Chris Lattner
1f2723a2c9 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
245c8615e4 Fix bug: test/Regression/Transforms/SCCP/2002-05-21-InvalidSimplify.ll
Improperly handling edges... by not marking them alive properly

llvm-svn: 2707
2002-05-22 16:07:20 +00:00
Chris Lattner
bb7416fa7f New CFG Simplification pass: removed from the old DCE pass
llvm-svn: 2700
2002-05-21 20:49:37 +00:00
Chris Lattner
c3d944c4f7 Fix bug: test/Regression/Transforms/SCCP/2002-05-20-MissedIncomingValue.ll
That was causing a miscompilation of strtol/atoi plus others

llvm-svn: 2669
2002-05-20 20:48:03 +00:00
Chris Lattner
a524df6d1d * Make debug output conditional on #define
* Add optimization to rank computation to not recursively search when
  unneccesary.
* More agressively negate expressions to open reassociation opportunities.
* Linearize (A+B)+(C+D) into ((A+B)+C)+D

llvm-svn: 2637
2002-05-16 04:37:07 +00:00
Chris Lattner
fc21b26332 * Fix bug: test/Regression/Transforms/GCSE/2002-05-14-OperandSwap.ll
By making sure to consider binary expressions identical if their operands
are backwards, but swappable.

llvm-svn: 2629
2002-05-14 19:57:25 +00:00
Chris Lattner
8106c7a841 Fix bug: test/Regression/Transforms/InstCombine/2002-05-14-SubFailure.ll
llvm-svn: 2627
2002-05-14 16:44:07 +00:00
Chris Lattner
0ee0c26f4e Fix bug: test/Regression/Transforms/InstCombine/2002-05-14-TouchDeletedInst.ll
"This testcase caused instcombine to fail because it got the same instruction on
it's worklist more than once (which is ok), but then deleted the instruction.
Since the inst stayed on the worklist, as soon as it came back up to be
processed, bad things happened, and opt asserted."

llvm-svn: 2623
2002-05-14 15:24:07 +00:00
Chris Lattner
b7688286c1 Implement elimination of loads
llvm-svn: 2620
2002-05-14 05:02:40 +00:00
Chris Lattner
fc14cb90a2 Trivial cleanups
llvm-svn: 2617
2002-05-13 22:04:46 +00:00
Chris Lattner
1b769f2a94 Initial checkin of LICM pass
llvm-svn: 2615
2002-05-10 22:44:58 +00:00
Chris Lattner
adba963886 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
1bf8912c74 Fix some bugs, straighten stuff out, more work needs to be done.
llvm-svn: 2600
2002-05-10 15:37:35 +00:00
Chris Lattner
2d91be1ab7 Initial checkin of the PiNodeInsertion pass
llvm-svn: 2593
2002-05-10 05:41:34 +00:00
Chris Lattner
cd326f096f Handle setcc <global*>, 0 instructions, Global pointers are never null!
llvm-svn: 2582
2002-05-09 20:11:54 +00:00
Chris Lattner
9de1aeb91c Give the longer name to the instruction that will probably be eliminated later
llvm-svn: 2581
2002-05-09 20:11:23 +00:00
Chris Lattner
172488eb68 Add ability to transform (x - (y - z)) into (x + (z - y))
llvm-svn: 2566
2002-05-09 01:29:19 +00:00
Chris Lattner
34d5891f0a * Combine: A-(-B) -> A + B
* Bugfix:  A + -B and -A + B

llvm-svn: 2561
2002-05-08 22:46:53 +00:00
Chris Lattner
c38d2de2b5 Initial checkin of expression reassociation pass
llvm-svn: 2559
2002-05-08 22:19:27 +00:00
Chris Lattner
bbd8a94a9b Fix bug: test/Regression/Transforms/ADCE/2002-01-31-UseStuckAround.ll
Cleanup code a lot

llvm-svn: 2547
2002-05-07 22:11:39 +00:00
Chris Lattner
2a43c7c03d Merge all individual .h files into a single Scalar.h file
llvm-svn: 2537
2002-05-07 20:03:00 +00:00
Chris Lattner
e125e808a8 Split ChangeAllocations.cpp into Raise & LowerAllocations.cpp
llvm-svn: 2529
2002-05-07 19:02:48 +00:00
Chris Lattner
9e1c79995e Updates to move some header files out of include/llvm/Transforms into
the Scalar and Utils subdirectories

llvm-svn: 2523
2002-05-07 18:36:35 +00:00
Chris Lattner
c5a6d978b8 Reduce dependance on TransformInternals.h, instead using the TransformUtils library
llvm-svn: 2518
2002-05-07 18:12:18 +00:00
Chris Lattner
a35a291f7b Add #include no longer included by llvm/Transforms/Scalar/ConstantProp.h
llvm-svn: 2517
2002-05-07 18:11:30 +00:00
Chris Lattner
c099f62190 Factor code out to the TransformUtils library
llvm-svn: 2516
2002-05-07 18:10:55 +00:00
Chris Lattner
394781b660 * Convert InstWorkList to vector instead of set, because on big programs it
is empirically faster by a noticable margin, even though duplicates can
  happen.

llvm-svn: 2511
2002-05-07 04:29:32 +00:00
Chris Lattner
4a830e1a4a * Remove all cfg simplification stuff for a new cfg simplify pass (todo)
* Convert to worklist instead of iterative algorithm

llvm-svn: 2510
2002-05-07 04:24:11 +00:00
Chris Lattner
ca538273d4 Only do masking for unsigned values!
llvm-svn: 2504
2002-05-06 18:54:59 +00:00
Chris Lattner
66ff017174 * Eliminate dead code that should have been removed in last revision
* Convert main constant propogation pass to be worklist driven instead of
  iterative.
* -constprop pass no longer "constant propogates" terminator instructions
   - CFG is now preserved!

llvm-svn: 2502
2002-05-06 18:21:31 +00:00
Chris Lattner
24ebec1273 Handle X = phi Y --> X = Y
llvm-svn: 2501
2002-05-06 18:06:38 +00:00
Chris Lattner
910ca80941 * Use simplified interface to constant propogation stuff.
* Remove dead PHI case (which could not work due to getNumOperands rather than
  getNumIncomingValues.  This really belongs in InstCombine, anyway so we'll
  move it there.

llvm-svn: 2497
2002-05-06 17:54:10 +00:00
Chris Lattner
b40c1bf6f7 Clean up ADCE by removing extraneous wrapper class
llvm-svn: 2494
2002-05-06 17:27:57 +00:00
Chris Lattner
c5279917bc Combine not (not X) -> X
llvm-svn: 2493
2002-05-06 17:03:21 +00:00
Chris Lattner
24a94a50d8 Support more cases...
llvm-svn: 2490
2002-05-06 16:49:18 +00:00
Chris Lattner
24ebdf3f74 Add many more instruction combination simplifications
llvm-svn: 2484
2002-05-06 16:14:14 +00:00
Chris Lattner
ef7f8fc474 Merge blocks like this:
void "test3"(bool %T) {
        br bool %T, label %BB1, label %BB1
BB1:
        ret void
}

llvm-svn: 2472
2002-05-06 03:02:02 +00:00
Chris Lattner
d12eac0b1b Implement constant propogation of shift instructions
llvm-svn: 2471
2002-05-06 03:01:37 +00:00
Chris Lattner
9606fd4830 Ok, really it only takes me 3 times to get this right!
Now use #if 0 instead of #ifdef 0

llvm-svn: 2448
2002-05-02 21:49:50 +00:00
Chris Lattner
de442f70ac Oops, disable debugging code all the way. :)
llvm-svn: 2447
2002-05-02 21:47:40 +00:00
Chris Lattner
7d4f3ed1f2 * Finish the implementation of isEdgeFeasible this fixes bug:
test/Regression/Transforms/SCCP/2002-05-02-EdgeFailure.ll
* SCCP now preserves the CFG:  It leaves conditional branches the way they
  are in the program, not simplifying them.  A seperate pass should eliminate
  the potentially dead basic blocks and edges in the CFG.

llvm-svn: 2446
2002-05-02 21:44:00 +00:00
Chris Lattner
b30088a50d * Enable SCCP debugging to be turned on with a simple change of #define
* Change worklist to a set so that duplicates cannot happen
* Add support for the invoke instruction
* Avoid marking store and free instructions as overdefined, since they
  cannot produce a value anyway.
* Inline the OperandChangedState implementation
* Add isEdgeFeasible in preparation to fix a bug.  Right now it behaves
  exactly as before.
* Remove obsolete comment about constant pools

llvm-svn: 2445
2002-05-02 21:18:01 +00:00
Chris Lattner
28a8acc476 * Simplify the code by not bothering to name the folded constant
* Do not skip the instruction immediately after a folded instruction.  This
  was causing the testcase failure:
	test/Regression/Transforms/SCCP/2002-05-02-MissSecondInst.ll

llvm-svn: 2443
2002-05-02 20:32:51 +00:00
Chris Lattner
b7df910c1a * Add ability to eliminate a bunch of different cascading cast variations
* Allow elimination of getelementptr X, uint 0 (which is a noop)

llvm-svn: 2428
2002-05-02 17:06:02 +00:00
Chris Lattner
a6cb49c533 Add folding rules for mul X, 0 and mul X, 2
llvm-svn: 2417
2002-04-29 22:24:47 +00:00
Chris Lattner
5d1ac4dbc9 Significantly clean up SCCP pass. Now the two classes are merged and in
an anonymous namespace where they belong.

llvm-svn: 2415
2002-04-29 21:26:08 +00:00
Chris Lattner
48e73edf57 Range insertion now returns an iterator
llvm-svn: 2414
2002-04-29 21:25:34 +00:00
Chris Lattner
5d17e49ad5 Remove unused files: This is the old induction varaible cannonicalization
pass built on top of interval analysis

llvm-svn: 2411
2002-04-29 20:18:00 +00:00
Chris Lattner
f5d07697e6 changes because iMemory.h no longer #includes DerivedTypes.h
This only requires Type.h anyway

llvm-svn: 2405
2002-04-29 18:48:30 +00:00
Chris Lattner
96e0c48175 Eliminate duplicate or unneccesary #include's
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner
3909059b6a Remove broken assertion.
llvm-svn: 2396
2002-04-29 16:20:25 +00:00
Chris Lattner
589debc4ba 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
56828a18c4 More cleanups
llvm-svn: 2392
2002-04-29 01:58:47 +00:00
Chris Lattner
a8688d69c5 Code cleanups
llvm-svn: 2391
2002-04-29 01:22:55 +00:00
Chris Lattner
ec70d92221 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
321a8cf4ba Split ConstantVals.h into Constant.h and Constants.h
llvm-svn: 2378
2002-04-28 19:55:58 +00:00
Chris Lattner
07fe96ca98 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
0bd57e6e99 Initial checkin of simple&fast SSA based GCSE algorithm
llvm-svn: 2338
2002-04-28 00:47:11 +00:00
Chris Lattner
536cf1b13f * 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
0c04e4d1ef Changes because the Terminator::getSuccessor function now FAILS if successor
IDX is out of range instead of returning null.

llvm-svn: 2332
2002-04-27 03:15:45 +00:00
Chris Lattner
078d292f4c Change Constant::getNullConstant to Constant::getNullValue
llvm-svn: 2323
2002-04-27 02:25:14 +00:00
Chris Lattner
a392a80a60 Significantly rework InstructionCombining to work better and to be cleaner.
We now use an InstVisitor to delegate to different cases that we are
interested in handling.  We also fix the FIXME's by adding users to the
worklist when appropriate.

llvm-svn: 2292
2002-04-18 17:39:14 +00:00
Chris Lattner
bb60c83409 Convert SCCP over to use InstVisitor instead of hand crafted switch
llvm-svn: 2286
2002-04-18 15:13:15 +00:00
Chris Lattner
b736829547 GEP instructions can never be constant propogated.
llvm-svn: 2284
2002-04-18 14:44:13 +00:00
Chris Lattner
5e7d6d8066 Store instructions always return void, so they never get a name
llvm-svn: 2283
2002-04-18 14:43:54 +00:00
Chris Lattner
1923a5cfaa Eliminate cast of same type instructions.
llvm-svn: 2251
2002-04-15 19:45:29 +00:00
Chris Lattner
5e12c7caf5 Move FunctionArgument out of iOther.h into Argument.h and rename class to
be 'Argument' instead of FunctionArgument.

llvm-svn: 2216
2002-04-09 19:48:49 +00:00
Chris Lattner
b2038512b2 Add explicit #includes of Function.h to make up for the removed #include
in iOther.h

llvm-svn: 2209
2002-04-09 19:08:28 +00:00
Chris Lattner
7ae20d642d Add #includes to make up for #includes pruned out of header files.
llvm-svn: 2207
2002-04-09 18:37:46 +00:00
Chris Lattner
31e5838296 s/Method/Function
Remove extraneous #includes of llvm/Assembly/Writer

llvm-svn: 2178
2002-04-08 22:03:00 +00:00
Chris Lattner
44f14449c4 ConstantHandling moved into VMCore library
llvm-svn: 2165
2002-04-08 20:18:09 +00:00
Chris Lattner
bc15ae64dd Change references to the Method class to be references to the Function
class.  The Method class is obsolete (renamed) and all references to it
are being converted over to Function.

llvm-svn: 2144
2002-04-07 20:49:59 +00:00
Chris Lattner
b7f4043df7 Simplify code a lot by using the Module::getFunction & getOrInsertFunction
llvm-svn: 2028
2002-03-29 03:38:05 +00:00
Chris Lattner
849c762b02 Change references from Method to Function
change references from MethodARgument to FunctionArgument

llvm-svn: 1991
2002-03-26 18:01:55 +00:00
Vikram S. Adve
1f5e8f93cc Major overhaul to support arbitrary mixed array and structure indices.
Also moved to the Scalar/ directory and renamed to "MultiDim".

llvm-svn: 1961
2002-03-24 03:21:18 +00:00
Vikram S. Adve
3294262573 New pass to decompose multi-dimensional array references into
a sequence of 1-D references, using a sequence of getElementPtrs.

llvm-svn: 1948
2002-03-23 20:43:39 +00:00
Chris Lattner
b0128957b1 Fix bug: test/Regression/Other/2002-03-11-InstCombineHang.ll
llvm-svn: 1864
2002-03-11 23:28:45 +00:00
Chris Lattner
889b1e5b00 Fix bug: test/Regression/Other/2002-03-11-ConstPropCrash.ll
llvm-svn: 1858
2002-03-11 22:11:07 +00:00
Chris Lattner
e2383e8592 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
8e9be000a7 * 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
b0a2c5546b 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
dc15bb209d 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
2e463f5dbe Convert xforms over to new pass structure.
llvm-svn: 1605
2002-01-31 00:45:11 +00:00
Chris Lattner
2cab187296 Remove extraneous #includes
llvm-svn: 1588
2002-01-26 22:47:32 +00:00
Chris Lattner
0fea9f487b Remove opt namespace
llvm-svn: 1587
2002-01-26 22:47:07 +00:00
Chris Lattner
71ee02c009 Implement new DeadInstElmination pass
remove old comment

llvm-svn: 1555
2002-01-23 05:48:24 +00:00
Chris Lattner
e12b9f9277 Don't insert a useless cast
llvm-svn: 1527
2002-01-22 03:30:06 +00:00
Chris Lattner
4cecd63a42 Rename LowerAllocations.h to ChangeAllocations.h since it now contains the
RaiseAllocations pass as well.

llvm-svn: 1525
2002-01-22 01:04:08 +00:00
Chris Lattner
83056c99ec Pull RaiseAllocations stuff out of the CleanGCC pass into it's own pass in
the ChangeAllocations.h header file.

llvm-svn: 1522
2002-01-22 00:13:51 +00:00
Chris Lattner
250d937680 LowerAllocations is really a BasicBlock pass. Make it so.
llvm-svn: 1521
2002-01-21 23:34:02 +00:00
Chris Lattner
4454cdc5c0 Move stuff out of the Optimizations directories into the appropriate Transforms
directories.  Eliminate the opt namespace.

llvm-svn: 1520
2002-01-21 23:17:48 +00:00
Chris Lattner
2521ae1011 Implement a more powerful, simpler, pass system. This pass system can figure
out how to run a collection of passes optimially given their behaviors and
charactaristics.

Convert code to use it.

llvm-svn: 1507
2002-01-21 07:31:50 +00:00
Chris Lattner
3dc9a2a61f Changes to build successfully with GCC 3.02
llvm-svn: 1503
2002-01-20 22:54:45 +00:00
Chris Lattner
37ba4e2bb7 initial checkin
llvm-svn: 1480
2001-12-14 16:52:21 +00:00
Chris Lattner
9e6ccdd858 Remove unsized array support
llvm-svn: 1466
2001-12-14 16:38:04 +00:00
Chris Lattner
488f202019 Assertion could never fail because another one would in it's place. :)
llvm-svn: 1449
2001-12-13 00:45:40 +00:00
Chris Lattner
d89106f96b Actually return true when a change has been made
llvm-svn: 1425
2001-12-05 19:41:33 +00:00
Chris Lattner
7059b60173 Fix a bug introduced by "internal linkage" work.
llvm-svn: 1415
2001-12-04 18:01:49 +00:00
Chris Lattner
8ec5ceb110 Fix bugs, don't do external methods which causes segv.
llvm-svn: 1414
2001-12-04 08:13:06 +00:00
Chris Lattner
bd85988c94 Implement induction variable simplification
llvm-svn: 1411
2001-12-04 04:32:29 +00:00
Chris Lattner
c4a5815033 Renamed inst_const_iterator -> const_inst_iterator
Renamed op_const_iterator   -> const_op_iterator
Renamed PointerType::getValueType() -> PointerType::getElementType()

llvm-svn: 1408
2001-12-04 00:03:30 +00:00
Chris Lattner
f6b7da2bb5 Rename ConstPoolVal -> Constant
Rename ConstPool*   -> Constant*
Rename ConstPoolVals.h -> ConstantVals.h

llvm-svn: 1407
2001-12-03 22:26:30 +00:00
Chris Lattner
bcf2df7058 Split the PHINode class out from the iOther.h file into the iPHINode.h file
llvm-svn: 1405
2001-12-03 18:02:31 +00:00
Chris Lattner
a337749b35 Initial checkin of indvar stuff
llvm-svn: 1404
2001-12-03 17:28:42 +00:00
Chris Lattner
463cc31132 Create a new #include "Support/..." directory structure to move things
from "llvm/Support/..." that are not llvm dependant.

Move files and fix #includes

llvm-svn: 1400
2001-11-27 00:03:19 +00:00
Chris Lattner
d10d3f1015 Misc cleanups
llvm-svn: 1377
2001-11-26 18:57:38 +00:00
Chris Lattner
8fd567523c Expose constant propogation of an instruction in a clean way
llvm-svn: 1376
2001-11-26 18:57:12 +00:00
Chris Lattner
e33afc1d46 Add #includes to enable buiding in Release mode
llvm-svn: 1174
2001-11-07 13:49:45 +00:00
Chris Lattner
82c7401f23 Avoid making a broken transformation!
llvm-svn: 1115
2001-11-03 21:30:22 +00:00
Chris Lattner
a621bac2a6 Expose the low level DCE mechanism to external users
Refactor code to support it

llvm-svn: 1083
2001-11-01 07:00:27 +00:00
Chris Lattner
3b2c78da03 Simplify DCE code a lot
llvm-svn: 1079
2001-11-01 05:55:29 +00:00
Chris Lattner
986e273442 Use the correct prototype for malloc and free
llvm-svn: 1066
2001-10-31 06:36:23 +00:00
Chris Lattner
91fc057638 Implemented constant propogation of cast instructions
llvm-svn: 1064
2001-10-31 05:07:57 +00:00
Chris Lattner
40372ce62d Convert to new simpler pass itf
llvm-svn: 880
2001-10-18 05:27:33 +00:00
Chris Lattner
4429216038 Convert optimizations to the pass infrastructure
llvm-svn: 873
2001-10-18 01:32:34 +00:00
Chris Lattner
9bfad5b7b1 Add new Pass infrastructure and some examples
llvm-svn: 836
2001-10-15 17:31:51 +00:00
Chris Lattner
4c81efaf8e Support the invoke instruction
llvm-svn: 765
2001-10-13 06:52:41 +00:00
Chris Lattner
08b1dde37e Commit more code over to new cast style
llvm-svn: 697
2001-10-02 03:41:24 +00:00
Chris Lattner
ad1b0a1a83 Convert more code to use new style casts
Eliminate old style casts from value.h

llvm-svn: 696
2001-10-01 20:11:19 +00:00
Chris Lattner
4c684cde80 Add more support for new style casts
Convert more code to use them

llvm-svn: 695
2001-10-01 18:26:53 +00:00
Chris Lattner
43781f1f96 Add support for new style casts
llvm-svn: 694
2001-10-01 16:18:37 +00:00
Chris Lattner
345daca305 Pull predecessor and successor iterators out of the CFG*.h files, and plop them into
the BasicBlock class where they should be.  pred_begin/pred_end become methods on BasicBlock,
and the cfg namespace isn't used anymore.

llvm-svn: 691
2001-10-01 13:19:53 +00:00
Chris Lattner
9b45b18404 Pull iterators out of CFG.h and CFGdecls and put them in Support directory
llvm-svn: 664
2001-09-28 22:56:31 +00:00
Chris Lattner
2fc6c49ee7 ADCE is broken but at least we know why
llvm-svn: 656
2001-09-28 00:06:42 +00:00
Chris Lattner
c583ae1a1a Make ADCE more robust, it still has problems, but it's getting closer
llvm-svn: 521
2001-09-09 22:26:47 +00:00
Chris Lattner
e299925703 Types and constants are wierd things in symbol tables now
llvm-svn: 457
2001-09-07 16:43:50 +00:00
Chris Lattner
b82abeff92 * Eliminate reference to ConstantPool class
* Constants are global objects that are not allocated or freed

llvm-svn: 456
2001-09-07 16:43:22 +00:00
Chris Lattner
4fc1bcadd9 Constants are now global unique objects
llvm-svn: 454
2001-09-07 16:42:26 +00:00
Chris Lattner
eaf4551d57 * Eliminate constant pool dependancies:
* Eliminate DoRemoveUnusedConstants

llvm-svn: 453
2001-09-07 16:42:08 +00:00
Chris Lattner
6a211421bf * Supoprt global constants
* Remove support for local constant pools
* Eliminate constant pool merging method, which is no longer neccesary
* Disable invalid optimization (todo: fix it)

llvm-svn: 452
2001-09-07 16:41:30 +00:00
Chris Lattner
a4b4e46e90 Enable the elimination of method prototypes that are not referenced
llvm-svn: 325
2001-07-28 17:51:49 +00:00
Chris Lattner
ff6c44f04f Moved inline/llvm/Tools/* to include/llvm/Support/*
llvm-svn: 279
2001-07-23 17:46:59 +00:00
Chris Lattner
11f4097f50 Support external methods
llvm-svn: 200
2001-07-15 21:43:45 +00:00
Chris Lattner
a969eb234b Add knowledge about the struct form of the GetElementPtr instruction
llvm-svn: 183
2001-07-14 06:11:51 +00:00
Chris Lattner
10ff90d678 Remove dependency on the structure of ValueHolder.
llvm-svn: 182
2001-07-14 06:11:26 +00:00
Chris Lattner
80c9d7c165 Don't clean out the type plane of the constant pool... this is a hack. FIXME
llvm-svn: 172
2001-07-09 19:38:52 +00:00
Chris Lattner
3b66715c67 Implement checking for new instructions
llvm-svn: 163
2001-07-08 21:18:49 +00:00
Chris Lattner
acc906f1de Use the CDG to mark branches alive on demand.
llvm-svn: 159
2001-07-08 18:38:36 +00:00
Chris Lattner
7a7ddef47e Neg instruction removed. Cast instruction implemented.
llvm-svn: 156
2001-07-08 04:57:15 +00:00
Chris Lattner
c00392210d Broad superficial changes:
* Renamed getOpcode to getOpcodeName
* Changed getOpcodeName to return a const char * instead of string
* Added a getOpcode method to replace getInstType
* Changed code to use getOpcode instead of getInstType

llvm-svn: 152
2001-07-07 19:24:15 +00:00
Chris Lattner
6f7587e4d3 Changed the fundemental architecture of Operands for Instructions. Now
Operands are maintained as a vector<Use> in the User class, and operator
iterators are provided as before.  Getting an operand no longer requires
a virtual function call.

WARNING: getOperand(x) where x >= getNumOperands() will now assert instead
of returning null!

llvm-svn: 149
2001-07-07 08:36:50 +00:00
Chris Lattner
e28135f621 Update to include right file
llvm-svn: 138
2001-07-06 16:32:07 +00:00
Chris Lattner
d4e8817fd9 Initial checkin. Should print dead instructions, except it doesn't do
control dependencies.  :(

llvm-svn: 119
2001-06-30 06:39:11 +00:00
Chris Lattner
c4e564a84c Rename DoSparseConditionalConstantProp -> DoSCCP
llvm-svn: 117
2001-06-30 06:37:43 +00:00
Chris Lattner
0815f96a2f Optimizations got their own header files
Optimizations now live in the 'opt' namespace
include/llvm/Opt was renamed include/llvm/Optimizations

llvm-svn: 113
2001-06-30 04:36:40 +00:00
Chris Lattner
fd733edaa7 Export ConstantFoldTerminator, allow it to fold conditional branches to
the same label.

llvm-svn: 107
2001-06-29 23:56:58 +00:00
Chris Lattner
81bbbcfe1f Added documentation. Constant fold terminators.
llvm-svn: 106
2001-06-29 23:56:23 +00:00
Chris Lattner
e005dc792d * Factored RemovePredecessorFromBlock into BasicBlock::removePredecessor
* Avoid messing around with this case:
  br label %A
%A:  br label %A
* Enable optimizations that are correct now.

llvm-svn: 102
2001-06-29 05:24:28 +00:00
Chris Lattner
f5b28afa04 We need to make sure to remove PHI nodes in the successor that cannot be
executed when removing branch dest.

llvm-svn: 101
2001-06-29 05:23:10 +00:00
Chris Lattner
d616582a7a Miscellaneous cleanups:
* Convert post to pre-increment for for loops
  * Use generic programming more
  * Use new Value::cast* instructions
  * Use new Module, Method, & BasicBlock forwarding methods
  * Use new facilities in STLExtras.h
  * Use new Instruction::isPHINode() method

llvm-svn: 96
2001-06-27 23:41:11 +00:00
Chris Lattner
0a37aa1884 Add a new Sparse Conditional Constant Propogation pass
llvm-svn: 95
2001-06-27 23:38:11 +00:00
Chris Lattner
87259414f9 Misc cleanup
llvm-svn: 91
2001-06-27 23:36:09 +00:00
Chris Lattner
c9c6ca507f * Expose DoConstantPoolMerging
* Cleanups (post->pre increment, new cleaner API, etc)
* Moved stuff into ConstantHandling.h

llvm-svn: 90
2001-06-27 23:35:26 +00:00
Chris Lattner
725a64614c Implement induction variable injection!
llvm-svn: 75
2001-06-25 07:32:19 +00:00
Chris Lattner
105f271c39 A silly stupid test of the loop depth calculator was added. REMOVE in the
future.

llvm-svn: 72
2001-06-25 03:55:37 +00:00
Chris Lattner
89a7836d09 #include a different header due to Intervals.h splitting up
llvm-svn: 63
2001-06-24 04:05:45 +00:00
Chris Lattner
4ebfee6ae4 Implement a lot more functionality. Now loop invariant and linear
induction variables are correctly identified.

llvm-svn: 57
2001-06-22 02:24:38 +00:00
Chris Lattner
b87e26435e Moved printing code to the Assembly/Writer library.
Code now detects looping intervals

llvm-svn: 52
2001-06-21 05:27:22 +00:00
Chris Lattner
5d07eeb20a Get rid of a silly printout that isn't needed right now
llvm-svn: 45
2001-06-20 23:09:39 +00:00
Chris Lattner
3f0d248cea Add capability to print a derived interval graph
llvm-svn: 42
2001-06-20 22:44:38 +00:00
Chris Lattner
30200aa462 Add a test case for interval code
llvm-svn: 36
2001-06-20 19:27:11 +00:00
Chris Lattner
469c33ad89 Updates to work with new cfg namespace
llvm-svn: 29
2001-06-13 19:55:22 +00:00
Chris Lattner
a6d2f96bdb Updates to support
* Changes in PHI node structure

llvm-svn: 25
2001-06-11 15:04:40 +00:00
Chris Lattner
5975876e9b Updated to work with new CFG.h file.
llvm-svn: 15
2001-06-07 21:18:45 +00:00
Chris Lattner
68035d3c02 Significant rework. DCE is still not done (see #ifdef'd out parts)
but at least the stuff that is checked in, now works.

llvm-svn: 10
2001-06-07 16:59:26 +00:00
Chris Lattner
e6b9b382e2 Initial revision
llvm-svn: 2
2001-06-06 20:29:01 +00:00