Commit Graph

660 Commits

Author SHA1 Message Date
Anand Shukla
590df88d82 Added checking threshold
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3864 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 16:44:35 +00:00
Anand Shukla
6689b06697 split retracing into a separate file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3809 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-18 03:55:26 +00:00
Misha Brukman
bfb472447e Removed unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3802 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-18 02:07:57 +00:00
Misha Brukman
5f41748e1a Fixed typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3801 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-18 00:42:45 +00:00
Chris Lattner
cb16c65426 There is a #define in some header that conflicts with INFINITY, rename it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3797 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-17 23:46:33 +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
Chris Lattner
dbcbe3f7e8 Fix FunctionInlining pass assertion failure:
ilist:104: failed assertion `Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3768 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-16 22:30:20 +00:00
Chris Lattner
8e2e5f74da Fix: test/Regression/LLC/badidx.c problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3763 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-16 18:32:33 +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
Anand Shukla
6641995564 Incorporated changes in alloca and getElementPointer instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3733 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-16 05:26:51 +00:00
Anand Shukla
ada50a5c1d Incorporated changes in alloca instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3732 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-16 05:24:49 +00:00
Chris Lattner
b2a0fbea11 Fix bug I introduced
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3719 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-14 19:33:16 +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
Misha Brukman
520eaff91a Following Chris's advice, I'm pruning some unnecessary .h includes that I'm
noticing. Since Module includes Function, and eventually, BasicBlock and
GlobalVariable, the last three are unnecessary to be included directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3713 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-14 02:06:53 +00:00
Chris Lattner
e87e1c9aa9 Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3711 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-13 22:28:50 +00:00
Chris Lattner
05804b7459 Change the MallocInst & AllocaInst ctors to take the allocated type, not the
pointer type returned.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3710 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-13 22:28:45 +00:00
Chris Lattner
1a7db9be56 Fix bug I introduced with one of my previous changes.
Thanks fly out to Nick for noticing it!  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3691 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-12 19:00:43 +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
106ff4551c - 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@3681 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-11 01:21:29 +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
8606d9924b Fix bugs in previous checkins
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3673 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 23:31:28 +00:00
Chris Lattner
08c2e4838d Fix bug in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3672 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 23:31:12 +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
533ce5c070 Fix minor problems in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3669 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 22:52:51 +00:00
Chris Lattner
228b14b71e Fix minor problems in previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3668 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 22:52:49 +00:00
Chris Lattner
f2d2d0bb13 Clean up code due to auto-insert constructors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3666 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 22:38:49 +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
9afdb2998b Clean up code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3664 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 22:38:06 +00:00
Chris Lattner
e29f6a85ee Fix bug: test/Regression/Transforms/LevelRaise/2002-09-10-PointerAdds.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3658 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 19:42:53 +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
3ea5cb0df1 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@3655 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-10 17:03:06 +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
871d2ce690 Disallow creation of pointer typed shift instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3637 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-09 20:25:21 +00:00
Chris Lattner
5fb724332a Factor silly code duplication out
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3627 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-08 21:47: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
f4d4a49311 Fix file header to be accurate, instead of something I just copied and pasted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3591 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-06 03:59:56 +00:00
Chris Lattner
a9d2bffeeb Fix bug with critical edge splitting code where it wouldn't update PHI nodes
in the old destination block to indicate that the value flows from the new
edge splitting block, not from the original multi-successor block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3590 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-06 03:51:45 +00:00
Chris Lattner
4af3ccbbea Check in the implementation of critical edge detection and splitting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3588 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-06 02:35:34 +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
65ad37205e - 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@3573 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-03 01:07:35 +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
c74cb8698f - Eliminate the last traces of the 'analysis' namespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3550 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-30 22:53:53 +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
3bb8ad27a8 Eliminated the MemAccessInst class, folding contents into GEP class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3488 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 23:37:24 +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
8e4fc2598d *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3483 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 22:48:32 +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
ff9a9e5b13 Do not generate load/store instructions with indexing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3461 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 16:41:31 +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
b63b29d9b0 Do not generate loads/stores with indexing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3422 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-21 22:11:33 +00:00
Chris Lattner
25ba05972f Remove extraneous #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3421 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-21 22:11:14 +00:00
Chris Lattner
3f9b28d075 Do not create load/stores with indexes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3420 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-21 22:10:52 +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
546b027b3e - Do not expose ::ID from any of the analyses anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3417 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-21 17:09:49 +00:00
Chris Lattner
b319faff77 fixed bug: test/Regression/Linker/2002-08-20-ConstantExpr.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3412 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-20 19:35:11 +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
0bfb6ba3e3 - Made GlobalDCE worklist driven, making it more successful. Now can handle
cases like: test/Regression/Transforms/GlobalDCE/2002-08-17-WorkListTest.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3381 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-18 01:28:30 +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
b9a7793ecb Avoid creating 'load X, 0' instead of just 'load X'
This _trivial_ change causes GCSE and LICM to be much more effective at
hoisting loads.  Before it would not be able to eliminate 'load X' if there
was just a dominating 'load X, 0' because the expressions were not identical.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3337 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 22:11:52 +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
ad333484ea Remove support for Not ConstantExpr. This simplifies the unary case to only
have to support the cast instruction, so the function is renamed to getCast.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3328 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:24:09 +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
e4c3764a9f Remove support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3313 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 17:45:39 +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
180e568a70 Initial checkin of the "Hello World" Pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3266 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-08 20:10:38 +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
Chris Lattner
dd5b495129 - 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@3264 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-08 19:01:28 +00:00
Chris Lattner
c6b227ecc4 Remove extraneous #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3262 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-08 19:00:34 +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
Chris Lattner
90ac28cf3e * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3222 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-02 19:29:35 +00:00
Chris Lattner
be1ecf6050 Fix bug: test/Regression/Transforms/GCSE/2002-05-21-NoSharedDominator.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3215 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-02 18:06:01 +00:00
Chris Lattner
cc8d8fb676 Remove unneccesary #inlcude
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3200 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-01 20:01:02 +00:00
Chris Lattner
280b09b178 Implement the other half of a feature advertised by OperandConvertableToType.
This fixes bug: test/Regression/Transforms/LevelRaise/2002-07-31-AssertionFailure.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3193 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-31 22:31:34 +00:00
Chris Lattner
55e41ba3d2 * Indent class into anonymous namespace, filling up the diff with garbage
* Internalize global variables with initializers
* Add new stat to track global variable internalization
* Only count functions that were not internal before in internalized function
  count


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3163 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-30 19:48:44 +00:00
Chris Lattner
e8e4605021 Cleanup ConstantExpr handling:
* Correctly delete TypeHandles in AsmParser.  In addition to not leaking
   memory, this prevents a bug that could have occurred when a type got
   resolved that the constexpr was using
 * Check for errors in the AsmParser instead of hitting assertion failures
   deep in the code
 * Simplify the interface to the ConstantExpr class, removing unneccesary
   parameters to the ::get* methods.
 * Rename the 'getelementptr' version of ConstantExpr::get to
   ConstantExpr::getGetElementPtr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3160 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-30 18:54:22 +00:00
Chris Lattner
ad772a7188 Remove FIXME's that aren't really needed after all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3158 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-30 16:38:54 +00:00
Chris Lattner
e902bda4ce Fix bug with last patch which would occur when a call returned void and we
attempted to assign it a name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3142 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-30 02:42:49 +00:00
Chris Lattner
9cf307fdeb * Make sure the resolved function call instructions get the name from the
old call instruction
* Implement conversion of return values for calls.  This fixes bug:
   test/Regression/Transforms/FunctionResolve/retmismatch3.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3140 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-30 00:50:49 +00:00
Chris Lattner
446698b63d * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3137 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-30 00:22:34 +00:00
Chris Lattner
a61fab8c6d 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3134 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-29 23:40:46 +00:00
Chris Lattner
b0f0ef8f26 Implement a new RemoveSuccessor function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3131 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-29 22:32:08 +00:00
Chris Lattner
011de07117 Fix bug: test/Regression/Transforms/ADCE/2002-07-29-Segfault.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3129 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-29 22:31:39 +00:00
Chris Lattner
91b65c0b42 Allow folding of basic blocks that have PHI nodes in them, fixing "bug":
test/Regression/Transforms/SimplifyCFG/2002-06-24-PHINode.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3128 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-29 21:26:30 +00:00
Chris Lattner
a59cbb2043 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3116 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-27 01:12:17 +00:00
Chris Lattner
97f51a3024 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3115 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-27 01:12:15 +00:00
Chris Lattner
a6275ccdf5 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3113 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-26 21:12:46 +00:00
Chris Lattner
1e43516dcf * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3112 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-26 21:12:44 +00:00
Chris Lattner
ce6ef112c4 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3105 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-26 18:40:14 +00:00
Chris Lattner
0c0edf8afc *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3075 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-25 06:17:51 +00:00
Chris Lattner
b1443b1749 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3072 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-24 22:40:39 +00:00
Chris Lattner
568ddabc8f Eliminate several include/llvm/Transforms/IPO/*.h files, moving their contents into IPO.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3043 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-24 17:12:05 +00:00
Chris Lattner
e9ee3e5a75 Merge ChangeAllocations into scalar.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3038 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 22:04:17 +00:00
Chris Lattner
ff1be262c4 Rename header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3037 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 22:04:02 +00:00
Chris Lattner
7311e389a6 Cleanup and simplify code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3036 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 22:03:41 +00:00
Chris Lattner
9cfea85b8b Incorporate ConstantMerge.h into IPO.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3035 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 19:57:40 +00:00
Chris Lattner
b713599c93 Rename LevelChange.h to RaisePointerReferences.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3034 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 19:57:08 +00:00
Chris Lattner
f629309f74 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3016 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 18:06:35 +00:00
Chris Lattner
af41a12370 * Remove getPassName implementation
* Register all Passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3015 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 18:06:30 +00:00
Chris Lattner
1198266778 * Cleanup the pass a bit more, making it more object oriented.
* Split the two behaviors of the InsertTraceCode class into two subclasses
* Register Passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3014 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 18:04:15 +00:00
Chris Lattner
e9754ef595 * Break the two different behaviors of SimpleStructMutation into two subclasses
* Register the passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3013 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 18:03:11 +00:00
Chris Lattner
33494521d3 * Make the ctor take a TargetData even though it's not using it yet
* Register the pass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3012 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 18:02:23 +00:00
Chris Lattner
72c27e2ae5 * Remove lots of dead stuff
* Register Pass


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3011 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 18:01:39 +00:00
Chris Lattner
56d27019e6 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3002 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-23 17:52:38 +00:00
Chris Lattner
4689728cdf Hide extra argument
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2986 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-22 02:17:27 +00:00
Chris Lattner
5ff62e90d0 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2985 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-22 02:10:13 +00:00
Anand Shukla
5585f53d7c comeented out debug printing
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2980 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-21 09:41:18 +00:00
Anand Shukla
e617f92741 minor corrections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2971 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-18 20:56:47 +00:00
Chris Lattner
5796091dfd Seperate stats for DCE'd functions and vars
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2961 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-18 06:40:04 +00:00
Chris Lattner
f0cd4722bf *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2959 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-18 04:43:20 +00:00
Chris Lattner
7f20ea7d7b Only functions with external linkage can be resolved to function declarations.
This change fixes programs that have multiple functions named the same thing,
where are least one of them is static/internal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2954 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-18 03:01:24 +00:00
Chris Lattner
e306d94782 * Rewrite loop to be slightly more efficient (arguably)
* Fix a MAJOR thinko that was causing bad links to happen on Spec


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2953 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-18 02:31:03 +00:00
Chris Lattner
0b5909e6ae * Correctly get prototype for void*malloc(size_t)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2951 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-18 00:18:01 +00:00
Chris Lattner
6cdf1971bd Implement linking of ConstExprs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2946 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-18 00:13:08 +00:00
Chris Lattner
260fc14568 Anand forgot to check in the makefile corresponding to his previous change
which eliminated the EmitFunctions directory


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2937 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-17 17:13:01 +00:00
Chris Lattner
b1b4262387 * Remove dead code from ExprTypeConvert.cpp
- I->use_empty() can never be true because of the IHolder's
* Fix bug: test/Regression/Transforms/LevelRaise/2002-07-16-SourceAndDestCrash.ll
   - Add a new NewCasts member to VMC to keep track of casts that have been
     created and to ensure there is always a reference to the cast.
   - Extend ValueHandle a bit so it can be used in an STL container
   - Make sure we destroy the ValueMapCache before verifying the function
     in LevelRaise.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2936 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-17 17:11:33 +00:00
Chris Lattner
3378a5b591 * Add a bunch of debugging features to LevelRaise
- Verify the function every time it is exprconverted if DEBUG is on
  - Provide a way to start exprconversion AT a specific instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2934 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 23:49:24 +00:00
Chris Lattner
23014c9b00 Avoid !sized assertion failure if Ty is not a sized type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2933 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 22:29:37 +00:00
Chris Lattner
3fb2ddd368 Fix bug: test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash2.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2932 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 21:41:31 +00:00
Anand Shukla
e0b514259c Moved over EmitFunctions to this library
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2928 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 18:58:08 +00:00
Anand Shukla
f080ec7dcd removed this directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2927 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 18:56:29 +00:00
Anand Shukla
11870879ec Moved EmitFunctions.cpp up to instrumentation directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2926 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 18:55:55 +00:00
Chris Lattner
a66c7bfa51 Bugfix to previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2924 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 18:12:55 +00:00
Chris Lattner
9713c4ef46 * Cleanup pass
* The global variable cannot be internal or else we cannot use it!
* Always add a function to the table, even if it only has a single basic
  block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2921 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 17:42:54 +00:00
Chris Lattner
131454e91d * Add assertion to ExprTypeConvert to detect error earlier than without it
* Fix bug in LevelRaise.cpp, correcting this problem:
    test/Regression/Transforms/LevelRaise/2002-07-16-RaiseCrash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2920 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-16 17:33:13 +00:00
Anand Shukla
135b75db49 Added EmitFunctions directory
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2883 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-12 20:12:07 +00:00
Anand Shukla
41059bc530 Initial makefile
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2882 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-12 20:11:24 +00:00
Anand Shukla
09ba7b34c4 Initial version: adds a function table to output code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2881 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-12 20:10:50 +00:00
Chris Lattner
43199a036d Disable folding g-e-p instructions into loads and stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2870 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-10 22:37:17 +00:00
Chris Lattner
11910cf7e3 Disable pool allocation stuff until data structure analysis is sorted back out
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2869 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-10 22:36:47 +00:00
Vikram S. Adve
f86b4c1982 Fix iteration and InsertPos bugs introduced when Chris changed over to ilist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2840 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-08 23:37:07 +00:00