Commit Graph

78 Commits

Author SHA1 Message Date
Reid Spencer
cae5754619 Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 00:28:52 +00:00
Reid Spencer
4da0451821 Use isUnitValue() instead of getZExtValue() == 1 which will prevent an
assert if the ConstantInt's value is large.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34814 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 21:51:23 +00:00
Reid Spencer
9d6565a5b1 For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-15 02:26:10 +00:00
Chris Lattner
6934a04a8c Simplify code by using value::takename
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34176 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-11 01:23:03 +00:00
Reid Spencer
9133fe2895 Apply the VISIBILITY_HIDDEN field to the remaining anonymous classes in
the Transforms library. This reduces debug library size by 132 KB, debug
binary size by 376 KB, and reduces link time for llvm tools slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33939 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-05 23:32:05 +00:00
Reid Spencer
24d6da5fed For PR970:
Clean up handling of isFloatingPoint() and dealing with PackedType.
Patch by Gordon Henriksen!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-21 00:29:26 +00:00
Chris Lattner
42a7551725 rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 02:27:26 +00:00
Zhou Sheng
6b6b6ef167 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 12:24:14 +00:00
Reid Spencer
e4d87aa2de For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32751 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 06:05:41 +00:00
Chris Lattner
0e5f499638 Switch over Transforms/Scalar to use the STATISTIC macro. For each statistic
converted, we lose a static initializer.  This also allows GCC to emit warnings
about unused statistics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32690 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 21:40:18 +00:00
Bill Wendling
832171cb97 Removing even more <iostream> includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32320 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 20:04:42 +00:00
Chris Lattner
ac0b6ae358 Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 17:46:33 +00:00
Chris Lattner
3749c9cae4 Remove the 'printname' argument to WriteAsOperand. It is always true, and
passing false would make the asmprinter fail anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32264 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 06:16:21 +00:00
Reid Spencer
0a783f783c For PR950:
Replace the REM instruction with UREM, SREM and FREM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31369 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-02 01:53:59 +00:00
Reid Spencer
1628cec4d7 For PR950:
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31195 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-26 06:15:43 +00:00
Reid Spencer
b83eb6447b For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31063 91177308-0d34-0410-b5e6-96231b3b80d8
2006-10-20 07:07:24 +00:00
Chris Lattner
7f8897f22e eliminate RegisterOpt. It does the same thing as RegisterPass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29925 91177308-0d34-0410-b5e6-96231b3b80d8
2006-08-27 22:42:52 +00:00
Chris Lattner
ae74f55552 Fix Transforms/Reassociate/2006-04-27-ReassociateVector.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28007 91177308-0d34-0410-b5e6-96231b3b80d8
2006-04-28 04:14:49 +00:00
Chris Lattner
e9efecbf47 Implement a FIXME, recusively reassociating
A*A*B + A*A*C   -->   A*(A*B+A*C)   -->   A*(A*(B+C))

This implements Reassociate/mul-factor3.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26757 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-14 16:04:29 +00:00
Chris Lattner
895b392269 extract some code into a method, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26755 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-14 07:11:11 +00:00
Chris Lattner
22a66c41f3 Promote shifts by a constant to multiplies so that we can reassociate
(x<<1)+(y<<1) -> (X+Y)<<1.  This implements
Transforms/Reassociate/shift-factor.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26753 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-14 06:55:18 +00:00
Chris Lattner
e5022fe4cd Add factoring of multiplications, e.g. turning A*A+A*B into A*(A+B).
Testcase here: Transforms/Reassociate/mulfactor.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26524 91177308-0d34-0410-b5e6-96231b3b80d8
2006-03-04 09:31:13 +00:00
Chris Lattner
dac58ad983 Make iostream #inclusion explicit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25514 91177308-0d34-0410-b5e6-96231b3b80d8
2006-01-22 23:32:06 +00:00
Chris Lattner
7b4ad94282 Fix a problem that Dan Berlin noticed, where reassociation would not succeed
in building maximal expressions before simplifying them.  In particular, i
cases like this:

X-(A+B+X)

the code would consider A+B+X to be a maximal expression (not understanding
that the single use '-' would be turned into a + later), simplify it (a noop)
then later get simplified again.

Each of these simplify steps is where the cost of reassociation comes from,
so this patch should speed up the already fast pass a bit.

Thanks to Dan for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23214 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 07:07:58 +00:00
Chris Lattner
2cd85da3ed Avoid creating garbage instructions, just move the old add instruction
to where we need it when converting -(A+B+C) -> -A + -B + -C.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23213 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 06:38:04 +00:00
Chris Lattner
368a3aabb2 add some assertions and fix problems where reassociate could access the
Ops vector out of range


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23211 91177308-0d34-0410-b5e6-96231b3b80d8
2005-09-02 05:23:22 +00:00
Chris Lattner
ac83b0301e Fix Regression/Transforms/Reassociate/2005-08-24-Crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23019 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-24 17:55:32 +00:00
Chris Lattner
4bc5f8071a Use the new 'moveBefore' method to simplify some code. Really, which is
easier to understand?  :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22706 91177308-0d34-0410-b5e6-96231b3b80d8
2005-08-08 19:11:57 +00:00
Jeff Cohen
00b16889ab Eliminate all remaining tabs and trailing spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22523 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-27 06:12:32 +00:00
Chris Lattner
641f02f10f Fix Reassociate/shifttest.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21839 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-10 03:39:25 +00:00
Chris Lattner
44b8c7d5d3 Implement Reassociate/mul-neg-add.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21788 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 21:41:35 +00:00
Chris Lattner
6f156856ca Bail out earlier
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21786 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 21:33:47 +00:00
Chris Lattner
f33151aff0 Teach reassociate that 0-X === X*-1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21785 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 21:28:52 +00:00
Chris Lattner
9c72319938 Fix PR557 and basictest[34].ll.
This makes reassociate realize that loads should be treated as unmovable, and
gives distinct ranks to distinct values defined in the same basic block, allowing
reassociate to do its thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21783 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 20:57:04 +00:00
Chris Lattner
c9fd097a01 Add debugging information
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21781 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 20:09:57 +00:00
Chris Lattner
989f6229bc eliminate gotos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21780 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 19:48:43 +00:00
Chris Lattner
109d34d6ff Improve reassociation handling of inverses, implementing inverses.ll.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21778 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 18:59:37 +00:00
Chris Lattner
4690010006 Refactor some code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21772 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 00:19:31 +00:00
Chris Lattner
cc8a2b98f2 Handle some simple cases where we can see that values get annihilated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21771 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-08 00:08:33 +00:00
Chris Lattner
c0649ac931 Rewrite the guts of the reassociate pass to be more efficient and logical. Instead
of trying to do local reassociation tweaks at each level, only process an expression
tree once (at its root).  This does not improve the reassociation pass in any real way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21768 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 21:59:39 +00:00
Chris Lattner
0975ed5f4e Convert shifts to muls to assist reassociation. This implements
Reassociate/shifttest.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21761 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 04:24:13 +00:00
Chris Lattner
08b43921e1 Simplify the code and rearrange it. No major functionality changes here.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21759 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-07 04:08:02 +00:00
Misha Brukman
fd93908ae8 Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21427 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 23:48:37 +00:00
Chris Lattner
e4d5c441e0 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
2005-03-15 04:54:21 +00:00
Reid Spencer
551ccae044 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-01 22:55:40 +00:00
Misha Brukman
d8e1eea678 Fix #includes of i*.h => Instructions.h as per PR403.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15328 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-29 17:05:13 +00:00
Chris Lattner
2fc1230dd6 Fixes working towards PR341
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14839 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-15 01:50:47 +00:00
Brian Gaeke
a9160a064f Make this pass use a more specific debug message than "Processing:".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14541 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-01 19:27:10 +00:00
Chris Lattner
d745602662 Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10725 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-09 06:02:20 +00:00
Brian Gaeke
d0fde30ce8 Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-11 22:41:34 +00:00