Commit Graph

2692 Commits

Author SHA1 Message Date
Chris Lattner
3bad2533bb handle undef values much more carefully: generalize the resolveundefbranches
code to handle instructions as well, so that we properly fold things like
X & undef -> 0.
This fixes Transforms/SCCP/2006-12-19-UndefBug.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32715 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-20 06:21:33 +00:00
Chris Lattner
1c560adfd1 switch statistics over to not use static ctors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32709 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 23:16:47 +00:00
Chris Lattner
cbfdd1f840 eliminate static ctor from example.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32696 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:24:09 +00:00
Chris Lattner
61bc8f8ca4 remove dead statistic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32695 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:23:21 +00:00
Chris Lattner
d216e8ba60 switch more statistics over to STATISTIC, eliminating static ctors. Also,
delete some dead ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32694 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:17:40 +00:00
Chris Lattner
86453c52ba Eliminate static ctors due to Statistic objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32693 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 22:09:18 +00:00
Chris Lattner
438e08e357 Convert more Statistic's over to STATISTIC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32692 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-19 21:49:03 +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
Reid Spencer
8a903db499 Convert the last uses of CastInst::createInferredCast to a normal cast
creation. These changes are still temporary but at least this pushes
knowledge of signedness out closer to where it can be determined properly
and allows signedness to be removed from VMCore.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32654 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-18 08:47:13 +00:00
Reid Spencer
dc26a9b840 Convert the last use of two-argument ConstantExpr::getCast into another
form so we can remove that method from ConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32652 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-18 08:16:27 +00:00
Bill Wendling
5c7e326585 Added an automatic cast to "std::ostream*" etc. from OStream. We then can
rework the hacks that had us passing OStream in. We pass in std::ostream*
instead, check for null, and then dispatch to the correct print() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32636 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-17 05:15:13 +00:00
Chris Lattner
95ca3a453a when inserting a dummy argument to work-around the CBE not supporting
zero arg vararg functions, pass undef instead of 'int 0', which is cheaper.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32634 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-16 21:21:53 +00:00
Chris Lattner
d22dbdf606 re-enable a temporarily-reverted patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32595 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-15 07:32:38 +00:00
Reid Spencer
c55b243bcd Fix a bug in EvaluateInDifferentType. The type of operand should not be
used to determine whether a ZExt or SExt cast is performed. Instead, pass
an "isSigned" bool to the function and determine its value from the opcode
of the cast involved.
Also, clean up some cruft from previous patches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32548 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 18:21:21 +00:00
Reid Spencer
7eb7638276 Implement review feedback. Most of this has to do with removing unnecessary
cast instructions. A few are bug fixes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32544 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 17:19:09 +00:00
Reid Spencer
21a55c9f08 For mul transforms, when checking for a cast from bool as either operand,
make sure to also check that it is a zext from bool, not any other cast
operation type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32539 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 08:33:33 +00:00
Reid Spencer
5ae9cebef5 Fix and/or/xor (cast A), (cast B) --> cast (and/or/xor A, B)
The cast patch introduced the possibility that the wrong cast opcode
could be used and that this transform could trigger on different kinds
of cast operations. This patch rectifies that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32538 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 08:27:15 +00:00
Reid Spencer
3ba68b9eef Change the interface to SCEVExpander::InsertCastOfTo to take a cast opcode
so the decision of which opcode to use is pushed upward to the caller.
Adjust the callers to pass the expected opcode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32535 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 08:06:42 +00:00
Reid Spencer
dccd9fe161 Fix some casts. isdigit(c) returns 0 or 1, not 0 or -1
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32534 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 08:04:32 +00:00
Chris Lattner
21c362d324 revert my recent int<->fp and vector union promotion changes, they expose
obscure bugs affecting the X86 code generator.  I will reenable this
when fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32524 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 02:26:45 +00:00
Reid Spencer
7b06bd532d Replace CastInst::createInferredCast calls with more accurate cast
creation calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32521 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-13 00:50:17 +00:00
Reid Spencer
d977d8651a Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match
the the casting mnemonics in the rest of LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32514 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 23:36:14 +00:00
Chris Lattner
bb4e7b2fa4 this can be trunc or bitcast, per line 3092.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32487 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 19:11:20 +00:00
Chris Lattner
078b631ff3 Fix regression on 400.perlbench last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32486 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 18:41:03 +00:00
Reid Spencer
17212df0ee Fix numerous inferred casts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32479 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 09:18:51 +00:00
Reid Spencer
daa8e3c263 Fix the casting for the computation of the Malloc size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32477 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 09:17:08 +00:00
Reid Spencer
4da49122f3 Change inferred getCast into specific getCast. Passes all tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32469 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 05:05:00 +00:00
Chris Lattner
a30fc5ed04 Patch for PR1045 and Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32468 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-12 04:24:41 +00:00
Chris Lattner
509f85140c trunc to integer, not to FP.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32426 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-11 01:17:00 +00:00
Chris Lattner
1dbea1598c implement promotion of unions containing two packed types of the same width.
This implements Transforms/ScalarRepl/union-packed.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32422 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-11 00:35:08 +00:00
Chris Lattner
ae6a305094 * Eliminate calls to CastInst::createInferredCast.
* Add support for promoting unions with fp values in them.  This produces
   our new int<->fp bitcast instructions, implementing
   Transforms/ScalarRepl/union-fp-int.ll

As an example, this allows us to compile this:

union intfloat { int i; float f; };
float invsqrt(const float arg_x) {
    union intfloat x = { .f = arg_x };
    const float xhalf = arg_x * 0.5f;
    x.i = 0x5f3759df - (x.i >> 1);
    return x.f * (1.5f - xhalf * x.f * x.f);
}

into:

_invsqrt:
        movss 4(%esp), %xmm0
        movd %xmm0, %eax
        sarl %eax
        movl $1597463007, %ecx
        subl %eax, %ecx
        movd %ecx, %xmm1
        mulss LCPI1_0, %xmm0
        mulss %xmm1, %xmm0
        movss LCPI1_1, %xmm2
        mulss %xmm1, %xmm0
        subss %xmm0, %xmm2
        movl 8(%esp), %eax
        mulss %xmm2, %xmm1
        movss %xmm1, (%eax)
        ret

instead of:

_invsqrt:
        subl $4, %esp
        movss 8(%esp), %xmm0
        movss %xmm0, (%esp)
        movl (%esp), %eax
        movl $1597463007, %ecx
        sarl %eax
        subl %eax, %ecx
        movl %ecx, (%esp)
        mulss LCPI1_0, %xmm0
        movss (%esp), %xmm1
        mulss %xmm1, %xmm0
        mulss %xmm1, %xmm0
        movss LCPI1_1, %xmm2
        subss %xmm0, %xmm2
        mulss %xmm2, %xmm1
        movl 12(%esp), %eax
        movss %xmm1, (%eax)
        addl $4, %esp
        ret


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32418 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-10 23:56:50 +00:00
Reid Spencer
f7761e5c39 Incorporate any changes in the successor blocks into the result of
MarkAliveBlocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32375 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-08 21:52:01 +00:00
Bill Wendling
f5da13367f What should be the last unnecessary <iostream>s in the library.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32333 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 22:21:48 +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
Bill Wendling
e81561909d Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
now cerr, cout, and NullStream resp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32298 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-07 01:30:32 +00:00
Reid Spencer
62700f250f Update ConstantIntegral Max/Min tests for new interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32288 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 20:39:57 +00:00
Chris Lattner
02fc40ebd3 add missing #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32280 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 18:14:47 +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
Chris Lattner
698b51e870 counter should be unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32252 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-06 01:50:04 +00:00
Chris Lattner
e13ab2a9a1 add an instcombine xform. This speeds up 462.libquantum from 9.78s to
7.48s.  This regression is due to unforseen consequences of the cast patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32209 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-05 01:26:29 +00:00
Devang Patel
67a821d9a3 SCCP does not handle Packed Type properly. Disable Packed Type handling
for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32208 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-04 23:54:59 +00:00
Reid Spencer
3b3844288b Update call to CastInst::getCastOpcode for its new signature.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32166 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-04 02:48:01 +00:00
Jeff Cohen
97af751deb Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32113 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-02 02:22:01 +00:00
Chris Lattner
9919e3df17 disable transformations that are invalid for fp vectors. This fixes
Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32112 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-02 00:13:08 +00:00
Reid Spencer
44c030a7ee Remove 4 FIXMEs to hack around cast-to-bool problems which no longer exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32051 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-30 23:13:36 +00:00
Chris Lattner
d0a6a7a030 make it clear that this is always a zext
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32044 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-30 17:35:08 +00:00
Chris Lattner
6e8fbad675 One more bugfix, 3 cases of making casts explicit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32043 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-30 17:32:29 +00:00
Chris Lattner
9a989f0f97 Fix a bug in globalopt due to the recent cast patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32042 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-30 17:26:08 +00:00
Chris Lattner
46b96055cf implement cast.ll:test35. With this, we recognize:
unsigned short swp(unsigned short a) {
       return ((a & 0xff00) >> 8 | (a & 0x00ff) << 8);
}

as an idiom for bswap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32011 91177308-0d34-0410-b5e6-96231b3b80d8
2006-11-29 07:18:39 +00:00