Chris Lattner
9801f36d97
Fix PR1110 and Analysis/Dominators/2007-01-14-BreakCritEdges.ll by being
...
more careful about unreachable code when updating dominator info.
llvm-svn: 33204
2007-01-14 18:33:35 +00:00
Chris Lattner
8b316c71e2
Fix Transforms/InstCombine/2007-01-13-ExtCompareMiscompile.ll, which is part
...
of PR1107
llvm-svn: 33185
2007-01-13 23:11:38 +00:00
Reid Spencer
2a25084316
Fix indentation to prior level for easier diffs.
...
llvm-svn: 33184
2007-01-13 05:10:53 +00:00
Nick Lewycky
fa95bfe36f
"Default context" blocks can occur after a non-default one. This meant
...
that properties were being applied where they didn't belong. Fixes crash
in new MiBench testcase.
Also mark debugging code as such in #ifdef.
llvm-svn: 33177
2007-01-13 02:05:28 +00:00
Chris Lattner
8b6e091a62
Fix a minor bug handling constant exprs, introduced by a recent patch.
...
llvm-svn: 33175
2007-01-13 00:42:58 +00:00
Chris Lattner
ec0b2f5e29
fix a bug in a recent patch
...
llvm-svn: 33164
2007-01-13 00:02:49 +00:00
Chris Lattner
7cfcfbb801
simplify some code
...
llvm-svn: 33150
2007-01-12 22:51:20 +00:00
Chris Lattner
48ec71f551
Remove over-general comparisons
...
llvm-svn: 33147
2007-01-12 22:49:11 +00:00
Chris Lattner
18fa0e53fa
eliminate redundant check
...
llvm-svn: 33132
2007-01-12 18:35:11 +00:00
Chris Lattner
115b9b1a2b
Branch conditions must be i1
...
llvm-svn: 33129
2007-01-12 18:30:11 +00:00
Reid Spencer
373d2bccea
For PR1064:
...
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
llvm-svn: 33113
2007-01-12 07:05:14 +00:00
Reid Spencer
3d986f6487
Implement review feedback for the ConstantBool->ConstantInt merge. Chris
...
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.
llvm-svn: 33110
2007-01-12 04:24:46 +00:00
Nick Lewycky
8229bc7c80
If we know that it's a constant being casted, propagate through the cast
...
instruction. Doesn't work the other way though (can't recover bits that
have been truncated).
llvm-svn: 33104
2007-01-12 01:23:53 +00:00
Nick Lewycky
8f02993e38
Clean up logic after ConstantBool removal.
...
llvm-svn: 33096
2007-01-12 00:02:12 +00:00
Reid Spencer
f3265181e2
Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
...
llvm-svn: 33076
2007-01-11 18:21:29 +00:00
Zhou Sheng
17235b194b
Remove unnecessary boolean type check.
...
llvm-svn: 33075
2007-01-11 14:38:17 +00:00
Zhou Sheng
23d24526b2
For PR1043:
...
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.
llvm-svn: 33073
2007-01-11 12:24:14 +00:00
Zhou Sheng
7c83700514
Fixed indentation.
...
llvm-svn: 33072
2007-01-11 10:33:26 +00:00
Nick Lewycky
fad35ab64a
Quiet compiler warning. The only reason the function is marked virtual
...
is so that it can be called from inside a debugger.
llvm-svn: 33067
2007-01-11 02:38:21 +00:00
Nick Lewycky
7fb0a6d2ab
New predicate simplifier!
...
Please do not enable, there is still some known miscompile problem.
llvm-svn: 33066
2007-01-11 02:32:38 +00:00
Chris Lattner
441127f582
Fix a bug in heap-sra that caused compilation failure of office-ispell.
...
llvm-svn: 33043
2007-01-09 23:29:37 +00:00
Jeff Cohen
2bfbf6b99c
Unbreak VC++ build.
...
llvm-svn: 33021
2007-01-08 20:17:17 +00:00
Reid Spencer
c857bb0b27
Comparison of primitive type sizes should now be done in bits, not bytes.
...
This patch converts getPrimitiveSize to getPrimitiveSizeInBits where it is
appropriate to do so (comparison of integer primitive types).
llvm-svn: 33012
2007-01-08 16:32:00 +00:00
Reid Spencer
405e204fb3
For PR1097:
...
Enable complex addressing modes on 64-bit platforms involving two induction
variables by keeping a size and scale in 64-bits not 32.
Patch by Dan Gohman.
llvm-svn: 33011
2007-01-08 16:17:51 +00:00
Reid Spencer
74e4297a4c
Types should be const.
...
llvm-svn: 33001
2007-01-07 21:45:41 +00:00
Chris Lattner
cd53253271
this pass is unused
...
llvm-svn: 32998
2007-01-07 18:12:43 +00:00
Chris Lattner
aa5051ae7f
Change the interface to Module::getOrInsertFunction to be easier to use,to resolve PR1088, and to help PR411.
...
This simplifies many clients also
llvm-svn: 32989
2007-01-07 08:12:01 +00:00
Chris Lattner
a2f5c06174
prepare for adjustment to getOrInsertFunction method
...
llvm-svn: 32985
2007-01-07 07:54:34 +00:00
Chris Lattner
a966510e59
relax some types
...
llvm-svn: 32982
2007-01-07 07:22:20 +00:00
Chris Lattner
3e1aa998fb
relax types
...
llvm-svn: 32981
2007-01-07 06:59:47 +00:00
Chris Lattner
e7017c4ccf
relax some types
...
llvm-svn: 32980
2007-01-07 06:58:05 +00:00
Chris Lattner
e7eca26371
add -debug output for -indvars.
...
llvm-svn: 32971
2007-01-07 01:14:12 +00:00
Chris Lattner
808722cded
Fix regressions in InstCombine/call-cast-target.ll and InstCombine/2003-11-13-ConstExprCastCall.ll
...
llvm-svn: 32959
2007-01-06 19:53:32 +00:00
Reid Spencer
cdaf88ff9d
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.
llvm-svn: 32956
2007-01-06 07:24:44 +00:00
Chris Lattner
7a0046dc65
this final call to canLosslesslyBitCastTo is dead, because ValueRequiresCast
...
is only called on integers.
llvm-svn: 32949
2007-01-06 02:11:56 +00:00
Chris Lattner
3155b15453
simplify some more code now that there are not multiple different integer
...
types of the same size
llvm-svn: 32948
2007-01-06 02:09:32 +00:00
Chris Lattner
9691941c37
eliminate some uses of canLosslesslyBitCastTo, this actually makes the code stronger, by nuking
...
relational pointer comparisons with casts.
llvm-svn: 32947
2007-01-06 01:45:59 +00:00
Chris Lattner
176b690f07
no need to worry about int vs uint any more.
...
llvm-svn: 32946
2007-01-06 01:37:35 +00:00
Chris Lattner
6cef95214b
Implement InstCombine/vec_shuffle.ll:%test7, simplifying shuffles with
...
undef operands.
llvm-svn: 32899
2007-01-05 07:36:08 +00:00
Chris Lattner
79238a345b
fold things like a^b != c^a -> b != c. This implements InstCombine/xor.ll:test27
...
llvm-svn: 32893
2007-01-05 03:04:57 +00:00
Chris Lattner
f02fdf92a2
Compile X + ~X to -1. This implements Instcombine/add.ll:test34
...
llvm-svn: 32890
2007-01-05 02:17:46 +00:00
Reid Spencer
dd9d393e32
Death to useless bitcast instructions!
...
llvm-svn: 32866
2007-01-04 05:23:51 +00:00
Chris Lattner
06b8d30502
Enable a couple xforms for packed vectors (undef | v) -> -1 for packed.
...
llvm-svn: 32858
2007-01-04 02:12:40 +00:00
Jim Laskey
06f1a4227e
Vectors are not supported by ConstantInt::getAllOnesValue.
...
llvm-svn: 32827
2007-01-03 00:11:03 +00:00
Reid Spencer
7eeddcbe43
Fix a typo.
...
llvm-svn: 32803
2006-12-31 22:26:06 +00:00
Reid Spencer
0fb7fa82d4
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.
llvm-svn: 32785
2006-12-31 05:48:39 +00:00
Reid Spencer
66a349efb1
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.
llvm-svn: 32757
2006-12-24 00:40:59 +00:00
Reid Spencer
a4415de894
Shut up some compilers that can't accurately analyze variable usage
...
correctly and emit "may be used uninitialized" warnings.
llvm-svn: 32756
2006-12-23 19:17:57 +00:00
Reid Spencer
c9426f9566
For PR1065:
...
Don't allow CmpInst instances to be processed in FoldSelectOpOp because
you can't easily swap their operands.
llvm-svn: 32753
2006-12-23 18:58:04 +00:00
Reid Spencer
4428c3483b
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.
llvm-svn: 32751
2006-12-23 06:05:41 +00:00
Chris Lattner
456861c115
add a simple fast-path for dead allocas
...
llvm-svn: 32750
2006-12-22 23:14:42 +00:00
Reid Spencer
7f2fd86692
Remove isSigned calls via foreknowledge of main's argument types.
...
llvm-svn: 32730
2006-12-21 07:49:49 +00:00
Reid Spencer
3b3cc92060
Get rid of a useless if statement whose then and else blocks were identical.
...
llvm-svn: 32729
2006-12-21 07:15:54 +00:00
Chris Lattner
c4b04b65ba
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
llvm-svn: 32715
2006-12-20 06:21:33 +00:00
Chris Lattner
dfbfc21795
switch statistics over to not use static ctors.
...
llvm-svn: 32709
2006-12-19 23:16:47 +00:00
Chris Lattner
8f9d2ddaf7
eliminate static ctor from example.
...
llvm-svn: 32696
2006-12-19 22:24:09 +00:00
Chris Lattner
a4ef9d3263
remove dead statistic
...
llvm-svn: 32695
2006-12-19 22:23:21 +00:00
Chris Lattner
4d19c9634d
switch more statistics over to STATISTIC, eliminating static ctors. Also,
...
delete some dead ones.
llvm-svn: 32694
2006-12-19 22:17:40 +00:00
Chris Lattner
44723daefa
Eliminate static ctors due to Statistic objects
...
llvm-svn: 32693
2006-12-19 22:09:18 +00:00
Chris Lattner
7d23f71814
Convert more Statistic's over to STATISTIC
...
llvm-svn: 32692
2006-12-19 21:49:03 +00:00
Chris Lattner
9e7640cf02
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.
llvm-svn: 32690
2006-12-19 21:40:18 +00:00
Reid Spencer
f6bd59ba81
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.
llvm-svn: 32654
2006-12-18 08:47:13 +00:00
Reid Spencer
f31673d965
Convert the last use of two-argument ConstantExpr::getCast into another
...
form so we can remove that method from ConstantExpr.
llvm-svn: 32652
2006-12-18 08:16:27 +00:00
Bill Wendling
7f6a73eb5c
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.
llvm-svn: 32636
2006-12-17 05:15:13 +00:00
Chris Lattner
6bdae11796
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.
llvm-svn: 32634
2006-12-16 21:21:53 +00:00
Chris Lattner
ab423afd90
re-enable a temporarily-reverted patch
...
llvm-svn: 32595
2006-12-15 07:32:38 +00:00
Reid Spencer
67cca26f75
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.
llvm-svn: 32548
2006-12-13 18:21:21 +00:00
Reid Spencer
8479bb2735
Implement review feedback. Most of this has to do with removing unnecessary
...
cast instructions. A few are bug fixes.
llvm-svn: 32544
2006-12-13 17:19:09 +00:00
Reid Spencer
a9a637d6e2
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.
llvm-svn: 32539
2006-12-13 08:33:33 +00:00
Reid Spencer
32b08ba50f
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.
llvm-svn: 32538
2006-12-13 08:27:15 +00:00
Reid Spencer
ad772bfec3
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.
llvm-svn: 32535
2006-12-13 08:06:42 +00:00
Reid Spencer
540e6eb24b
Fix some casts. isdigit(c) returns 0 or 1, not 0 or -1
...
llvm-svn: 32534
2006-12-13 08:04:32 +00:00
Chris Lattner
b486de5e73
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.
llvm-svn: 32524
2006-12-13 02:26:45 +00:00
Reid Spencer
50702907eb
Replace CastInst::createInferredCast calls with more accurate cast
...
creation calls.
llvm-svn: 32521
2006-12-13 00:50:17 +00:00
Reid Spencer
0e981c9088
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.
llvm-svn: 32514
2006-12-12 23:36:14 +00:00
Chris Lattner
6ff0a2a18d
this can be trunc or bitcast, per line 3092.
...
llvm-svn: 32487
2006-12-12 19:11:20 +00:00
Chris Lattner
2f28a1e015
Fix regression on 400.perlbench last night.
...
llvm-svn: 32486
2006-12-12 18:41:03 +00:00
Reid Spencer
3ac324ab41
Fix numerous inferred casts.
...
llvm-svn: 32479
2006-12-12 09:18:51 +00:00
Reid Spencer
3d1b0dfba6
Fix the casting for the computation of the Malloc size.
...
llvm-svn: 32477
2006-12-12 09:17:08 +00:00
Reid Spencer
562b83c7df
Change inferred getCast into specific getCast. Passes all tests.
...
llvm-svn: 32469
2006-12-12 05:05:00 +00:00
Chris Lattner
a9b75a7e35
Patch for PR1045 and Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll
...
llvm-svn: 32468
2006-12-12 04:24:41 +00:00
Chris Lattner
28e7eaf6b8
trunc to integer, not to FP.
...
llvm-svn: 32426
2006-12-11 01:17:00 +00:00
Chris Lattner
a8eec08185
implement promotion of unions containing two packed types of the same width.
...
This implements Transforms/ScalarRepl/union-packed.ll
llvm-svn: 32422
2006-12-11 00:35:08 +00:00
Chris Lattner
098fb42690
* 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
llvm-svn: 32418
2006-12-10 23:56:50 +00:00
Reid Spencer
069149765d
Incorporate any changes in the successor blocks into the result of
...
MarkAliveBlocks.
llvm-svn: 32375
2006-12-08 21:52:01 +00:00
Bill Wendling
f13d78d3b8
What should be the last unnecessary <iostream>s in the library.
...
llvm-svn: 32333
2006-12-07 22:21:48 +00:00
Bill Wendling
23b8b13c9d
Removing even more <iostream> includes.
...
llvm-svn: 32320
2006-12-07 20:04:42 +00:00
Bill Wendling
a3246c4272
Changed llvm_ostream et all to OStream. llvm_cerr, llvm_cout, llvm_null, are
...
now cerr, cout, and NullStream resp.
llvm-svn: 32298
2006-12-07 01:30:32 +00:00
Reid Spencer
ff6cd88f93
Update ConstantIntegral Max/Min tests for new interface.
...
llvm-svn: 32288
2006-12-06 20:39:57 +00:00
Chris Lattner
06ba0b8202
add missing #include
...
llvm-svn: 32280
2006-12-06 18:14:47 +00:00
Chris Lattner
a531ce882e
Detemplatize the Statistic class. The only type it is instantiated with
...
is 'unsigned'.
llvm-svn: 32279
2006-12-06 17:46:33 +00:00
Chris Lattner
3d1758e08c
Remove the 'printname' argument to WriteAsOperand. It is always true, and
...
passing false would make the asmprinter fail anyway.
llvm-svn: 32264
2006-12-06 06:16:21 +00:00
Chris Lattner
8fac1e29c7
counter should be unsigned.
...
llvm-svn: 32252
2006-12-06 01:50:04 +00:00
Chris Lattner
e0738f8f8b
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.
llvm-svn: 32209
2006-12-05 01:26:29 +00:00
Devang Patel
ae17721f63
SCCP does not handle Packed Type properly. Disable Packed Type handling
...
for now.
llvm-svn: 32208
2006-12-04 23:54:59 +00:00
Reid Spencer
d727d239f8
Update call to CastInst::getCastOpcode for its new signature.
...
llvm-svn: 32166
2006-12-04 02:48:01 +00:00
Jeff Cohen
f99052befb
Unbreak VC++ build.
...
llvm-svn: 32113
2006-12-02 02:22:01 +00:00
Chris Lattner
1629b0d995
disable transformations that are invalid for fp vectors. This fixes
...
Transforms/InstCombine/2006-12-01-BadFPVectorXform.ll
llvm-svn: 32112
2006-12-02 00:13:08 +00:00
Reid Spencer
529fb41272
Remove 4 FIXMEs to hack around cast-to-bool problems which no longer exist.
...
llvm-svn: 32051
2006-11-30 23:13:36 +00:00
Chris Lattner
f3806f1c16
make it clear that this is always a zext
...
llvm-svn: 32044
2006-11-30 17:35:08 +00:00