Nick Lewycky
3783b46f9e
Instead of calculating constant factors, calculate the number of trailing
...
bits. Patch from Wojciech Matyjewicz.
llvm-svn: 44268
2007-11-22 07:59:40 +00:00
Nick Lewycky
74a26e3750
Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
...
"setcc" -> "icmp op" in comments. No functionality change.
llvm-svn: 44249
2007-11-20 08:44:50 +00:00
Nick Lewycky
5b18bd3368
Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
...
llvm-svn: 44248
2007-11-20 08:24:44 +00:00
Anton Korobeynikov
6a7ddfdb8f
Reverted r44163 per request
...
llvm-svn: 44177
2007-11-15 18:33:16 +00:00
Nick Lewycky
fbb24817cc
Fix handling of overflow in loop calculation by adding new UDiv SCEV. This SCEV
...
is disabled in the sense that it will refuse to create one from a UDiv
instruction, until the code is better tested.
llvm-svn: 44163
2007-11-15 06:30:50 +00:00
Dan Gohman
a37eaf2bf9
Move the SCEV object factors from being static members of the individual
...
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.
llvm-svn: 43224
2007-10-22 18:31:58 +00:00
Nick Lewycky
3934961878
Build the correct range for loops with unusual bounds. Fix from Jay Foad.
...
llvm-svn: 42394
2007-09-27 14:12:54 +00:00
Dale Johannesen
bed9dc423c
Next round of APFloat changes.
...
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double. Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)
llvm-svn: 41747
2007-09-06 18:13:44 +00:00
Devang Patel
b5933bbbd5
Use SmallVector instead of std::vector.
...
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Nick Lewycky
96606cec20
Let scalar-evolution analyze loops with an unsigned comparison for the exit
...
condition. Fixes 1597.
llvm-svn: 40867
2007-08-06 19:21:00 +00:00
Nick Lewycky
b9819f3a8b
Don't assume it's safe to transform a loop just because it's dominated by any
...
comparison. Fixes bug 1598.
llvm-svn: 40866
2007-08-06 18:33:46 +00:00
Nick Lewycky
5246026c8c
Handle decrementing loops properly. Fixes PR1533.
...
Always pass the constant as the second parameter to HowManyLessThans.
Remove obsolete "isSigned" parameter.
llvm-svn: 39893
2007-07-16 02:08:00 +00:00
Dan Gohman
0a76e7f678
Move the APInt form of SCEVUnknown::getIntegerSCEV to SCEVConstant::get, and
...
use SCEVConstant::get instead of SCEVUnknown::get when constructing a SCEV
for a ConstantInt.
llvm-svn: 38457
2007-07-09 15:25:17 +00:00
Dan Gohman
32f53bbd85
Rename ScalarEvolution::deleteInstructionFromRecords to
...
deleteValueFromRecords and loosen the types to all it to accept
Value* instead of just Instruction*, since this is what
ScalarEvolution uses internally anyway. This allows more flexibility
for future uses.
llvm-svn: 37657
2007-06-19 14:28:31 +00:00
Dan Gohman
eed125f315
In SCEVAddExpr::get, skip over any cast operands before looking for nested
...
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.
llvm-svn: 37628
2007-06-18 19:30:09 +00:00
Dan Gohman
cb9e09ad57
Add a SCEV class and supporting code for sign-extend expressions.
...
This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.
llvm-svn: 37591
2007-06-15 14:38:12 +00:00
Nick Lewycky
df543f4b84
Optimize this test. Firstly, only Instructions may use other Instructions.
...
Secondly, checking whether removal succeeded tells you whether it was in
the map to begin with.
llvm-svn: 37469
2007-06-06 11:26:20 +00:00
Nick Lewycky
3e84212897
Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll
...
llvm-svn: 37459
2007-06-06 04:12:20 +00:00
Devang Patel
8c78a0bff0
Drop 'const'
...
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
e95c6ad802
Use 'static const char' instead of 'static const int'.
...
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.
llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Lauro Ramos Venancio
41223586a2
Fix build error.
...
llvm-svn: 36648
2007-05-02 20:37:47 +00:00
Devang Patel
09f162ca6a
Do not use typeinfo to identify pass in pass manager.
...
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Reid Spencer
a3cfb8a683
Revert last patch. It was already fixed.
...
llvm-svn: 36102
2007-04-16 02:24:41 +00:00
Reid Spencer
8be22e4e04
For PR1336:
...
Fix a div-by-zero bug noticed by APInt. This fixes:
test/Transforms/IndVarsSimplify/exit_value_tests.llx
llvm-svn: 36099
2007-04-16 01:48:37 +00:00
Chris Lattner
cad61e81c1
Fix a nasty bug introduced when apint'ified. This fixes
...
Transforms/IndVarsSimplify/exit_value_tests.llx
llvm-svn: 36081
2007-04-15 19:52:49 +00:00
Zhou Sheng
2852d99a48
Eliminate unnecessary APInt construction.
...
llvm-svn: 35740
2007-04-07 17:48:27 +00:00
Zhou Sheng
c0297896aa
Make APInt variables do the computation stuffs instead of
...
ConstantExpr::getXX if possible.
llvm-svn: 35738
2007-04-07 17:40:57 +00:00
Zhou Sheng
1459c73481
Eliminate unnecessary zext/trunc stuffs.
...
llvm-svn: 35737
2007-04-07 17:12:38 +00:00
Chris Lattner
a3e0bb4ebb
Treat xor of signbit like an add.
...
llvm-svn: 35586
2007-04-02 05:41:38 +00:00
Reid Spencer
69904f939a
Guard further against APInt operations with operands of unequal bit width.
...
llvm-svn: 34897
2007-03-04 01:25:35 +00:00
Reid Spencer
e1336b4086
Fix an unequal bitwidth issue.
...
llvm-svn: 34831
2007-03-02 02:59:25 +00:00
Reid Spencer
2e54a15943
Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
...
Constant::isNullValue() in situations where it is possible.
llvm-svn: 34821
2007-03-02 00:28:52 +00:00
Reid Spencer
caace8cffd
Make it possible to create an SCEVUnknown from an APInt as well as an int.
...
llvm-svn: 34816
2007-03-01 22:28:51 +00:00
Reid Spencer
fad3f247e4
Construct ConstantInt with simpler constructor.
...
llvm-svn: 34795
2007-03-01 19:32:33 +00:00
Reid Spencer
6ba8edc789
Fix last night's 445.gobmk breakage which was caused by comparison of
...
APInt's of unequal bitwidth.
llvm-svn: 34790
2007-03-01 17:17:21 +00:00
Reid Spencer
6a44033465
Remove the "isSigned" parameters from ConstantRange. It turns out they
...
are not needed as the results are the same with or without it.
Patch by Nicholas Lewycky.
llvm-svn: 34782
2007-03-01 07:54:15 +00:00
Reid Spencer
983e3b37de
APIntify various computations in ScalarEvolution
...
llvm-svn: 34780
2007-03-01 07:25:48 +00:00
Reid Spencer
b0170c4259
For PR1205:
...
Make GetConstantFactor compute its result using an APInt.
llvm-svn: 34765
2007-02-28 23:31:17 +00:00
Reid Spencer
d373b9dc59
For PR1205:
...
Adjust to changes in ConstantRange interface.
llvm-svn: 34762
2007-02-28 22:03:51 +00:00
Reid Spencer
3a7e9d8e75
For PR1205:
...
Remove ConstantInt from ConstantRange interface and adjust its users to
compensate.
llvm-svn: 34758
2007-02-28 19:57:34 +00:00
Reid Spencer
56f784d12d
For PR1205:
...
First round of ConstantRange changes. This makes all CR constructors use
only APInt and not use ConstantInt. Clients are adjusted accordingly.
llvm-svn: 34756
2007-02-28 18:57:32 +00:00
Reid Spencer
2341c22ec7
Changes to support making the shift instructions be true BinaryOperators.
...
This feature is needed in order to support shifts of more than 255 bits
on large integer types. This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
shl i32 %X, 1
instead of
shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.
llvm-svn: 33776
2007-02-02 02:16:23 +00:00
Chris Lattner
373dee0947
The local "ConstantFold" method is now just a watered down version of
...
ConstantFoldInstOperands. Switch to ConstantFoldInstOperands and remove
ConstantFold.
llvm-svn: 33683
2007-01-30 23:52:44 +00:00
Chris Lattner
8dbea5454d
adjust to constant folding api changes.
...
llvm-svn: 33673
2007-01-30 23:15:43 +00:00
Reid Spencer
a94d394ad2
For PR1043:
...
This is the final patch for this PR. It implements some minor cleanup
in the use of IntegerType, to wit:
1. Type::getIntegerTypeMask -> IntegerType::getBitMask
2. Type::Int*Ty changed to IntegerType* from Type*
3. ConstantInt::getType() returns IntegerType* now, not Type*
This also fixes PR1120.
Patch by Sheng Zhou.
llvm-svn: 33370
2007-01-19 21:13:56 +00:00
Jeff Cohen
9431075206
Unbreak VC++ build.
...
llvm-svn: 33242
2007-01-15 20:27:18 +00:00
Chris Lattner
03c4953cdd
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! :)
llvm-svn: 33225
2007-01-15 02:27:26 +00:00
Chris Lattner
4442e4b401
Update code to eliminate calls to isInteger, calling isIntegral instead.
...
llvm-svn: 33220
2007-01-15 01:58:56 +00:00
Chris Lattner
5a55476211
Fix PR1101 and Analysis/ScalarEvolution/trip-count.ll
...
llvm-svn: 33193
2007-01-14 01:24:47 +00:00
Chris Lattner
19cfb04d04
don't discriminate against bool
...
llvm-svn: 33128
2007-01-12 18:28:58 +00:00
Reid Spencer
cddc9dfe97
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
Reid Spencer
542964f55b
Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
...
llvm-svn: 33076
2007-01-11 18:21:29 +00:00
Zhou Sheng
75b871fb1e
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
Reid Spencer
7928c2fb9c
Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits.
...
llvm-svn: 33003
2007-01-08 01:26:33 +00:00
Chris Lattner
18954852ae
Fix PR1015 and Transforms/IndVarsSimplify/2007-01-06-TripCount.ll, a
...
miscompilation of Qt.
llvm-svn: 32974
2007-01-07 02:24:26 +00:00
Chris Lattner
39087c7127
cast of int to bool no longer does a compare, rendering this fixme
...
obsolete
llvm-svn: 32972
2007-01-07 02:05:20 +00:00
Reid Spencer
c635f47d9a
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
266e42b312
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
Reid Spencer
cfcec2caac
Add a FIXME about signedness.
...
llvm-svn: 32732
2006-12-21 18:59:16 +00:00
Reid Spencer
a8a90a2f97
Add some comments about things that can go away once signless types are in.
...
llvm-svn: 32727
2006-12-21 06:43:46 +00:00
Chris Lattner
57ef942306
eliminate static ctors from Statistics
...
llvm-svn: 32697
2006-12-19 22:30:33 +00:00
Chris Lattner
0a1e99317e
Fix a bug in GetConstantFactor for affine expressions, in which the existing
...
code was wrong for things like 3+4*i.
llvm-svn: 32662
2006-12-19 01:16:02 +00:00
Reid Spencer
bb65ebf9a1
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
Reid Spencer
1ac0ab0850
Get even more accurate on the casting.
...
llvm-svn: 32478
2006-12-12 09:17:50 +00:00
Reid Spencer
b341b0861d
Change inferred getCast into specific getCast. Passes all tests.
...
llvm-svn: 32469
2006-12-12 05:05:00 +00:00
Chris Lattner
49b090ed61
teach scev to analyze X*4|1 like X*4+c. This allows us to produce:
...
LBB1_1: #bb
movdqa (%esi), %xmm2
movaps %xmm2, %xmm3
punpcklbw %xmm0, %xmm3
movaps %xmm3, %xmm4
punpcklwd %xmm0, %xmm4
cvtdq2ps %xmm4, %xmm4
mulps %xmm1, %xmm4
movaps %xmm4, (%edi)
leal 1(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 2(,%eax,4), %ebx
shll $4, %ebx
punpckhbw %xmm0, %xmm2
movaps %xmm2, %xmm3
punpcklwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 3(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm2
cvtdq2ps %xmm2, %xmm2
mulps %xmm1, %xmm2
movaps %xmm2, (%edx,%ebx)
addl $64, %edi
incl %eax
addl $16, %esi
cmpl %ecx, %eax
jne LBB1_1 #bb
instead of:
LBB1_1: #bb
movdqa (%esi), %xmm2
movaps %xmm2, %xmm3
punpcklbw %xmm0, %xmm3
movaps %xmm3, %xmm4
punpcklwd %xmm0, %xmm4
cvtdq2ps %xmm4, %xmm4
mulps %xmm1, %xmm4
movaps %xmm4, (%edi)
leal 1(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 2(,%eax,4), %ebx
shll $4, %ebx
punpckhbw %xmm0, %xmm2
movaps %xmm2, %xmm3
punpcklwd %xmm0, %xmm3
cvtdq2ps %xmm3, %xmm3
mulps %xmm1, %xmm3
movaps %xmm3, (%edx,%ebx)
leal 3(,%eax,4), %ebx
shll $4, %ebx
punpckhwd %xmm0, %xmm2
cvtdq2ps %xmm2, %xmm2
mulps %xmm1, %xmm2
movaps %xmm2, (%edx,%ebx)
addl $64, %edi
incl %eax
addl $16, %esi
cmpl %ecx, %eax
jne LBB1_1 #bb
for a testcase.
llvm-svn: 32463
2006-12-12 02:26:09 +00:00
Chris Lattner
b2f5973867
clarify some comments, simplify some checks, fix:
...
Regression/Transforms/IndVarsSimplify/2006-12-10-BitCast.ll
llvm-svn: 32420
2006-12-11 00:12:31 +00:00
Bill Wendling
f3baad3ee1
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
Chris Lattner
700b873130
Detemplatize the Statistic class. The only type it is instantiated with
...
is 'unsigned'.
llvm-svn: 32279
2006-12-06 17:46:33 +00:00
Reid Spencer
0646eb415d
Finally get the casting right in this file. Also, remove some unnecessary
...
casting because sdiv doesn't require operand signs to match any more.
llvm-svn: 32240
2006-12-05 22:39:58 +00:00
Reid Spencer
f37dc65b08
Bail on the getInferredCast idea. Remove the function and convert
...
remaining uses to more specific casts.
llvm-svn: 32231
2006-12-05 19:14:13 +00:00
Reid Spencer
e6328cab48
Fix comment grammaro
...
llvm-svn: 32198
2006-12-04 21:33:23 +00:00
Reid Spencer
1ba24bb1e4
Fix inferred casts.
...
llvm-svn: 32180
2006-12-04 17:05:42 +00:00
Jeff Cohen
cc08c83186
Unbreak VC++ build.
...
llvm-svn: 32113
2006-12-02 02:22:01 +00:00
Bill Wendling
597d451fea
Removed some of the iostream #includes. Moved towards converting to using
...
llvm streams
llvm-svn: 31983
2006-11-28 22:46:12 +00:00
Reid Spencer
6c38f0bb07
For PR950:
...
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.
llvm-svn: 31931
2006-11-27 01:05:10 +00:00
Jim Laskey
61feeb90f9
Remove redundant <cmath>.
...
llvm-svn: 31561
2006-11-08 19:16:44 +00:00
Reid Spencer
7eb55b395f
For PR950:
...
Replace the REM instruction with UREM, SREM and FREM.
llvm-svn: 31369
2006-11-02 01:53:59 +00:00
Reid Spencer
20ffdbe7c1
Make ScalarEvolution actually use a ZeroExtend expression instead of
...
having SCZeroExtendExpr be equivalent to SCTruncate
llvm-svn: 31355
2006-11-01 21:53:12 +00:00
Reid Spencer
7e80b0b31e
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.
llvm-svn: 31195
2006-10-26 06:15:43 +00:00
Reid Spencer
e0fc4dfc22
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.
llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Chris Lattner
538c6eb05c
Fix some more static dtor issues.
...
llvm-svn: 30724
2006-10-04 21:49:37 +00:00
Chris Lattner
a84df0a2f1
Eliminate ConstantBool::True and ConstantBool::False. Instead, provide
...
ConstantBool::getTrue() and ConstantBool::getFalse().
llvm-svn: 30666
2006-09-28 23:36:21 +00:00
Chris Lattner
3c9b2420df
Eliminate RegisterAnalysis. RegisterPass now does all that is necessary.
...
llvm-svn: 29921
2006-08-27 22:30:17 +00:00
Chris Lattner
3d27be1333
s|llvm/Support/Visibility.h|llvm/Support/Compiler.h|
...
llvm-svn: 29911
2006-08-27 12:54:02 +00:00
Chris Lattner
996795b0dd
Use hidden visibility to make symbols in an anonymous namespace get
...
dropped. This shrinks libllvmgcc.dylib another 67K
llvm-svn: 28975
2006-06-28 23:17:24 +00:00
Chris Lattner
e8cbdbf314
Implement Transforms/IndVarsSimplify/complex-scev.ll, a case where we didn't
...
recognize some simple affine IV's.
llvm-svn: 27982
2006-04-26 18:34:07 +00:00
Chris Lattner
6b2c9748c3
Signed shr by a constant is not the same as sdiv by 2^k
...
llvm-svn: 27395
2006-04-04 06:11:42 +00:00
Chris Lattner
98e9604d5d
Fix Transforms/IndVarsSimplify/2006-03-31-NegativeStride.ll and
...
PR726 by performing consistent signed division, not consistent unsigned
division when evaluating scev's. Do not touch udivs.
llvm-svn: 27326
2006-04-01 04:48:52 +00:00
Chris Lattner
6806c02380
Add explicit iostream #includes
...
llvm-svn: 25513
2006-01-22 23:19:18 +00:00
John Criswell
fe5f33b120
Move some constant folding code shared by Analysis and Transform passes
...
into the LLVMAnalysis library.
This allows LLVMTranform and LLVMTransformUtils to be archives and linked
with LLVMAnalysis.a, which provides any missing definitions.
llvm-svn: 24036
2005-10-27 15:54:34 +00:00
Chris Lattner
cd002b2461
wrap a long line
...
llvm-svn: 23507
2005-09-28 22:30:58 +00:00
Chris Lattner
e515416396
Fix Transforms/LoopStrengthReduce/2005-08-15-AddRecIV.ll
...
llvm-svn: 22797
2005-08-16 00:37:01 +00:00
Chris Lattner
587a75b6e0
Teach LLVM to know how many times a loop executes when constructed with
...
a < expression, e.g.: for (i = m; i < n; ++i)
llvm-svn: 22793
2005-08-15 23:33:51 +00:00
Chris Lattner
35c0e2ee33
Fix an obvious oops
...
llvm-svn: 22742
2005-08-10 00:59:40 +00:00
Chris Lattner
b310ac4a86
implement two helper methods
...
llvm-svn: 22736
2005-08-09 23:36:33 +00:00
Misha Brukman
01808caded
Remove trailing whitespace
...
llvm-svn: 21416
2005-04-21 21:13:18 +00:00
Chris Lattner
747eee2707
Don't make this require loopsimplify. It works BETTER with loop simplify
...
but should not require it.
llvm-svn: 21123
2005-04-06 21:45:00 +00:00
Chris Lattner
adb043c2d8
Export two methods for getting -X and A-B.
...
llvm-svn: 20527
2005-03-09 05:34:41 +00:00
Chris Lattner
0b0f3520cb
DCE a dead function
...
llvm-svn: 20339
2005-02-26 23:36:45 +00:00