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
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
Chris Lattner
66b1127636 - 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
20b85d96e4 Eliminated the MemAccessInst class, folding contents into GEP class.
llvm-svn: 3487
2002-08-22 23:37:20 +00:00
Chris Lattner
969c616d51 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
8b8d72c1f2 Add capability of using pointer analysis to LICM
llvm-svn: 3478
2002-08-22 21:39:55 +00:00
Chris Lattner
5addf774a3 Remove long obsolete comments
llvm-svn: 3476
2002-08-22 21:25:54 +00:00
Chris Lattner
18826b07fe 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
5b94b874d6 Convert GCSE pass to use new alias analysis infrastructure
llvm-svn: 3463
2002-08-22 18:24:48 +00:00
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