Misha Brukman
74cf3f5246
s/convertable/convertible/g
...
llvm-svn: 6248
2003-05-20 18:45:36 +00:00
Chris Lattner
d8234cfa3a
Fix long standing bug
...
llvm-svn: 6232
2003-05-15 18:25:13 +00:00
Chris Lattner
6cb27840a7
Fix bug: LoopPreheaders/2003-05-12-PreheaderExitOfChild.ll
...
llvm-svn: 6153
2003-05-12 22:04:34 +00:00
Chris Lattner
a7ee27e0fd
Handle va_arg instruction correctly
...
llvm-svn: 6030
2003-05-08 02:50:13 +00:00
Chris Lattner
e006ca4580
Fix spelling
...
llvm-svn: 5983
2003-05-02 19:26:34 +00:00
Chris Lattner
f13fe891d1
Fix Bug: LowerSwitch/2003-05-01-PHIProblem.ll
...
llvm-svn: 5979
2003-05-01 22:21:21 +00:00
Chris Lattner
5045ab0fac
Fix another case where constexprs could cause a crash
...
llvm-svn: 5972
2003-04-30 22:34:06 +00:00
Chris Lattner
caa766b40f
Fix constant folding of constexprs
...
llvm-svn: 5971
2003-04-30 22:19:10 +00:00
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
Chris Lattner
d68e6d1718
- Fix bug: cee/2002-10-07-NoImmediateDominator.ll
...
llvm-svn: 4081
2002-10-08 21:53:51 +00:00
Chris Lattner
40df2d9d4c
- 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
3cf20c3f14
Expose isCriticalEdge & SplitCriticalEdge methods from crit-edges pass
...
llvm-svn: 4075
2002-10-08 21:06:27 +00:00
Chris Lattner
b32252aa71
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
55c7ae3cdc
Fold ashr -1, X into -1
...
llvm-svn: 4070
2002-10-08 16:16:40 +00:00
Chris Lattner
7cf9f6f4b1
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
61e8de1c61
Fix bug in LICM that caused the previous big win. :(
...
llvm-svn: 3980
2002-09-29 22:26:07 +00:00
Chris Lattner
ef0e95bb42
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
b731880895
Fix major bugs in dominator set & tree information updating
...
llvm-svn: 3975
2002-09-29 21:41:38 +00:00
Chris Lattner
0bbb8f6e06
- 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
0c66734ac5
Improve comments, doxygenize more
...
llvm-svn: 3950
2002-09-26 16:52:07 +00:00
Chris Lattner
21eb78d59d
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
9cdbd428b0
Change pass name to something sane
...
llvm-svn: 3946
2002-09-26 16:37:37 +00:00
Chris Lattner
fe9fba6f5b
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
f9676d651d
- 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
e5996b4c88
Checkin new loop-preheader insertion pass.
...
llvm-svn: 3942
2002-09-26 16:17:31 +00:00
Chris Lattner
7ab2bba3d3
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
7fafece8e0
Eliminate extraneous #include
...
llvm-svn: 3916
2002-09-24 21:18:40 +00:00
Chris Lattner
25ba5ac7ce
- 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
1014aae962
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
49588769e0
- 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
e62cdff96c
Add new BreakCriticalEdges pass
...
llvm-svn: 3903
2002-09-24 00:08:39 +00:00
Chris Lattner
b6c408778a
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
2a53929c5d
* 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
5ccb21f41d
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
4bcec53ed7
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
2e598f0092
Function.h is unnecessary when Module.h is included.
...
llvm-svn: 3716
2002-09-14 03:04:02 +00:00
Chris Lattner
fb017cb38c
- 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
5f4b79edaf
Fix the last of the silly bugs I just introduced. :(
...
llvm-svn: 3674
2002-09-10 23:46:10 +00:00
Chris Lattner
5143d4a3b3
Add cannonicalization of shl X, 1 -> add X, X
...
llvm-svn: 3671
2002-09-10 23:04:09 +00:00
Chris Lattner
37c3a1d80c
Clean up code due to auto-insert constructors
...
llvm-svn: 3665
2002-09-10 22:38:47 +00:00
Chris Lattner
da9702a8a1
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
7787814c22
* 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
4f5abce7f6
Hack unneccesary now that shifts of pointers are no longer legal!
...
llvm-svn: 3640
2002-09-10 03:50:54 +00:00
Chris Lattner
c1de581f8e
Fix Bug: test/Regression/Transforms/InstCombine/2002-09-08-PointerShiftBug.ll
...
llvm-svn: 3626
2002-09-08 21:39:07 +00:00
Chris Lattner
c30029172a
Minor simplification
...
llvm-svn: 3619
2002-09-08 18:55:04 +00:00
Chris Lattner
bd03f18e04
Initial checkin of Correlated Expression Elimination Pass
...
llvm-svn: 3599
2002-09-06 18:41:55 +00:00
Chris Lattner
3ce5b343c5
- 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
cd49f0ec5d
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
bb8f1a072b
- 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
a146c9e769
Really minor cleanups
...
llvm-svn: 3549
2002-08-30 22:53:30 +00:00
Chris Lattner
b0cbcfd5e4
- 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