Chris Lattner
d2960ee802
Fix bug: ADCE/2003-04-25-PHIPostDominateProblem.ll
...
llvm-svn: 5952
2003-04-25 22:53:27 +00:00
Chris Lattner
c78cd5c758
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
7b67a6e77d
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
db6b7ba364
Remove unnecesary &*'s
...
llvm-svn: 5872
2003-04-23 16:37:45 +00:00
Chris Lattner
a9eaa10358
New pass to lower switch instructions to branch instructions
...
llvm-svn: 5865
2003-04-23 16:23:59 +00:00
Chris Lattner
d609c99c87
Minor cleanups
...
llvm-svn: 5863
2003-04-23 16:18:14 +00:00
Chris Lattner
bb00f755ed
Change the interface to constant expressions to allow automatic folding
...
llvm-svn: 5793
2003-04-16 22:40:51 +00:00
Chris Lattner
731913bab3
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
b215db890f
Move BreakCriticalEdges pass to lib/Transforms/Utils
...
llvm-svn: 5754
2003-03-21 21:43:19 +00:00
Chris Lattner
c51d7871ee
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
6eededc41f
Implement: -A*-B == A*B
...
llvm-svn: 5740
2003-03-10 23:23:04 +00:00
Chris Lattner
715b592fc4
Add new transformation: // (~A | ~B) == (~(A & B))
...
llvm-svn: 5738
2003-03-10 23:13:59 +00:00
Chris Lattner
0f5ab645eb
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
3eca9aaa0a
Generalize (A+c1)+c2 optimization to work with all associative operators
...
llvm-svn: 5733
2003-03-10 21:43:22 +00:00
Chris Lattner
9dec4368c0
Minor change, no functionality diff
...
llvm-svn: 5731
2003-03-10 19:20:30 +00:00
Chris Lattner
5fbfe9b9a8
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
5e6fb8b8d5
Implement: (A|B)^B == A & (~B)
...
llvm-svn: 5728
2003-03-10 18:24:17 +00:00
Chris Lattner
bd009a8938
Implement %test7 in InstCombine/getelementptr.ll
...
llvm-svn: 5704
2003-03-05 22:33:14 +00:00
Chris Lattner
4eaaa99b93
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
a49e96dda5
Change the mem2reg interface to accept a TargetData argument
...
llvm-svn: 5685
2003-03-03 17:25:18 +00:00
Chris Lattner
09c35df4e9
Fix bug: LICM/2003-02-28-PromoteDifferentType.ll
...
llvm-svn: 5675
2003-02-28 19:21:40 +00:00
Chris Lattner
dec7727a9f
Fix bug I introduced yesterday :(
...
llvm-svn: 5669
2003-02-28 16:54:17 +00:00
Chris Lattner
e2aebf5906
Fix bug: LICM/2003-02-27-PreheaderExitNodeUpdate.ll
...
llvm-svn: 5667
2003-02-28 03:07:54 +00:00
Chris Lattner
d64f135965
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
74b9aaa89c
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
d40fa5ca2f
Fix bug: 2003-02-27-StoreSinkPHIs.ll
...
llvm-svn: 5658
2003-02-27 21:59:36 +00:00
Chris Lattner
e8dda81b22
* 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
b078b28fa5
* 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
92a8816086
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
497c0d443c
Rename Instruction::hasSideEffects() -> mayWriteToMemory()
...
llvm-svn: 5620
2003-02-24 20:48:32 +00:00
Chris Lattner
1c1f11bd3f
Initial implementation of Loop invariant memory->scalar promotion
...
llvm-svn: 5613
2003-02-24 03:52:32 +00:00
Chris Lattner
2e4c1c8640
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
c24ffa9297
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
8306cc5c5c
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
aceb57a289
Fix typo
...
llvm-svn: 5458
2003-02-01 04:50:59 +00:00
Chris Lattner
7af7b1c82c
Fix bug: ADCE/2003-01-22-PredecessorProblem.ll
...
llvm-svn: 5405
2003-01-23 02:12:18 +00:00
Chris Lattner
61d594690a
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
18fe81719d
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
be53e88459
Remove dead code
...
llvm-svn: 4952
2002-12-07 18:42:13 +00:00
Chris Lattner
6c9d57c590
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
b5027095e5
- 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
0141841bc4
Fix warning
...
llvm-svn: 4649
2002-11-09 00:49:43 +00:00
Chris Lattner
f03f32d2e8
Fix spelling error
...
llvm-svn: 4645
2002-11-08 23:18:37 +00:00
Chris Lattner
aaf2fa34a5
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
ecddf3396f
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
b9fa84c1ed
Make sure to _delete_ memory allocated by worklists
...
llvm-svn: 4523
2002-11-04 02:54:22 +00:00
Chris Lattner
b913f4e785
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
1ec9725ef8
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
c9c721edf0
Fix spelling of `propagate'.
...
llvm-svn: 4423
2002-10-29 23:06:16 +00:00
Chris Lattner
b565d3ac5b
- Rename AnalysisUsage::preservesAll to getPreservesAll & preservesCFG to
...
setPreservesCFG to be less confusing.
llvm-svn: 4255
2002-10-21 20:00:28 +00:00