Commit Graph

129 Commits

Author SHA1 Message Date
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