Chris Lattner
cd709cbf53
Load & StoreInst no longer derive from MemAccessInst, so we don't have
...
to handle indexing anymore
llvm-svn: 3485
2002-08-22 22:49:05 +00:00
Chris Lattner
a51fa88702
Add capability of using pointer analysis to LICM
...
llvm-svn: 3478
2002-08-22 21:39:55 +00:00
Chris Lattner
faea121df7
Remove long obsolete comments
...
llvm-svn: 3476
2002-08-22 21:25:54 +00:00
Chris Lattner
f6c0efa754
Instcombine PHI's of the form %PN = phi PN, X into X and
...
%PN = phi PN, PN, PN into 0 (because the phi must not be reachable)
llvm-svn: 3470
2002-08-22 20:22:01 +00:00
Chris Lattner
879cb97f63
Convert GCSE pass to use new alias analysis infrastructure
...
llvm-svn: 3463
2002-08-22 18:24:48 +00:00
Chris Lattner
c86203ace3
- Split Dominators.h into Dominators.h & PostDominators.h
...
llvm-svn: 3432
2002-08-21 23:43:50 +00:00
Chris Lattner
6f66bc8016
Remove an optimization that isn't.
...
llvm-svn: 3419
2002-08-21 22:10:06 +00:00
Chris Lattner
b8d6e40ed7
- instcombine (~(a < b)) into (a >= b)
...
llvm-svn: 3406
2002-08-20 18:24:26 +00:00
Chris Lattner
9cd1e66155
- implemented instcombine of phi (X, X, X) -> X
...
llvm-svn: 3397
2002-08-20 15:35:35 +00:00
Chris Lattner
c59af1d257
Promote getelementptr instructions to constexprs if we can.
...
llvm-svn: 3368
2002-08-17 22:21:59 +00:00
Chris Lattner
3732acab85
Handle more cases of cast-of-cast in more general forms.
...
llvm-svn: 3347
2002-08-15 16:15:25 +00:00
Chris Lattner
0bb75910e2
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
313fd77767
Avoid inserting an entry block unless we need it
...
llvm-svn: 3336
2002-08-14 21:35:02 +00:00
Chris Lattner
b80b69cc3e
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
b193ff8f70
Remove support for NOT instruction
...
llvm-svn: 3323
2002-08-14 18:18:02 +00:00
Chris Lattner
0f4093938a
Remove extra #includes
...
llvm-svn: 3322
2002-08-14 18:17:32 +00:00
Chris Lattner
6e1a1b1289
Remove support for unary operators
...
llvm-svn: 3318
2002-08-14 17:53:45 +00:00
Chris Lattner
31ae863284
- 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
8328263606
- Rename ConstantGenericIntegral -> ConstantIntegral
...
llvm-svn: 3300
2002-08-13 17:50:24 +00:00
Chris Lattner
e6794490ec
* 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
6d14f2a7ae
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
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
650449a1df
Remove extraneous #includes
...
llvm-svn: 3262
2002-08-08 19:00:34 +00:00
Vikram S. Adve
4737dd7268
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
650b6da0f9
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
ae7a0d39fd
* 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
f56bd89918
Fix bug: test/Regression/Transforms/GCSE/2002-05-21-NoSharedDominator.ll
...
llvm-svn: 3215
2002-08-02 18:06:01 +00:00
Chris Lattner
33fca976ee
* 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
3be5d0b892
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
ee420b7f9d
Fix bug: test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll
...
llvm-svn: 3129
2002-07-29 22:31:39 +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
64eea749de
*** empty log message ***
...
llvm-svn: 3105
2002-07-26 18:40:14 +00:00
Chris Lattner
10073a9080
*** empty log message ***
...
llvm-svn: 3075
2002-07-25 06:17:51 +00:00
Chris Lattner
42706e4dec
Merge ChangeAllocations into scalar.h
...
llvm-svn: 3038
2002-07-23 22:04:17 +00:00
Chris Lattner
b28b680155
*** empty log message ***
...
llvm-svn: 3016
2002-07-23 18:06:35 +00:00
Chris Lattner
6788f25f99
* Remove getPassName implementation
...
* Register all Passes
llvm-svn: 3015
2002-07-23 18:06:30 +00:00
Chris Lattner
a896b08b5c
*** empty log message ***
...
llvm-svn: 3002
2002-07-23 17:52:38 +00:00
Chris Lattner
b2c5cb2525
Disable folding g-e-p instructions into loads and stores.
...
llvm-svn: 2870
2002-07-10 22:37:17 +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
194138cd08
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
ab038d44b0
Simplify the interface to local DCE and Constant prop
...
llvm-svn: 2749
2002-05-26 20:18:18 +00:00
Chris Lattner
9c2765d4aa
Fold add X, 0 for floating point types as well
...
llvm-svn: 2734
2002-05-23 17:11:38 +00:00
Chris Lattner
559f0ee9c9
Fix and implement ADCE to finally work!
...
llvm-svn: 2720
2002-05-22 21:32:16 +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
a482d52ff4
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
fa7dad8cd5
New CFG Simplification pass: removed from the old DCE pass
...
llvm-svn: 2700
2002-05-21 20:49:37 +00:00
Chris Lattner
b710b1fb22
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
7bc532dded
* 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
cd9837d32e
* 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
170ed7b6a3
Fix bug: test/Regression/Transforms/InstCombine/2002-05-14-SubFailure.ll
...
llvm-svn: 2627
2002-05-14 16:44:07 +00:00
Chris Lattner
053c0939e3
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
d38ddb1164
Implement elimination of loads
...
llvm-svn: 2620
2002-05-14 05:02:40 +00:00
Chris Lattner
7ab51787ca
Trivial cleanups
...
llvm-svn: 2617
2002-05-13 22:04:46 +00:00
Chris Lattner
6ec05f551c
Initial checkin of LICM pass
...
llvm-svn: 2615
2002-05-10 22:44:58 +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
bad1b4dfce
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
014ee634ce
Initial checkin of the PiNodeInsertion pass
...
llvm-svn: 2593
2002-05-10 05:41:34 +00:00
Chris Lattner
1fc23f382e
Handle setcc <global*>, 0 instructions, Global pointers are never null!
...
llvm-svn: 2582
2002-05-09 20:11:54 +00:00
Chris Lattner
6bd7ac6205
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
ad3c495225
Add ability to transform (x - (y - z)) into (x + (z - y))
...
llvm-svn: 2566
2002-05-09 01:29:19 +00:00
Chris Lattner
147e975c43
* Combine: A-(-B) -> A + B
...
* Bugfix: A + -B and -A + B
llvm-svn: 2561
2002-05-08 22:46:53 +00:00
Chris Lattner
c0f5800678
Initial checkin of expression reassociation pass
...
llvm-svn: 2559
2002-05-08 22:19:27 +00:00
Chris Lattner
c1496bda61
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
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
77f791dd5b
Split ChangeAllocations.cpp into Raise & LowerAllocations.cpp
...
llvm-svn: 2529
2002-05-07 19:02:48 +00:00
Chris Lattner
7608a46cbe
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
9b55e5a2f4
Reduce dependance on TransformInternals.h, instead using the TransformUtils library
...
llvm-svn: 2518
2002-05-07 18:12:18 +00:00
Chris Lattner
3d86d49604
Add #include no longer included by llvm/Transforms/Scalar/ConstantProp.h
...
llvm-svn: 2517
2002-05-07 18:11:30 +00:00
Chris Lattner
560da70f8c
Factor code out to the TransformUtils library
...
llvm-svn: 2516
2002-05-07 18:10:55 +00:00
Chris Lattner
d66a6e33e9
* 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
87e8806f05
* 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
a6e047a5d9
Only do masking for unsigned values!
...
llvm-svn: 2504
2002-05-06 18:54:59 +00:00
Chris Lattner
e548507e8c
* 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
bbbdd852b8
Handle X = phi Y --> X = Y
...
llvm-svn: 2501
2002-05-06 18:06:38 +00:00
Chris Lattner
4c3366405a
* 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
019f3649bd
Clean up ADCE by removing extraneous wrapper class
...
llvm-svn: 2494
2002-05-06 17:27:57 +00:00
Chris Lattner
5d6bec5e26
Combine not (not X) -> X
...
llvm-svn: 2493
2002-05-06 17:03:21 +00:00
Chris Lattner
9fa53de7e9
Support more cases...
...
llvm-svn: 2490
2002-05-06 16:49:18 +00:00
Chris Lattner
f4cdbf34e5
Add many more instruction combination simplifications
...
llvm-svn: 2484
2002-05-06 16:14:14 +00:00
Chris Lattner
66e25b8b62
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
940daedc22
Implement constant propogation of shift instructions
...
llvm-svn: 2471
2002-05-06 03:01:37 +00:00
Chris Lattner
7b80b53ab9
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
dd390e1736
Oops, disable debugging code all the way. :)
...
llvm-svn: 2447
2002-05-02 21:47:40 +00:00
Chris Lattner
fe6c9eeae3
* 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
13b52e71d8
* 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
5364d1a74a
* 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
48a44f7e23
* 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
31ba129cbe
Add folding rules for mul X, 0 and mul X, 2
...
llvm-svn: 2417
2002-04-29 22:24:47 +00:00
Chris Lattner
7d3253876a
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
27eeecbb69
Range insertion now returns an iterator
...
llvm-svn: 2414
2002-04-29 21:25:34 +00:00
Chris Lattner
09bbb5c015
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
15e8f4c012
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
d5a847057b
Eliminate duplicate or unneccesary #include's
...
llvm-svn: 2397
2002-04-29 17:42:12 +00:00
Chris Lattner
2dfc667a7d
Remove broken assertion.
...
llvm-svn: 2396
2002-04-29 16:20:25 +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
8d843f6b77
More cleanups
...
llvm-svn: 2392
2002-04-29 01:58:47 +00:00
Chris Lattner
fc1a433dae
Code cleanups
...
llvm-svn: 2391
2002-04-29 01:22:55 +00:00