Commit Graph

2719 Commits

Author SHA1 Message Date
Chris Lattner
b76efb71d4 Change the interface to Module::getOrInsertFunction to be easier to use,to resolve PR1088, and to help PR411.
This simplifies many clients also


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32989 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 08:12:01 +00:00
Chris Lattner
a121fddf3c prepare for adjustment to getOrInsertFunction method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32985 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 07:54:34 +00:00
Chris Lattner
febe5f1b3c relax some types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32982 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 07:22:20 +00:00
Chris Lattner
35057c2625 relax types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32981 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 06:59:47 +00:00
Chris Lattner
92141968cb relax some types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32980 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 06:58:05 +00:00
Chris Lattner
ee4f13a904 add -debug output for -indvars.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32971 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 01:14:12 +00:00
Chris Lattner
46013f4044 Fix regressions in InstCombine/call-cast-target.ll and InstCombine/2003-11-13-ConstExprCastCall.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32959 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 19:53:32 +00:00
Reid Spencer
78d033e086 For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32956 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 07:24:44 +00:00
Chris Lattner
80c6c3bbff this final call to canLosslesslyBitCastTo is dead, because ValueRequiresCast
is only called on integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32949 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 02:11:56 +00:00
Chris Lattner
ec47992f5c simplify some more code now that there are not multiple different integer
types of the same size


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32948 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 02:09:32 +00:00
Chris Lattner
57d8637468 eliminate some uses of canLosslesslyBitCastTo, this actually makes the code stronger, by nuking
relational pointer comparisons with casts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32947 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 01:45:59 +00:00
Chris Lattner
d5dc0fb011 no need to worry about int vs uint any more.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32946 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-06 01:37:35 +00:00
Chris Lattner
e4929dd0cc Implement InstCombine/vec_shuffle.ll:%test7, simplifying shuffles with
undef operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32899 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-05 07:36:08 +00:00
Chris Lattner
4f0e33d145 fold things like a^b != c^a -> b != c. This implements InstCombine/xor.ll:test27
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32893 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-05 03:04:57 +00:00
Chris Lattner
e617c9ed5d Compile X + ~X to -1. This implements Instcombine/add.ll:test34
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32890 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-05 02:17:46 +00:00
Reid Spencer
8c5a53a603 Death to useless bitcast instructions!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32866 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-04 05:23:51 +00:00
Chris Lattner
7ce2f8b265 Enable a couple xforms for packed vectors (undef | v) -> -1 for packed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32858 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-04 02:12:40 +00:00
Jim Laskey
52ab904ee5 Vectors are not supported by ConstantInt::getAllOnesValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32827 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-03 00:11:03 +00:00
Reid Spencer
ee5d25e5cc Fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32803 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 22:26:06 +00:00
Reid Spencer
c5b206b6be For PR950:
This patch replaces signed integer types with signless ones:
1. [US]Byte -> Int8
2. [U]Short -> Int16
3. [U]Int   -> Int32
4. [U]Long  -> Int64.
5. Removal of isSigned, isUnsigned, getSignedVersion, getUnsignedVersion
   and other methods related to signedness. In a few places this warranted
   identifying the signedness information from other sources.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32785 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-31 05:48:39 +00:00
Reid Spencer
0f9d82c5c4 For PR1066:
Fix this by ensuring that a bitcast is inserted to do sign switching. This
is only temporarily needed as the merging of signed and unsigned is next
on the SignlessTypes plate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32757 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-24 00:40:59 +00:00
Reid Spencer
b3307b232a Shut up some compilers that can't accurately analyze variable usage
correctly and emit "may be used uninitialized" warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32756 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 19:17:57 +00:00
Reid Spencer
1b0d847874 For PR1065:
Don't allow CmpInst instances to be processed in FoldSelectOpOp because
you can't easily swap their operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32753 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-23 18:58:04 +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
add2bd7f59 add a simple fast-path for dead allocas
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32750 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-22 23:14:42 +00:00
Reid Spencer
06e3f4ee7e Remove isSigned calls via foreknowledge of main's argument types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32730 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-21 07:49:49 +00:00
Reid Spencer
a2913eea9d Get rid of a useless if statement whose then and else blocks were identical.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32729 91177308-0d34-0410-b5e6-96231b3b80d8
2006-12-21 07:15:54 +00:00
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