Commit Graph

221 Commits

Author SHA1 Message Date
Chris Lattner
eb0456c8fd - Do not expose Critical Edge breaking mechanics outside the BCE pass, thus
removing it from Transforms/Local.h and from Transforms/Utils/*


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3910 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-24 15:51:56 +00:00
Chris Lattner
16e7a5295f Correlated Exprs pass now requires BCE pass instead of doing it manually
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3908 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-24 15:43:56 +00:00
Chris Lattner
6de302bbdb - Expose passinfo from BreakCriticalEdges pass so that it may be "Required"
by other passes.  Make BCE pass be in anonymous namespace now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3907 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-24 15:43:12 +00:00
Chris Lattner
d76efa0186 Add new BreakCriticalEdges pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3903 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-24 00:08:39 +00:00
Chris Lattner
d06451f920 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]


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3897 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-23 23:39:43 +00:00
Chris Lattner
c017d9132a * Fix bug: CorrelatedExprs/2002-09-23-PHIUpdateBug.ll
* Make sure "Changed" is updated correctly


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3891 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-23 20:06:22 +00:00
Chris Lattner
dfcbf01222 Fix bug: test/Regression/Transforms/InstCombine/2002-09-17-GetElementPtrCrash.ll
Thanks to Casey for finding it!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3783 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-17 21:05:42 +00:00
Vikram S. Adve
c7a6d24cef Extract most of the transformation into an externally accessible
function -- DecomposeArrayRef(GetElementPtrInst* GEP) -- that can
be invoked on a single instruction at a time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3755 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-16 16:40:07 +00:00
Misha Brukman
655fb5c817 Function.h is unnecessary when Module.h is included.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3716 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-14 03:04:02 +00:00
Chris Lattner
3cac88ac9e - Change getelementptr instruction to use long indexes instead of uint
indexes for sequential types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3682 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-11 01:21:33 +00:00
Chris Lattner
9e6161cfd1 Fix the last of the silly bugs I just introduced. :(
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3674 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 23:46:10 +00:00
Chris Lattner
f283608f2e Add cannonicalization of shl X, 1 -> add X, X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3671 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 23:04:09 +00:00
Chris Lattner
1d608abbc0 Clean up code due to auto-insert constructors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3665 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 22:38:47 +00:00
Chris Lattner
2a7c23ef91 Simplify code (somtimes dramatically), by using the new "auto-insert" feature
of instruction constructors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3656 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 17:04:02 +00:00
Chris Lattner
5e76140536 * Clean up code a little bit
* Fix bug: test/Regression/Transforms/IndVarsSimplify/2002-09-09-PointerIndVar.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3644 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 05:24:05 +00:00
Chris Lattner
1b9029c2f2 Hack unneccesary now that shifts of pointers are no longer legal!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3640 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 03:50:54 +00:00
Chris Lattner
e30e1cf029 Fix Bug: test/Regression/Transforms/InstCombine/2002-09-08-PointerShiftBug.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3626 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-08 21:39:07 +00:00
Chris Lattner
bd78696719 Minor simplification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3619 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-08 18:55:04 +00:00
Chris Lattner
b0dbd7fc5a Initial checkin of Correlated Expression Elimination Pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3599 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-06 18:41:55 +00:00
Chris Lattner
0c4e886dbf - Renamed Type::isIntegral() to Type::isInteger()
- Added new method Type::isIntegral() that is the same as isInteger, but
    also accepts bool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3574 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-03 01:08:28 +00:00
Chris Lattner
62b14df410 Add constant prop & DIE to InstCombine, so it cleans up after itself
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3568 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-02 04:59:56 +00:00
Chris Lattner
2a88bb7065 - Implement SCCP of getelementptr instructions
- Implement SCCP of globals into ConstantExprs hopefully opening new
   opportunities for more SCCP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3555 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-30 23:39:00 +00:00
Chris Lattner
2964f3624c Really minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3549 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-30 22:53:30 +00:00
Chris Lattner
14987f16b4 - 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3533 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-30 20:22:29 +00:00
Chris Lattner
e6f9a91618 - instcombine demorgan's law: and (not A), (not B) == not (or A, B)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3495 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-23 18:32:43 +00:00
Chris Lattner
cc63f1c674 Eliminated the MemAccessInst class, folding contents into GEP class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3487 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 23:37:20 +00:00
Chris Lattner
24ea74eb9a Load & StoreInst no longer derive from MemAccessInst, so we don't have
to handle indexing anymore


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3485 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 22:49:05 +00:00
Chris Lattner
f5e84aa088 Add capability of using pointer analysis to LICM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3478 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 21:39:55 +00:00
Chris Lattner
0712d55512 Remove long obsolete comments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3476 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 21:25:54 +00:00
Chris Lattner
c20e24524f 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)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3470 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 20:22:01 +00:00
Chris Lattner
d456ec983c Convert GCSE pass to use new alias analysis infrastructure
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3463 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 18:24:48 +00:00
Chris Lattner
a69fd90358 - Split Dominators.h into Dominators.h & PostDominators.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3432 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-21 23:43:50 +00:00
Chris Lattner
905641bb01 Remove an optimization that isn't.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3419 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-21 22:10:06 +00:00
Chris Lattner
05bd1b2eee - instcombine (~(a < b)) into (a >= b)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3406 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-20 18:24:26 +00:00
Chris Lattner
f02c46834a - implemented instcombine of phi (X, X, X) -> X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3397 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-20 15:35:35 +00:00
Chris Lattner
9b76123124 Promote getelementptr instructions to constexprs if we can.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3368 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-17 22:21:59 +00:00
Chris Lattner
3ecce66e25 Handle more cases of cast-of-cast in more general forms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3347 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-15 16:15:25 +00:00
Chris Lattner
5cf6f112e6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3339 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 23:21:10 +00:00
Chris Lattner
db6e4d6625 Avoid inserting an entry block unless we need it
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3336 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 21:35:02 +00:00
Chris Lattner
9b2b80fd48 Fix bug introduced in last checkin due to CastInst not being visible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3327 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:22:19 +00:00
Chris Lattner
0513e9fe03 Remove support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3323 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:18:02 +00:00
Chris Lattner
48a4531ee4 Remove extra #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3322 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:17:32 +00:00
Chris Lattner
b804760b56 Remove support for unary operators
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3318 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:53:45 +00:00
Chris Lattner
af2930efa0 - Fix InstCombine pass to not generate or process NOT instructions
- Fixed testcases to not use them either.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3315 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:51:49 +00:00
Chris Lattner
572f4a01a5 - Rename ConstantGenericIntegral -> ConstantIntegral
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3300 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-13 17:50:24 +00:00
Chris Lattner
233f7dcde3 * Factor a bunch of code by using ReplaceInstUsesWith
* Move isMaxValue, isMinValue, isAllOnesValue to Constants.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3290 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-12 21:17:25 +00:00
Chris Lattner
8b170945ea 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3286 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-09 23:47:40 +00:00
Chris Lattner
5f0eb8da62 - Cleaned up the interface to AnalysisUsage to take analysis class names
instead of ::ID's.
 - Pass::getAnalysis<> now no longer takes an optional argument


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3265 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-08 19:01:30 +00:00
Vikram S. Adve
900fd63d12 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().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3233 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-03 13:21:15 +00:00
Chris Lattner
8fd217cb29 Fix bug: test/Regression/Transforms/InstCombine/2002-08-02-CastTest.ll
Implement feature: Cast's can now be converted to bitwise AND expressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3225 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-02 20:00:25 +00:00