Chris Lattner
dfae8be3c9
Allow folding several instructions into casts, which can simplify a lot
...
of codes. For example,
short kernel (short t1) {
t1 >>= 8; t1 <<= 8;
return t1;
}
became:
short %kernel(short %t1.1) {
%tmp.3 = shr short %t1.1, ubyte 8 ; <short> [#uses=1]
%tmp.5 = cast short %tmp.3 to int ; <int> [#uses=1]
%tmp.7 = shl int %tmp.5, ubyte 8 ; <int> [#uses=1]
%tmp.8 = cast int %tmp.7 to short ; <short> [#uses=1]
ret short %tmp.8
}
before, now it becomes:
short %kernel(short %t1.1) {
%tmp.3 = shr short %t1.1, ubyte 8 ; <short> [#uses=1]
%tmp.8 = shl short %tmp.3, ubyte 8 ; <short> [#uses=1]
ret short %tmp.8
}
which will become:
short %kernel(short %t1.1) {
%tmp.3 = and short %t1.1, 0xFF00
ret short %tmp.3
}
This implements cast-set.ll:test4 and test5
llvm-svn: 7290
2003-07-24 17:35:25 +00:00
Chris Lattner
bfb1d03159
Add comments
...
llvm-svn: 7283
2003-07-23 21:41:57 +00:00
Chris Lattner
9763859e8d
Remove explicit check for: not (not X) = X, it is already handled because xor is commutative
...
- InstCombine: (X & C1) ^ C2 --> (X & C1) | C2 iff (C1&C2) == 0
- InstCombine: (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2
llvm-svn: 7282
2003-07-23 21:37:07 +00:00
Chris Lattner
33217db4d9
InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0
...
llvm-svn: 7272
2003-07-23 19:36:21 +00:00
Chris Lattner
16464b36ff
- InstCombine: (X | C1) & C2 --> X & C2 iff C1 & C1 == 0
...
- InstCombine: (X | C) & C --> C
- InstCombine: (X | C1) & C2 --> (X | (C1&C2)) & C2
llvm-svn: 7269
2003-07-23 19:25:52 +00:00
Chris Lattner
8f0d15601a
IC: (X & C1) | C2 --> (X | C2) & (C1|C2)
...
IC: (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)
We are now guaranteed that all 'or's will be inside of 'and's, and all 'and's
will be inside of 'xor's, if the second operands are constants.
llvm-svn: 7264
2003-07-23 18:29:44 +00:00
Chris Lattner
49b47ae565
IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
...
Minor code cleanup
llvm-svn: 7262
2003-07-23 17:57:01 +00:00
Chris Lattner
cfbce7c880
InstCombine: (X ^ 4) == 8 --> X == 12
...
llvm-svn: 7260
2003-07-23 17:26:36 +00:00
Chris Lattner
d492a0b7b4
IC: (X & 5) == 13 --> false
...
IC: (X | 8) == 4 --> false
llvm-svn: 7257
2003-07-23 17:02:11 +00:00
Chris Lattner
6077c3195f
Simplify code by using ConstantInt::getRawValue instead of checking to see
...
whether the constant is signed or unsigned, then casting
llvm-svn: 7252
2003-07-23 15:22:26 +00:00
Chris Lattner
d78ebd0c6b
Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
...
llvm-svn: 7243
2003-07-23 03:32:41 +00:00
Chris Lattner
bdb0ce0605
- InstCombine (cast (xor A, B) to bool) ==> (setne A, B)
...
- InstCombine (cast (and X, (1 << size(X)-1)) to bool) ==> x < 0
llvm-svn: 7241
2003-07-22 21:46:59 +00:00
John Criswell
d6dcbc6ce8
Added code that checks to see if a global variable is external before replacing
...
a load of the global variable with the variable's constant value.
llvm-svn: 7216
2003-07-21 19:42:57 +00:00
John Criswell
0643ceafcf
Dinakar and I fixed a bug where we were trying to get the initializer of
...
an external constant. Since external constants don't have initializers, we
were failing on an assert() call in llvm/GlobalVariable.h.
llvm-svn: 7193
2003-07-17 19:06:55 +00:00
Chris Lattner
0f1d8a3947
Add support for elimination of load instruction from global constants
...
llvm-svn: 6912
2003-06-26 05:06:25 +00:00
Chris Lattner
35236d8477
Instcombine: X * -1 -> -X
...
llvm-svn: 6904
2003-06-25 17:09:20 +00:00
Chris Lattner
b396afde26
Fix bug: Mem2Reg/2003-06-26-IterativePromote.ll
...
llvm-svn: 6901
2003-06-25 14:58:56 +00:00
Chris Lattner
ee967711e9
Fix bug: ADCE/2003-06-24-BadSuccessor.ll
...
llvm-svn: 6891
2003-06-24 23:02:45 +00:00
Chris Lattner
834105502d
Do not mark ALL terminators live if any instruciton in the block is live. We only
...
want to mark it live if it is an unconditional branch. This fixes bug:
ADCE/2002-05-28-Crash.ll and makes this pass _much_ more useful.
llvm-svn: 6887
2003-06-24 21:49:45 +00:00
Chris Lattner
7e270580c8
Fix bug: SCCP/2003-06-24-OverdefinedPHIValue.ll
...
llvm-svn: 6883
2003-06-24 20:29:52 +00:00
Chris Lattner
f7544873de
Fix bug: TailDup/2003-06-24-Simpleloop.ll
...
llvm-svn: 6881
2003-06-24 19:48:06 +00:00
Chris Lattner
55d4bda861
Implement new transforms:
...
Replace (cast (sub A, B) to bool) -> (setne A, B)
Replace (cast (add A, B) to bool) -> (setne A, -B)
llvm-svn: 6873
2003-06-23 21:59:52 +00:00
Chris Lattner
92963de6fa
Add paranoia checking
...
llvm-svn: 6856
2003-06-22 20:46:00 +00:00
Chris Lattner
268c1392da
Test change
...
llvm-svn: 6852
2003-06-22 20:25:27 +00:00
Chris Lattner
a5434caa5c
Initial checkin of Tail duplication pass.
...
llvm-svn: 6846
2003-06-22 20:10:28 +00:00
Chris Lattner
d0d51605b2
Instcombine cast (getelementptr Ptr, 0, 0, 0) to ... into: cast Ptr to ...
...
This fixes type safety problems in a variety of benchmarks that were confusing
DSA.
llvm-svn: 6837
2003-06-21 23:12:02 +00:00
Chris Lattner
970c33abb1
Implement the functionality of InstCombine/call.ll
...
llvm-svn: 6783
2003-06-19 17:00:31 +00:00
Chris Lattner
2a8c301c9f
Don't corrupt memory when removing an instruction from the program, but
...
not the worklist
llvm-svn: 6733
2003-06-17 03:57:18 +00:00
Chris Lattner
dc62f1e021
Fix bug: ADCE/2003-06-11-InvalidCFG.ll
...
This was because we were deleting large chunks of functions without an exit block, because the post-dominance
information was not useful. This broke crafty and twolf.
llvm-svn: 6698
2003-06-16 12:10:45 +00:00
Chris Lattner
45789aca97
Fix bug: InstCombine/2003-06-05-BranchInvertInfLoop.ll
...
llvm-svn: 6630
2003-06-05 20:12:51 +00:00
Chris Lattner
e967b348bf
Clean up previous code.
...
Add new combination to turn seteq X, 0 -> not(cast X to bool)
llvm-svn: 6604
2003-06-04 05:10:11 +00:00
Chris Lattner
9eef8a78b4
Implement combination of boolean not with branch
...
llvm-svn: 6599
2003-06-04 04:46:00 +00:00
Chris Lattner
791ac1a4c8
Implement xform: (X != 0) -> (bool)X
...
llvm-svn: 6506
2003-06-01 03:35:25 +00:00
Chris Lattner
0078d9c5bb
Okay totally give up on trying to optimize aggregates that cannot be completely
...
broken up into their elements. Too many programs break because of this.
llvm-svn: 6440
2003-05-30 19:22:14 +00:00
Chris Lattner
d847be0539
add a check that allows the SRoA pass to avoid breaking programs, even if their
...
behavior is technically undefined
llvm-svn: 6438
2003-05-30 18:09:57 +00:00
Chris Lattner
38d88c07f4
Fix bug: ScalarRepl/2003-05-30-MultiLevel.ll
...
llvm-svn: 6428
2003-05-30 05:26:30 +00:00
Chris Lattner
6e5398d69d
Fix bug: ScalarRepl/2003-05-29-ArrayFail.ll
...
llvm-svn: 6425
2003-05-30 04:15:41 +00:00
Chris Lattner
6c81ebc97d
Add comment
...
llvm-svn: 6415
2003-05-29 20:26:30 +00:00
Chris Lattner
3442844742
Fix bug: Instcombine/2003-05-27-ConstExprCrash.ll
...
llvm-svn: 6352
2003-05-27 16:40:51 +00:00
Chris Lattner
c16b210349
* Actually USE the statistic that we made
...
* Implement SRoA for arrays
llvm-svn: 6349
2003-05-27 16:09:27 +00:00
Chris Lattner
fb41a50d15
Implementation of the simple "scalar replacement of aggregates" transformation
...
llvm-svn: 6346
2003-05-27 15:45:27 +00:00
Chris Lattner
196897c424
Fix bug: InstCombine/2003-05-26-CastMiscompile.ll
...
llvm-svn: 6338
2003-05-26 23:41:32 +00:00
Chris Lattner
8d0a71aff8
Remove using declarations
...
llvm-svn: 6306
2003-05-22 22:00:07 +00:00
Chris Lattner
471bd76281
Minor cleanups.
...
This hunk:
- } else if (Src->getNumOperands() == 2 && Src->use_size() == 1) {
+ } else if (Src->getNumOperands() == 2) {
Allows GEP folding to be more aggressive, which reduces the number of instructions
and can dramatically speed up BasicAA in some cases.
llvm-svn: 6286
2003-05-22 19:07:21 +00:00
Misha Brukman
373086db75
Hopefully, the final fix for `[Pp]ropogate'.
...
llvm-svn: 6251
2003-05-20 21:01:22 +00:00
Misha Brukman
e5838c4d72
s/convertable/convertible/g
...
llvm-svn: 6248
2003-05-20 18:45:36 +00:00
Chris Lattner
652e7bf8a8
Fix long standing bug
...
llvm-svn: 6232
2003-05-15 18:25:13 +00:00
Chris Lattner
0895025b30
Fix bug: LoopPreheaders/2003-05-12-PreheaderExitOfChild.ll
...
llvm-svn: 6153
2003-05-12 22:04:34 +00:00
Chris Lattner
b02697210e
Handle va_arg instruction correctly
...
llvm-svn: 6030
2003-05-08 02:50:13 +00:00
Chris Lattner
3666378690
Fix spelling
...
llvm-svn: 5983
2003-05-02 19:26:34 +00:00
Chris Lattner
df7cc91159
Fix Bug: LowerSwitch/2003-05-01-PHIProblem.ll
...
llvm-svn: 5979
2003-05-01 22:21:21 +00:00
Chris Lattner
dd65d863a9
Fix another case where constexprs could cause a crash
...
llvm-svn: 5972
2003-04-30 22:34:06 +00:00
Chris Lattner
9244df60d3
Fix constant folding of constexprs
...
llvm-svn: 5971
2003-04-30 22:19:10 +00:00
Chris Lattner
b68a34eb3f
Fix bug: ADCE/2003-04-25-PHIPostDominateProblem.ll
...
llvm-svn: 5952
2003-04-25 22:53:27 +00:00
Chris Lattner
3c98276168
Fix major problem with PHI node traversal: rechecking PHIs should go into
...
the visit function. The worklist is for when their lattice value changes.
llvm-svn: 5927
2003-04-25 03:35:10 +00:00
Chris Lattner
cccc5c76c8
Minor non-functional changes:
...
* Spell propagate right
* Improve performance of phi node handling
* Delete using directive
* Other minor changes
llvm-svn: 5920
2003-04-25 02:50:03 +00:00
Chris Lattner
889f620841
Remove unnecesary &*'s
...
llvm-svn: 5872
2003-04-23 16:37:45 +00:00
Chris Lattner
1b094a0f2e
New pass to lower switch instructions to branch instructions
...
llvm-svn: 5865
2003-04-23 16:23:59 +00:00
Chris Lattner
1f45f4e4d8
Minor cleanups
...
llvm-svn: 5863
2003-04-23 16:18:14 +00:00
Chris Lattner
46b3d30bf6
Change the interface to constant expressions to allow automatic folding
...
llvm-svn: 5793
2003-04-16 22:40:51 +00:00
Chris Lattner
9023155621
Initial checkin of PRE on LLVM. This implementation is still lacking in
...
several ways:
* Load expressions are not PRE'd well. Alias Analysis should be used to
get accurate information when computing anticipatibility.
* The expression collection implementation does not handle PHI nodes properly,
thus the implementation misses many opportunities to PRE.
* This code could be sped up quite a bit
Despite these flaws, the code seems to work well, and handles PR's as one
would expect.
llvm-svn: 5759
2003-03-31 19:55:43 +00:00
Chris Lattner
c42046f9f1
Move BreakCriticalEdges pass to lib/Transforms/Utils
...
llvm-svn: 5754
2003-03-21 21:43:19 +00:00
Chris Lattner
7fb29e19f0
Add the following instcombine xforms:
...
- Implement simple reassociation: (A|c1)|(B|c2) == (A|B)|(c1|c2)
- (A & C1)+(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
- (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0
llvm-svn: 5743
2003-03-11 00:12:48 +00:00
Chris Lattner
934a64cfa4
Implement: -A*-B == A*B
...
llvm-svn: 5740
2003-03-10 23:23:04 +00:00
Chris Lattner
3e327a4334
Add new transformation: // (~A | ~B) == (~(A & B))
...
llvm-svn: 5738
2003-03-10 23:13:59 +00:00
Chris Lattner
bb74e2284a
Generalize not and neg comparison testers to allow constant to be considered not'able and neg'able. This
...
allows optimization of this:
int %test4(int %A, int %B) {
%a = xor int %A, -1
%c = and int %a, 5 ; 5 = ~c2
%d = xor int %c, -1
ret int %d
}
into this:
int %test4(int %A, int %B) { ; No predecessors!
%c.demorgan = or int %A, -6 ; <int> [#uses=1]
ret int %c.demorgan
}
llvm-svn: 5736
2003-03-10 23:06:50 +00:00
Chris Lattner
dcf240a649
Generalize (A+c1)+c2 optimization to work with all associative operators
...
llvm-svn: 5733
2003-03-10 21:43:22 +00:00
Chris Lattner
3695257724
Minor change, no functionality diff
...
llvm-svn: 5731
2003-03-10 19:20:30 +00:00
Chris Lattner
e8d6c604bb
Fix bug: (x << 100) wasn't folded to 0, but (x >> 100) was (when x is unsigned)
...
Implement new shift optimizations for shifting the result of a shift.
llvm-svn: 5729
2003-03-10 19:16:08 +00:00
Chris Lattner
1bbb7b6f19
Implement: (A|B)^B == A & (~B)
...
llvm-svn: 5728
2003-03-10 18:24:17 +00:00
Chris Lattner
235af5673b
Implement %test7 in InstCombine/getelementptr.ll
...
llvm-svn: 5704
2003-03-05 22:33:14 +00:00
Chris Lattner
0592bb7654
Convert LICM over to use AliasSetTracker. Besides being nicer, this automatically
...
allows LICM to use access sizes to help alias analysis be more precise.
llvm-svn: 5693
2003-03-03 23:32:45 +00:00
Chris Lattner
e27406eb59
Change the mem2reg interface to accept a TargetData argument
...
llvm-svn: 5685
2003-03-03 17:25:18 +00:00
Chris Lattner
e19a9f8ef7
Fix bug: LICM/2003-02-28-PromoteDifferentType.ll
...
llvm-svn: 5675
2003-02-28 19:21:40 +00:00
Chris Lattner
49eb0e3026
Fix bug I introduced yesterday :(
...
llvm-svn: 5669
2003-02-28 16:54:17 +00:00
Chris Lattner
32a39c26e0
Fix bug: LICM/2003-02-27-PreheaderExitNodeUpdate.ll
...
llvm-svn: 5667
2003-02-28 03:07:54 +00:00
Chris Lattner
f2d9f94a33
Fix bug: 2003-02-27-PreheaderExitNodeUpdate.ll by updating exit node info
...
llvm-svn: 5664
2003-02-27 22:48:57 +00:00
Chris Lattner
10b2b055e8
Add a new assertion to check that stuff is happening right
...
Ironically the exit block modification code wasn't updating the exit block
information itself. Fix this.
llvm-svn: 5659
2003-02-27 22:31:07 +00:00
Chris Lattner
1ad80e2511
Fix bug: 2003-02-27-StoreSinkPHIs.ll
...
llvm-svn: 5658
2003-02-27 21:59:36 +00:00
Chris Lattner
4e2fbfb4c3
* Don't forget to update Loop information!
...
* Remove bogus assertion: there may be a single outside predecessor and
still need a new loop-preheader if the predecessor has multiple
successors. See bug: LICM/2003-02-27-PreheaderProblem.ll
llvm-svn: 5655
2003-02-27 21:50:19 +00:00
Chris Lattner
650096a061
* Significant changes to the preheader insertion pass:
...
- Now we perform loop exit-block splitting to ensure exit blocks are
always dominated by the loop header.
- We now preserve dominance frontier information
- This fixes bug: LICM/2003-02-26-LoopExitNotDominated.ll
llvm-svn: 5652
2003-02-27 20:27:08 +00:00
Chris Lattner
71b82bb494
Convert to work with new AliasAnalysis interface by conservatively assuming all pointers are arbitrarily large accesses
...
llvm-svn: 5636
2003-02-26 19:28:57 +00:00
Chris Lattner
4869f3700e
Rename Instruction::hasSideEffects() -> mayWriteToMemory()
...
llvm-svn: 5620
2003-02-24 20:48:32 +00:00
Chris Lattner
45d67d6ea7
Initial implementation of Loop invariant memory->scalar promotion
...
llvm-svn: 5613
2003-02-24 03:52:32 +00:00
Chris Lattner
26f159046c
Split mem2reg promotion into two parts: a function which does the work, and
...
a pass which wraps the function. This allows other passes to use the functionality
llvm-svn: 5610
2003-02-22 23:57:48 +00:00
Chris Lattner
57c8d99bbd
4 new transformations:
...
* X*C + X --> X * (C+1)
* X + X*C --> X * (C+1)
* X - X*C --> X * (1-C)
* X*C - X --> X * (C-1)
llvm-svn: 5592
2003-02-18 19:57:07 +00:00
Chris Lattner
3082c5a070
Add a variety of new transformations:
...
* A & ~A == 0
* A / (2^c) == A >> c if unsigned
* 0 / A == 0
* 1.0 * A == A
* A * (2^c) == A << c
* A ^ ~A == -1
* A | ~A == -1
* 0 % X = 0
* A % (2^c) == A & (c-1) if unsigned
* A - (A & B) == A & ~B
* -1 - A == ~A
llvm-svn: 5587
2003-02-18 19:28:33 +00:00
Chris Lattner
f683599915
Fix typo
...
llvm-svn: 5458
2003-02-01 04:50:59 +00:00
Chris Lattner
6fa1629c47
Fix bug: ADCE/2003-01-22-PredecessorProblem.ll
...
llvm-svn: 5405
2003-01-23 02:12:18 +00:00
Chris Lattner
3aa7767352
Fix a huge performance problem in reassociate by introducing a
...
rank map cache for instruction ranks
llvm-svn: 5030
2002-12-15 03:56:00 +00:00
Chris Lattner
f96c8befe0
Minor changes:
...
* Reword comment to make more clear
* Don't print out BB's after modification made
* Don't delete and new an instruction when we need to move something, just move it.
llvm-svn: 5029
2002-12-15 03:49:50 +00:00
Chris Lattner
688ac5b723
Remove dead code
...
llvm-svn: 4952
2002-12-07 18:42:13 +00:00
Chris Lattner
c6509f487b
Fix bug: 2002-12-05-MissedConstProp.ll pointed out by Casey Carter
...
llvm-svn: 4935
2002-12-05 22:41:53 +00:00
Chris Lattner
98cf1f5d64
- Eliminated the deferred symbol table stuff in Module & Function, it really
...
wasn't an optimization and it was causing lots of bugs.
llvm-svn: 4779
2002-11-20 18:36:02 +00:00
Chris Lattner
a2620ac156
Fix warning
...
llvm-svn: 4649
2002-11-09 00:49:43 +00:00
Chris Lattner
0da31d6648
Fix spelling error
...
llvm-svn: 4645
2002-11-08 23:18:37 +00:00
Chris Lattner
5d606a09ff
Instcombine this away:
...
%A = getelementptr [4 x int]* %M, long 0, long 0
%B = getelementptr int* %A, long 2
llvm-svn: 4536
2002-11-04 16:43:32 +00:00
Chris Lattner
1085bdf49f
Add a transformation to turn:
...
malloc Ty, C
int
malloc [C x Ty], 1
llvm-svn: 4534
2002-11-04 16:18:53 +00:00
Chris Lattner
669c6cf459
Make sure to _delete_ memory allocated by worklists
...
llvm-svn: 4523
2002-11-04 02:54:22 +00:00
Chris Lattner
8fdf75cde5
Fixes to the reassociate pass to make it respect dominance properties
...
Huge thanks go to Casey Carter for writing this fix, reassociate is now
reoperational!
llvm-svn: 4471
2002-10-31 17:12:59 +00:00
Chris Lattner
12764c85e8
BreakCriticalEdges should update dominance frontier information as well as
...
other dominance stuff. Patch contributed by Casey Carter
llvm-svn: 4457
2002-10-31 02:44:36 +00:00
Misha Brukman
632df28deb
Fix spelling of `propagate'.
...
llvm-svn: 4423
2002-10-29 23:06:16 +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
b7368500dc
- Fix bug: cee/2002-10-07-NoImmediateDominator.ll
...
llvm-svn: 4081
2002-10-08 21:53:51 +00:00
Chris Lattner
736709feda
- Checkin LARGE number of Changes to CEE pass that will make it much more
...
powerful, but that are largely disabled. The basic idea here is that it
is trying to forward branches across basic blocks that have PHI nodes in
it, which are crucial to be able to handle cases like whet.ll.
Unfortunately we are not updating SSA correctly, causing sim.c to die, and I
don't have time to fix the regression now, so I must disable the
functionality.
llvm-svn: 4077
2002-10-08 21:34:15 +00:00
Chris Lattner
5ac72defc9
Expose isCriticalEdge & SplitCriticalEdge methods from crit-edges pass
...
llvm-svn: 4075
2002-10-08 21:06:27 +00:00
Chris Lattner
394617f38b
It is illegal for PHI nodes to have zero values, delete the code to handle them
...
llvm-svn: 4071
2002-10-08 17:07:39 +00:00
Chris Lattner
2e0fb39d87
Fold ashr -1, X into -1
...
llvm-svn: 4070
2002-10-08 16:16:40 +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
05e86302f4
Fix bug in LICM that caused the previous big win. :(
...
llvm-svn: 3980
2002-09-29 22:26:07 +00:00
Chris Lattner
6443769b34
Hoist the contents of Loops in depth first order in the dominator tree,
...
rather than in random order. This causes LICM to be DRAMATICALLY more
effective. For example, on bzip2.c, it is able to hoist 302 loads and
2380 total instructions, as opposed to 44/338 before. This obviously
makes other transformations much more powerful as well!
llvm-svn: 3978
2002-09-29 21:46:09 +00:00
Chris Lattner
03a9e15a9f
Fix major bugs in dominator set & tree information updating
...
llvm-svn: 3975
2002-09-29 21:41:38 +00:00
Chris Lattner
d57f3f5073
- Further cleanups of LICM pass, remove extra work from previous implementation
...
- Do not clone instructions then insert clone outside of loop. Just move them.
llvm-svn: 3951
2002-09-26 19:40:25 +00:00
Chris Lattner
f64f2d3fb3
Improve comments, doxygenize more
...
llvm-svn: 3950
2002-09-26 16:52:07 +00:00
Chris Lattner
718b221ff8
Clean up LICM significantly now that it is guaranteed to have loop preheaders
...
llvm-svn: 3947
2002-09-26 16:38:03 +00:00
Chris Lattner
ca056914c6
Change pass name to something sane
...
llvm-svn: 3946
2002-09-26 16:37:37 +00:00
Chris Lattner
d771fdfd75
Loop invariant code motion now depends on the LoopPreheader pass. Dead code
...
has not yet been removed.
llvm-svn: 3945
2002-09-26 16:19:31 +00:00
Chris Lattner
bedbd6bc16
- Cleanup break-crit-edges pass by making SplitCriticalEdge a member method.
...
- break-crit-edges pass does not invalidate loop-preheader pass.
llvm-svn: 3944
2002-09-26 16:18:51 +00:00
Chris Lattner
61992f66d8
Checkin new loop-preheader insertion pass.
...
llvm-svn: 3942
2002-09-26 16:17:31 +00:00
Chris Lattner
3cab9f0396
Change LowerAllocations pass to 'require' TargetData instead of it being
...
passed in.
llvm-svn: 3929
2002-09-25 23:47:47 +00:00
Chris Lattner
4357e54760
Eliminate extraneous #include
...
llvm-svn: 3916
2002-09-24 21:18:40 +00:00
Chris Lattner
75f80bd0b6
- Do not expose Critical Edge breaking mechanics outside the BCE pass, thus
...
removing it from Transforms/Local.h and from Transforms/Utils/*
llvm-svn: 3910
2002-09-24 15:51:56 +00:00
Chris Lattner
b4e7e22be3
Correlated Exprs pass now requires BCE pass instead of doing it manually
...
llvm-svn: 3908
2002-09-24 15:43:56 +00:00
Chris Lattner
4bec665b09
- Expose passinfo from BreakCriticalEdges pass so that it may be "Required"
...
by other passes. Make BCE pass be in anonymous namespace now.
llvm-svn: 3907
2002-09-24 15:43:12 +00:00
Chris Lattner
b03832d5d0
Add new BreakCriticalEdges pass
...
llvm-svn: 3903
2002-09-24 00:08:39 +00:00
Chris Lattner
555518c70f
Optimize away cases like:
...
%cast109 = cast uint %cast212 to short ; <short> [#uses=1]
%cast214 = cast short %cast109 to uint ; <uint> [#uses=1]
%cast215 = cast uint %cast214 to short ; <short> [#uses=1]
llvm-svn: 3897
2002-09-23 23:39:43 +00:00
Chris Lattner
7ccb217f21
* Fix bug: CorrelatedExprs/2002-09-23-PHIUpdateBug.ll
...
* Make sure "Changed" is updated correctly
llvm-svn: 3891
2002-09-23 20:06:22 +00:00
Chris Lattner
a8339e3613
Fix bug: test/Regression/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll
...
Thanks to Casey for finding it!
llvm-svn: 3783
2002-09-17 21:05:42 +00:00
Vikram S. Adve
dba59921d7
Extract most of the transformation into an externally accessible
...
function -- DecomposeArrayRef(GetElementPtrInst* GEP) -- that can
be invoked on a single instruction at a time.
llvm-svn: 3755
2002-09-16 16:40:07 +00:00
Misha Brukman
2e8086f046
Function.h is unnecessary when Module.h is included.
...
llvm-svn: 3716
2002-09-14 03:04:02 +00:00
Chris Lattner
136dab7d86
- Change getelementptr instruction to use long indexes instead of uint
...
indexes for sequential types.
llvm-svn: 3682
2002-09-11 01:21:33 +00:00
Chris Lattner
cbc532603a
Fix the last of the silly bugs I just introduced. :(
...
llvm-svn: 3674
2002-09-10 23:46:10 +00:00
Chris Lattner
55f3d94b40
Add cannonicalization of shl X, 1 -> add X, X
...
llvm-svn: 3671
2002-09-10 23:04:09 +00:00
Chris Lattner
a239e6879d
Clean up code due to auto-insert constructors
...
llvm-svn: 3665
2002-09-10 22:38:47 +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
e103d178c5
Hack unneccesary now that shifts of pointers are no longer legal!
...
llvm-svn: 3640
2002-09-10 03:50:54 +00:00
Chris Lattner
b8bba6f765
Fix Bug: test/Regression/Transforms/InstCombine/2002-09-08-PointerShiftBug.ll
...
llvm-svn: 3626
2002-09-08 21:39:07 +00:00
Chris Lattner
bdb147c373
Minor simplification
...
llvm-svn: 3619
2002-09-08 18:55:04 +00:00
Chris Lattner
1871472e14
Initial checkin of Correlated Expression Elimination Pass
...
llvm-svn: 3599
2002-09-06 18:41:55 +00:00
Chris Lattner
b0b412e66e
- Renamed Type::isIntegral() to Type::isInteger()
...
- Added new method Type::isIntegral() that is the same as isInteger, but
also accepts bool.
llvm-svn: 3574
2002-09-03 01:08:28 +00:00
Chris Lattner
99f48c614d
Add constant prop & DIE to InstCombine, so it cleans up after itself
...
llvm-svn: 3568
2002-09-02 04:59:56 +00:00
Chris Lattner
dd6522e7a0
- Implement SCCP of getelementptr instructions
...
- Implement SCCP of globals into ConstantExprs hopefully opening new
opportunities for more SCCP.
llvm-svn: 3555
2002-08-30 23:39:00 +00:00
Chris Lattner
1b09a9ab68
Really minor cleanups
...
llvm-svn: 3549
2002-08-30 22:53:30 +00:00
Chris Lattner
b2a31090b1
- GCSE now no longer counts instructions not removed (due to no common
...
dominator as being removed)
- GCSE now uses new Value #'ing interface, instead of dealing with AA itself
- GCSE worklist implementation much simpler, class cleaned up.
llvm-svn: 3533
2002-08-30 20:22:29 +00:00
Chris Lattner
65217ff294
- instcombine demorgan's law: and (not A), (not B) == not (or A, B)
...
llvm-svn: 3495
2002-08-23 18:32:43 +00:00
Chris Lattner
dfb3a2cd07
Eliminated the MemAccessInst class, folding contents into GEP class.
...
llvm-svn: 3487
2002-08-22 23:37:20 +00:00
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
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