Commit Graph

126 Commits

Author SHA1 Message Date
Devang Patel
b7211a2ce1 Use SmallVector instead of std::vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41207 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 00:31:24 +00:00
Nick Lewycky
d6dac0eebc Let scalar-evolution analyze loops with an unsigned comparison for the exit
condition. Fixes 1597.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40867 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-06 19:21:00 +00:00
Nick Lewycky
06323bfe03 Don't assume it's safe to transform a loop just because it's dominated by any
comparison. Fixes bug 1598.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40866 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-06 18:33:46 +00:00
Nick Lewycky
eefdebe002 Handle decrementing loops properly. Fixes PR1533.
Always pass the constant as the second parameter to HowManyLessThans.

Remove obsolete "isSigned" parameter.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@39893 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-16 02:08:00 +00:00
Dan Gohman
9a6ae965d6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-09 15:25:17 +00:00
Dan Gohman
5cec4db6ae 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37657 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-19 14:28:31 +00:00
Dan Gohman
f50cd749e1 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37628 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-18 19:30:09 +00:00
Dan Gohman
d19534add9 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37591 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-15 14:38:12 +00:00
Nick Lewycky
51e844b601 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37469 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 11:26:20 +00:00
Nick Lewycky
9d0332f7b4 Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37459 91177308-0d34-0410-b5e6-96231b3b80d8
2007-06-06 04:12:20 +00:00
Devang Patel
1997473cf7 Drop 'const'
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 01:11:54 +00:00
Devang Patel
3e15bf33e0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 21:39:20 +00:00
Lauro Ramos Venancio
c718288f49 Fix build error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36648 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-02 20:37:47 +00:00
Devang Patel
794fd75c67 Do not use typeinfo to identify pass in pass manager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-01 21:15:47 +00:00
Reid Spencer
3e35c8d15e Revert last patch. It was already fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36102 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-16 02:24:41 +00:00
Reid Spencer
b4a7fea7fd For PR1336:
Fix a div-by-zero bug noticed by APInt. This fixes:
test/Transforms/IndVarsSimplify/exit_value_tests.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36099 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-16 01:48:37 +00:00
Chris Lattner
fe560b8c85 Fix a nasty bug introduced when apint'ified. This fixes
Transforms/IndVarsSimplify/exit_value_tests.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36081 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-15 19:52:49 +00:00
Zhou Sheng
414de4df41 Eliminate unnecessary APInt construction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35740 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 17:48:27 +00:00
Zhou Sheng
fdc1e16dcf Make APInt variables do the computation stuffs instead of
ConstantExpr::getXX if possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35738 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 17:40:57 +00:00
Zhou Sheng
8342836d70 Eliminate unnecessary zext/trunc stuffs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35737 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-07 17:12:38 +00:00
Chris Lattner
2811f2a670 Treat xor of signbit like an add.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35586 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-02 05:41:38 +00:00
Reid Spencer
0797605204 Guard further against APInt operations with operands of unequal bit width.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34897 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-04 01:25:35 +00:00
Reid Spencer
9b4aeb3cc1 Fix an unequal bitwidth issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34831 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 02:59:25 +00:00
Reid Spencer
cae5754619 Prefer non-virtual calls to ConstantInt::isZero over virtual calls to
Constant::isNullValue() in situations where it is possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34821 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-02 00:28:52 +00:00
Reid Spencer
35fa43907e Make it possible to create an SCEVUnknown from an APInt as well as an int.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34816 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 22:28:51 +00:00
Reid Spencer
c7cd7a0bb1 Construct ConstantInt with simpler constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34795 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 19:32:33 +00:00
Reid Spencer
e479ef0b41 Fix last night's 445.gobmk breakage which was caused by comparison of
APInt's of unequal bitwidth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34790 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 17:17:21 +00:00
Reid Spencer
a6e8a955d6 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34782 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 07:54:15 +00:00
Reid Spencer
e8019bb1fc APIntify various computations in ScalarEvolution
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34780 91177308-0d34-0410-b5e6-96231b3b80d8
2007-03-01 07:25:48 +00:00
Reid Spencer
6263cbada2 For PR1205:
Make GetConstantFactor compute its result using an APInt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34765 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 23:31:17 +00:00
Reid Spencer
c6aedf70b3 For PR1205:
Adjust to changes in ConstantRange interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34762 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 22:03:51 +00:00
Reid Spencer
581b0d453a For PR1205:
Remove ConstantInt from ConstantRange interface and adjust its users to
compensate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34758 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 19:57:34 +00:00
Reid Spencer
dc5c159701 For PR1205:
First round of ConstantRange changes. This makes all CR constructors use
only APInt and not use ConstantInt. Clients are adjusted accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-28 18:57:32 +00:00
Reid Spencer
832254e1c2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-02-02 02:16:23 +00:00
Chris Lattner
2e3a1d137c The local "ConstantFold" method is now just a watered down version of
ConstantFoldInstOperands.  Switch to ConstantFoldInstOperands and remove
ConstantFold.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33683 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:52:44 +00:00
Chris Lattner
72d88ae544 adjust to constant folding api changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33673 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-30 23:15:43 +00:00
Reid Spencer
c10305743c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-19 21:13:56 +00:00
Jeff Cohen
1b30754ba9 Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33242 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 20:27:18 +00:00
Chris Lattner
42a7551725 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! :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33225 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 02:27:26 +00:00
Chris Lattner
b2f3e703bc Update code to eliminate calls to isInteger, calling isIntegral instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33220 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-15 01:58:56 +00:00
Chris Lattner
192e403744 Fix PR1101 and Analysis/ScalarEvolution/trip-count.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33193 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-14 01:24:47 +00:00
Chris Lattner
ef3baf0979 don't discriminate against bool
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33128 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 18:28:58 +00:00
Reid Spencer
579dca12c2 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33110 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-12 04:24:46 +00:00
Reid Spencer
4fe16d607d Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33076 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 18:21:29 +00:00
Zhou Sheng
6b6b6ef167 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33073 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-11 12:24:14 +00:00
Reid Spencer
e7ca042730 Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33003 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-08 01:26:33 +00:00
Chris Lattner
8b0e3602e2 Fix PR1015 and Transforms/IndVarsSimplify/2007-01-06-TripCount.ll, a
miscompilation of Qt.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 02:24:26 +00:00
Chris Lattner
f82188c9ce cast of int to bool no longer does a compare, rendering this fixme
obsolete


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32972 91177308-0d34-0410-b5e6-96231b3b80d8
2007-01-07 02:05:20 +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
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