[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp (r1.37) removed --- Log message: Move ConstantRange class to lib/Support from lib/Analysis and make its interface not depend on Type or ICmpInst. --- Diffs of the changes: (+0 -0) 0 files changed ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.36 -> 1.37 ScalarEvolution.cpp updated: 1.94 -> 1.95 --- Log message: For PR1205: http://llvm.org/PR1205 : Remove ConstantInt from ConstantRange interface and adjust its users to compensate. --- Diffs of the changes: (+30 -45) ConstantRange.cpp | 27 +++ ScalarEvolution.cpp | 48 +++- 2 files changed, 30 insertions(+), 45 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.36 llvm/lib/Analysis/ConstantRange.cpp:1.37 --- llvm/lib/Analysis/ConstantRange.cpp:1.36Wed Feb 28 12:57:32 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Wed Feb 28 13:57:34 2007 @@ -22,7 +22,6 @@ //===--===// #include "llvm/Support/ConstantRange.h" -#include "llvm/Constants.h" #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/Type.h" @@ -107,14 +106,6 @@ return IntegerType::get(Lower.getBitWidth()); } -ConstantInt *ConstantRange::getLower() const { - return ConstantInt::get(getType(), Lower); -} - -ConstantInt *ConstantRange::getUpper() const { - return ConstantInt::get(getType(), Upper); -} - /// isFullSet - Return true if this set contains all of the elements possible /// for this data-type bool ConstantRange::isFullSet() const { @@ -136,14 +127,6 @@ return Lower.ugt(Upper); } -/// getSingleElement - If this set contains a single element, return it, -/// otherwise return null. -ConstantInt *ConstantRange::getSingleElement() const { - if (Upper == Lower + 1) // Is it a single element range? -return ConstantInt::get(getType(), Lower); - return 0; -} - /// getSetSize - Return the number of elements in this set. /// APInt ConstantRange::getSetSize() const { @@ -161,14 +144,13 @@ /// contains - Return true if the specified value is in the set. /// -bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const { +bool ConstantRange::contains(const APInt &V, bool isSigned) const { if (Lower == Upper) { if (isFullSet()) return true; return false; } - const APInt &V = Val->getValue(); if (!isWrappedSet(isSigned)) if (isSigned) return Lower.sle(V) && V.slt(Upper); @@ -182,14 +164,11 @@ /// subtract - Subtract the specified constant from the endpoints of this /// constant range. -ConstantRange ConstantRange::subtract(ConstantInt *CI) const { - assert(CI->getType() == getType() && - "Cannot subtract from different type range or non-integer!"); +ConstantRange ConstantRange::subtract(const APInt &Val) const { + assert(Val.getBitWidth() == Lower.getBitWidth() && "Wrong bit width"); // If the set is empty or full, don't modify the endpoints. if (Lower == Upper) return *this; - - const APInt &Val = CI->getValue(); return ConstantRange(Lower - Val, Upper - Val); } Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.94 llvm/lib/Analysis/ScalarEvolution.cpp:1.95 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.94 Wed Feb 28 12:57:32 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Wed Feb 28 13:57:34 2007 @@ -127,6 +127,12 @@ return ConstantRange(getType()); } +uint32_t SCEV::getBitWidth() const { + if (const IntegerType* ITy = dyn_cast(getType())) +return ITy->getBitWidth(); + return 0; +} + SCEVCouldNotCompute::SCEVCouldNotCompute() : SCEV(scCouldNotCompute) {} @@ -2320,7 +2326,7 @@ SCEVHandle Shifted = SCEVAddRecExpr::get(Operands, getLoop()); if (SCEVAddRecExpr *ShiftedAddRec = dyn_cast(Shifted)) return ShiftedAddRec->getNumIterationsInRange( - Range.subtract(SC->getValue()),isSigned); + Range.subtract(SC->getValue()->getValue()),isSigned); // This is strange and shouldn't happen. return new SCEVCouldNotCompute(); } @@ -2337,8 +2343,8 @@ // First check to see if the range contains zero. If not, the first // iteration exits. - ConstantInt *Zero = ConstantInt::get(getType(), 0); - if (!Range.contains(Zero, isSigned)) return SCEVConstant::get(Zero); + if (!Range.contains(APInt(getBitWidth(),0), isSigned)) +return SCEVConstant::get(ConstantInt::get(getType(),0)); if (isAffine()) { // If this is an affine expression then we have this situation: @@ -2347,29 +2353,27 @@ // Since we know that zero is in the range, we know that the upper value of // the range must be the first possible exit value. Also note that we // already checked for a full range. -ConstantInt *Upper = cast(Range.getUpper()); -ConstantInt *A = cast(getOperand(1))->getValue(); -ConstantInt *One = ConstantInt::get(getType(), 1); +const APInt &Upper = Range.getUpper(); +APInt A = cast(getOperand(1))->getValue()->getValue(); +APInt One
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.35 -> 1.36 ScalarEvolution.cpp updated: 1.93 -> 1.94 --- Log message: For PR1205: http://llvm.org/PR1205 : First round of ConstantRange changes. This makes all CR constructors use only APInt and not use ConstantInt. Clients are adjusted accordingly. --- Diffs of the changes: (+23 -49) ConstantRange.cpp | 61 +++- ScalarEvolution.cpp | 11 - 2 files changed, 23 insertions(+), 49 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.35 llvm/lib/Analysis/ConstantRange.cpp:1.36 --- llvm/lib/Analysis/ConstantRange.cpp:1.35Wed Feb 28 11:36:23 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Wed Feb 28 12:57:32 2007 @@ -45,28 +45,7 @@ /// Initialize a range to hold the single specified value. /// -ConstantRange::ConstantRange(Constant *V) - : Lower(cast(V)->getValue()), -Upper(cast(V)->getValue() + 1) { } - -/// Initialize a range of values explicitly... this will assert out if -/// Lower==Upper and Lower != Min or Max for its type (or if the two constants -/// have different types) -/// -ConstantRange::ConstantRange(Constant *L, Constant *U) - : Lower(cast(L)->getValue()), -Upper(cast(U)->getValue()) { - assert(L->getType() == U->getType() && "Invalid ConstantRange types!"); - assert(L->getType()->isInteger() && "Invalid ConstantRange types!"); - - // Make sure that if L & U are equal that they are either Min or Max... - - uint32_t BitWidth = cast(L->getType())->getBitWidth(); - const IntegerType *Ty = cast(L->getType()); - assert((L != U || (L == ConstantInt::get(Ty, APInt::getMaxValue(BitWidth)) - || L == ConstantInt::get(Ty, APInt::getMinValue(BitWidth - && "Lower == Upper, but they aren't min or max for type!"); -} +ConstantRange::ConstantRange(const APInt & V) : Lower(V), Upper(V + 1) { } ConstantRange::ConstantRange(const APInt &L, const APInt &U) : Lower(L), Upper(U) { @@ -80,45 +59,43 @@ /// Initialize a set of values that all satisfy the condition with C. /// -ConstantRange::ConstantRange(unsigned short ICmpOpcode, ConstantInt *C) - : Lower(cast(C->getType())->getBitWidth(), 0), -Upper(cast(C->getType())->getBitWidth(), 0) { - const APInt& Val = C->getValue(); - uint32_t BitWidth = cast(C->getType())->getBitWidth(); +ConstantRange::ConstantRange(unsigned short ICmpOpcode, const APInt &C) + : Lower(C.getBitWidth(), 0), Upper(C.getBitWidth(), 0) { + uint32_t BitWidth = C.getBitWidth(); switch (ICmpOpcode) { default: assert(0 && "Invalid ICmp opcode to ConstantRange ctor!"); - case ICmpInst::ICMP_EQ: Lower = Val; Upper = Val + 1; return; - case ICmpInst::ICMP_NE: Upper = Val; Lower = Val + 1; return; + case ICmpInst::ICMP_EQ: Lower = C; Upper = C + 1; return; + case ICmpInst::ICMP_NE: Upper = C; Lower = C + 1; return; case ICmpInst::ICMP_ULT: Lower = APInt::getMinValue(BitWidth); -Upper = Val; +Upper = C; return; case ICmpInst::ICMP_SLT: Lower = APInt::getSignedMinValue(BitWidth); -Upper = Val; +Upper = C; return; case ICmpInst::ICMP_UGT: -Lower = Val + 1; +Lower = C + 1; Upper = APInt::getMinValue(BitWidth);// Min = Next(Max) return; case ICmpInst::ICMP_SGT: -Lower = Val + 1; +Lower = C + 1; Upper = APInt::getSignedMinValue(BitWidth); // Min = Next(Max) return; case ICmpInst::ICMP_ULE: Lower = APInt::getMinValue(BitWidth); -Upper = Val + 1; +Upper = C + 1; return; case ICmpInst::ICMP_SLE: Lower = APInt::getSignedMinValue(BitWidth); -Upper = Val + 1; +Upper = C + 1; return; case ICmpInst::ICMP_UGE: -Lower = Val; +Lower = C; Upper = APInt::getMinValue(BitWidth);// Min = Next(Max) return; case ICmpInst::ICMP_SGE: -Lower = Val; +Lower = C; Upper = APInt::getSignedMinValue(BitWidth); // Min = Next(Max) return; } @@ -243,14 +220,14 @@ } else { // No overlap on the right, just on the left. - return ConstantRange(RHS.getLower(), LHS.getUpper()); + return ConstantRange(RHS.Lower, LHS.Upper); } } else { // We don't overlap on the left side of RHS, see if we overlap on the right // of RHS... if (GT) { // Simple overlap... - return ConstantRange(LHS.getLower(), RHS.getUpper()); + return ConstantRange(LHS.Lower, RHS.Upper); } else { // No overlap... return ConstantRange(LHS.getType(), false); @@ -319,11 +296,9 @@ unsigned SrcTySize = Lower.getBitWidth(); unsigned DstTySize = Ty->getPrimitiveSizeInBits(); assert(SrcTySize < DstTySize && "Not a value extension"); - if (isFullSet()) { + if (isFullSet()) // Change a source full set into [0, 1 << 8*numbytes) -return ConstantRange(Constant::getNullValue(Ty), - ConstantInt::get(Ty, 1ULL << S
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.34 -> 1.35 --- Log message: For PR1205: http://llvm.org/PR1205 : Convert ConstantRange class to use APInt internally as its value type for the constant range, instead of ConstantInt. --- Diffs of the changes: (+127 -138) ConstantRange.cpp | 265 +- 1 files changed, 127 insertions(+), 138 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.34 llvm/lib/Analysis/ConstantRange.cpp:1.35 --- llvm/lib/Analysis/ConstantRange.cpp:1.34Sat Feb 10 18:58:49 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Wed Feb 28 11:36:23 2007 @@ -31,228 +31,212 @@ #include using namespace llvm; -static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) { - if (Ty->isInteger()) { -if (isSigned) { - // Calculate 011... - unsigned TypeBits = Ty->getPrimitiveSizeInBits(); - int64_t Val = INT64_MAX; // All ones - Val >>= 64-TypeBits; // Shift out unwanted 1 bits... - return ConstantInt::get(Ty, Val); -} -return ConstantInt::getAllOnesValue(Ty); - } - return 0; -} - -// Static constructor to create the minimum constant for an integral type... -static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) { - if (Ty->isInteger()) { -if (isSigned) { - // Calculate 11 - unsigned TypeBits = Ty->getPrimitiveSizeInBits(); - int64_t Val = -1;// All ones - Val <<= TypeBits-1; // Shift over to the right spot - return ConstantInt::get(Ty, Val); -} -return ConstantInt::get(Ty, 0); - } - return 0; -} -static ConstantInt *Next(ConstantInt *CI) { - Constant *Result = ConstantExpr::getAdd(CI, - ConstantInt::get(CI->getType(), 1)); - return cast(Result); -} - -static bool LT(ConstantInt *A, ConstantInt *B, bool isSigned) { - Constant *C = ConstantExpr::getICmp( -(isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT), A, B); - assert(isa(C) && "Constant folding of integrals not impl??"); - return cast(C)->getZExtValue(); -} - -static bool LTE(ConstantInt *A, ConstantInt *B, bool isSigned) { - Constant *C = ConstantExpr::getICmp( -(isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE), A, B); - assert(isa(C) && "Constant folding of integrals not impl??"); - return cast(C)->getZExtValue(); -} - -static bool GT(ConstantInt *A, ConstantInt *B, bool isSigned) { - return LT(B, A, isSigned); } - -static ConstantInt *Min(ConstantInt *A, ConstantInt *B, - bool isSigned) { - return LT(A, B, isSigned) ? A : B; -} -static ConstantInt *Max(ConstantInt *A, ConstantInt *B, - bool isSigned) { - return GT(A, B, isSigned) ? A : B; -} - /// Initialize a full (the default) or empty set for the specified type. /// -ConstantRange::ConstantRange(const Type *Ty, bool Full) { - assert(Ty->isInteger() && - "Cannot make constant range of non-integral type!"); +ConstantRange::ConstantRange(const Type *Ty, bool Full) : + Lower(cast(Ty)->getBitWidth(), 0), + Upper(cast(Ty)->getBitWidth(), 0) { + uint32_t BitWidth = cast(Ty)->getBitWidth(); if (Full) -Lower = Upper = getMaxValue(Ty); +Lower = Upper = APInt::getMaxValue(BitWidth); else -Lower = Upper = getMinValue(Ty); +Lower = Upper = APInt::getMinValue(BitWidth); } /// Initialize a range to hold the single specified value. /// ConstantRange::ConstantRange(Constant *V) - : Lower(cast(V)), Upper(Next(cast(V))) { } + : Lower(cast(V)->getValue()), +Upper(cast(V)->getValue() + 1) { } /// Initialize a range of values explicitly... this will assert out if /// Lower==Upper and Lower != Min or Max for its type (or if the two constants /// have different types) /// ConstantRange::ConstantRange(Constant *L, Constant *U) - : Lower(cast(L)), Upper(cast(U)) { - assert(Lower->getType() == Upper->getType() && - "Incompatible types for ConstantRange!"); + : Lower(cast(L)->getValue()), +Upper(cast(U)->getValue()) { + assert(L->getType() == U->getType() && "Invalid ConstantRange types!"); + assert(L->getType()->isInteger() && "Invalid ConstantRange types!"); // Make sure that if L & U are equal that they are either Min or Max... - assert((L != U || (L == getMaxValue(L->getType()) || - L == getMinValue(L->getType( + + uint32_t BitWidth = cast(L->getType())->getBitWidth(); + const IntegerType *Ty = cast(L->getType()); + assert((L != U || (L == ConstantInt::get(Ty, APInt::getMaxValue(BitWidth)) + || L == ConstantInt::get(Ty, APInt::getMinValue(BitWidth && "Lower == Upper, but they aren't min or max for type!"); } +ConstantRange::ConstantRange(const APInt &L, const APInt &U) : + Lower(L), Upper(U) { + assert(L.getBitW
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.33 -> 1.34 --- Log message: Fix comments to match names of functions. --- Diffs of the changes: (+2 -2) ConstantRange.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.33 llvm/lib/Analysis/ConstantRange.cpp:1.34 --- llvm/lib/Analysis/ConstantRange.cpp:1.33Fri Jan 19 15:13:56 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Sat Feb 10 18:58:49 2007 @@ -274,7 +274,7 @@ } } -/// intersect - Return the range that results from the intersection of this +/// intersectWith - Return the range that results from the intersection of this /// range with another range. /// ConstantRange ConstantRange::intersectWith(const ConstantRange &CR, @@ -308,7 +308,7 @@ return *this; } -/// union - Return the range that results from the union of this range with +/// unionWith - Return the range that results from the union of this range with /// another range. The resultant range is guaranteed to include the elements of /// both sets, but may contain more. For example, [3, 9) union [12,15) is [3, /// 15), which includes 9, 10, and 11, which were not included in either set ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.32 -> 1.33 ScalarEvolution.cpp updated: 1.89 -> 1.90 --- Log message: For PR1043: http://llvm.org/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: http://llvm.org/PR1120 . Patch by Sheng Zhou. --- Diffs of the changes: (+2 -1) ConstantRange.cpp |1 + ScalarEvolution.cpp |2 +- 2 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.32 llvm/lib/Analysis/ConstantRange.cpp:1.33 --- llvm/lib/Analysis/ConstantRange.cpp:1.32Sun Jan 14 20:27:26 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Fri Jan 19 15:13:56 2007 @@ -26,6 +26,7 @@ #include "llvm/Instruction.h" #include "llvm/Instructions.h" #include "llvm/Type.h" +#include "llvm/DerivedTypes.h" #include "llvm/Support/Streams.h" #include using namespace llvm; Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.89 llvm/lib/Analysis/ScalarEvolution.cpp:1.90 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.89 Mon Jan 15 14:27:18 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Fri Jan 19 15:13:56 2007 @@ -1333,7 +1333,7 @@ if (SCEVTruncateExpr *T = dyn_cast(S)) return GetConstantFactor(T->getOperand()) & - T->getType()->getIntegerTypeMask(); + cast(T->getType())->getBitMask(); if (SCEVZeroExtendExpr *E = dyn_cast(S)) return GetConstantFactor(E->getOperand()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.31 -> 1.32 ScalarEvolution.cpp updated: 1.87 -> 1.88 ScalarEvolutionExpander.cpp updated: 1.11 -> 1.12 --- Log message: 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! :) --- Diffs of the changes: (+16 -16) ConstantRange.cpp |8 ScalarEvolution.cpp | 22 +++--- ScalarEvolutionExpander.cpp |2 +- 3 files changed, 16 insertions(+), 16 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.31 llvm/lib/Analysis/ConstantRange.cpp:1.32 --- llvm/lib/Analysis/ConstantRange.cpp:1.31Sun Jan 14 19:58:56 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Sun Jan 14 20:27:26 2007 @@ -31,7 +31,7 @@ using namespace llvm; static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) { - if (Ty->isIntegral()) { + if (Ty->isInteger()) { if (isSigned) { // Calculate 011... unsigned TypeBits = Ty->getPrimitiveSizeInBits(); @@ -46,7 +46,7 @@ // Static constructor to create the minimum constant for an integral type... static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) { - if (Ty->isIntegral()) { + if (Ty->isInteger()) { if (isSigned) { // Calculate 11 unsigned TypeBits = Ty->getPrimitiveSizeInBits(); @@ -93,7 +93,7 @@ /// Initialize a full (the default) or empty set for the specified type. /// ConstantRange::ConstantRange(const Type *Ty, bool Full) { - assert(Ty->isIntegral() && + assert(Ty->isInteger() && "Cannot make constant range of non-integral type!"); if (Full) Lower = Upper = getMaxValue(Ty); @@ -225,7 +225,7 @@ /// subtract - Subtract the specified constant from the endpoints of this /// constant range. ConstantRange ConstantRange::subtract(ConstantInt *CI) const { - assert(CI->getType() == getType() && getType()->isIntegral() && + assert(CI->getType() == getType() && getType()->isInteger() && "Cannot subtract from different type range or non-integer!"); // If the set is empty or full, don't modify the endpoints. if (Lower == Upper) return *this; Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.87 llvm/lib/Analysis/ScalarEvolution.cpp:1.88 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.87 Sun Jan 14 19:58:56 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sun Jan 14 20:27:26 2007 @@ -122,7 +122,7 @@ /// known to have. This method is only valid on integer SCEV objects. ConstantRange SCEV::getValueRange() const { const Type *Ty = getType(); - assert(Ty->isIntegral() && "Can't get range for a non-integer SCEV!"); + assert(Ty->isInteger() && "Can't get range for a non-integer SCEV!"); // Default to a full range if no better information is available. return ConstantRange(getType()); } @@ -194,7 +194,7 @@ SCEVTruncateExpr::SCEVTruncateExpr(const SCEVHandle &op, const Type *ty) : SCEV(scTruncate), Op(op), Ty(ty) { - assert(Op->getType()->isIntegral() && Ty->isIntegral() && + assert(Op->getType()->isInteger() && Ty->isInteger() && "Cannot truncate non-integer value!"); assert(Op->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits() && "This is not a truncating conversion!"); @@ -220,7 +220,7 @@ SCEVZeroExtendExpr::SCEVZeroExtendExpr(const SCEVHandle &op, const Type *ty) : SCEV(scZeroExtend), Op(op), Ty(ty) { - assert(Op->getType()->isIntegral() && Ty->isIntegral() && + assert(Op->getType()->isInteger() && Ty->isInteger() && "Cannot zero extend non-integer value!"); assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits() && "This is not an extending conversion!"); @@ -459,7 +459,7 @@ /// extended. static SCEVHandle getTruncateOrZeroExtend(const SCEVHandle &V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert(SrcTy->isIntegral() && Ty->isIntegral() && + assert(SrcTy->isInteger() && Ty->isInteger() && "Cannot truncate or zero extend with non-integer arguments!"); if (SrcTy->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits()) return V; // No conversion @@ -1333,7 +1333,7 @@ if (SCEVTruncateExpr *T = dyn_cast(S)) return GetConstantFactor(T->getOperand()) & - T->getType()->getIntegralTypeMask(); + T->getType()->getIntegerTypeMask(); if (SCEVZeroExtendExpr *E = dyn_cast(S)) return GetConstantFactor(E->getOperand()); @@ -1421,8 +1421,8 @@ case Instruction::BitCast: // BitCasts are no-op casts so we just eliminate the cast. - if (I->getType()->isIntegral() && - I->getOperand(0)->getType()->isIntegral(
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.30 -> 1.31 ScalarEvolution.cpp updated: 1.86 -> 1.87 --- Log message: Update code to eliminate calls to isInteger, calling isIntegral instead. --- Diffs of the changes: (+12 -17) ConstantRange.cpp |2 +- ScalarEvolution.cpp | 27 +++ 2 files changed, 12 insertions(+), 17 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.30 llvm/lib/Analysis/ConstantRange.cpp:1.31 --- llvm/lib/Analysis/ConstantRange.cpp:1.30Sun Jan 14 19:02:34 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Sun Jan 14 19:58:56 2007 @@ -225,7 +225,7 @@ /// subtract - Subtract the specified constant from the endpoints of this /// constant range. ConstantRange ConstantRange::subtract(ConstantInt *CI) const { - assert(CI->getType() == getType() && getType()->isInteger() && + assert(CI->getType() == getType() && getType()->isIntegral() && "Cannot subtract from different type range or non-integer!"); // If the set is empty or full, don't modify the endpoints. if (Lower == Upper) return *this; Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.86 llvm/lib/Analysis/ScalarEvolution.cpp:1.87 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.86 Sat Jan 13 19:24:47 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sun Jan 14 19:58:56 2007 @@ -122,7 +122,7 @@ /// known to have. This method is only valid on integer SCEV objects. ConstantRange SCEV::getValueRange() const { const Type *Ty = getType(); - assert(Ty->isInteger() && "Can't get range for a non-integer SCEV!"); + assert(Ty->isIntegral() && "Can't get range for a non-integer SCEV!"); // Default to a full range if no better information is available. return ConstantRange(getType()); } @@ -194,7 +194,7 @@ SCEVTruncateExpr::SCEVTruncateExpr(const SCEVHandle &op, const Type *ty) : SCEV(scTruncate), Op(op), Ty(ty) { - assert(Op->getType()->isInteger() && Ty->isInteger() && + assert(Op->getType()->isIntegral() && Ty->isIntegral() && "Cannot truncate non-integer value!"); assert(Op->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits() && "This is not a truncating conversion!"); @@ -220,7 +220,7 @@ SCEVZeroExtendExpr::SCEVZeroExtendExpr(const SCEVHandle &op, const Type *ty) : SCEV(scZeroExtend), Op(op), Ty(ty) { - assert(Op->getType()->isInteger() && Ty->isInteger() && + assert(Op->getType()->isIntegral() && Ty->isIntegral() && "Cannot zero extend non-integer value!"); assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits() && "This is not an extending conversion!"); @@ -459,7 +459,7 @@ /// extended. static SCEVHandle getTruncateOrZeroExtend(const SCEVHandle &V, const Type *Ty) { const Type *SrcTy = V->getType(); - assert(SrcTy->isInteger() && Ty->isInteger() && + assert(SrcTy->isIntegral() && Ty->isIntegral() && "Cannot truncate or zero extend with non-integer arguments!"); if (SrcTy->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits()) return V; // No conversion @@ -1414,20 +1414,15 @@ break; case Instruction::Trunc: - // We don't handle trunc to bool yet. - if (I->getType()->isInteger()) -return SCEVTruncateExpr::get(getSCEV(I->getOperand(0)), I->getType()); - break; + return SCEVTruncateExpr::get(getSCEV(I->getOperand(0)), I->getType()); case Instruction::ZExt: - // We don't handle zext from bool yet. - if (I->getOperand(0)->getType()->isInteger()) -return SCEVZeroExtendExpr::get(getSCEV(I->getOperand(0)), I->getType()); - break; + return SCEVZeroExtendExpr::get(getSCEV(I->getOperand(0)), I->getType()); case Instruction::BitCast: // BitCasts are no-op casts so we just eliminate the cast. - if (I->getType()->isInteger() && I->getOperand(0)->getType()->isInteger()) + if (I->getType()->isIntegral() && + I->getOperand(0)->getType()->isIntegral()) return getSCEV(I->getOperand(0)); break; @@ -2191,7 +2186,7 @@ } } } - } else if (AddRec->isQuadratic() && AddRec->getType()->isInteger()) { + } else if (AddRec->isQuadratic() && AddRec->getType()->isIntegral()) { // If this is a quadratic (3-term) AddRec {L,+,M,+,N}, find the roots of // the quadratic equation to solve it. std::pair Roots = SolveQuadraticEquation(AddRec); @@ -2319,7 +2314,7 @@ } if (Cond == ICmpInst::ICMP_SLT) { -if (PreCondLHS->getType()->isInteger()) { +if (PreCondLHS->getType()->isIntegral()) { if (RHS != getSCEV(PreCondRHS)) return UnknownValue; // Not a comparison against 'm'. @@ -2572,7 +2567,7 @@ OS << "Classifying expressions for: " << F.getName() << "\n"; for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) -if (I->getT
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.29 -> 1.30 --- Log message: Fix correlated exprs regressions --- Diffs of the changes: (+2 -2) ConstantRange.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.29 llvm/lib/Analysis/ConstantRange.cpp:1.30 --- llvm/lib/Analysis/ConstantRange.cpp:1.29Fri Jan 12 12:23:49 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Sun Jan 14 19:02:34 2007 @@ -31,7 +31,7 @@ using namespace llvm; static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) { - if (Ty->isInteger()) { + if (Ty->isIntegral()) { if (isSigned) { // Calculate 011... unsigned TypeBits = Ty->getPrimitiveSizeInBits(); @@ -46,7 +46,7 @@ // Static constructor to create the minimum constant for an integral type... static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) { - if (Ty->isInteger()) { + if (Ty->isIntegral()) { if (isSigned) { // Calculate 11 unsigned TypeBits = Ty->getPrimitiveSizeInBits(); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.28 -> 1.29 --- Log message: remove unneeded special cases --- Diffs of the changes: (+0 -7) ConstantRange.cpp |7 --- 1 files changed, 7 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.28 llvm/lib/Analysis/ConstantRange.cpp:1.29 --- llvm/lib/Analysis/ConstantRange.cpp:1.28Thu Jan 11 22:24:45 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Fri Jan 12 12:23:49 2007 @@ -31,8 +31,6 @@ using namespace llvm; static ConstantInt *getMaxValue(const Type *Ty, bool isSigned = false) { - if (Ty == Type::Int1Ty) -return ConstantInt::getTrue(); if (Ty->isInteger()) { if (isSigned) { // Calculate 011... @@ -48,8 +46,6 @@ // Static constructor to create the minimum constant for an integral type... static ConstantInt *getMinValue(const Type *Ty, bool isSigned = false) { - if (Ty == Type::Int1Ty) -return ConstantInt::getFalse(); if (Ty->isInteger()) { if (isSigned) { // Calculate 11 @@ -63,9 +59,6 @@ return 0; } static ConstantInt *Next(ConstantInt *CI) { - if (CI->getType() == Type::Int1Ty) -return ConstantInt::get(Type::Int1Ty, !CI->getZExtValue()); - Constant *Result = ConstantExpr::getAdd(CI, ConstantInt::get(CI->getType(), 1)); return cast(Result); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.24 -> 1.25 --- Log message: Fix a bug in an assert that would never trigger. --- Diffs of the changes: (+1 -1) ConstantRange.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.24 llvm/lib/Analysis/ConstantRange.cpp:1.25 --- llvm/lib/Analysis/ConstantRange.cpp:1.24Sun Jan 7 19:26:33 2007 +++ llvm/lib/Analysis/ConstantRange.cpp Sun Jan 7 23:34:39 2007 @@ -355,7 +355,7 @@ /// truncated to the specified type. ConstantRange ConstantRange::truncate(const Type *Ty) const { unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits(); - assert(SrcTySize > Ty->getPrimitiveSize() && "Not a value truncation"); + assert(SrcTySize > Ty->getPrimitiveSizeInBits() && "Not a value truncation"); uint64_t Size = 1ULL << Ty->getPrimitiveSizeInBits(); if (isFullSet() || getSetSize() >= Size) return ConstantRange(getType()); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp ScalarEvolution.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.23 -> 1.24 ScalarEvolution.cpp updated: 1.80 -> 1.81 --- Log message: Convert uses of getPrimitiveSize that should be getPrimitiveSizeInBits. --- Diffs of the changes: (+14 -15) ConstantRange.cpp | 17 - ScalarEvolution.cpp | 12 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.23 llvm/lib/Analysis/ConstantRange.cpp:1.24 --- llvm/lib/Analysis/ConstantRange.cpp:1.23Sat Dec 23 00:05:40 2006 +++ llvm/lib/Analysis/ConstantRange.cpp Sun Jan 7 19:26:33 2007 @@ -36,7 +36,7 @@ if (Ty->isInteger()) { if (isSigned) { // Calculate 011... - unsigned TypeBits = Ty->getPrimitiveSize()*8; + unsigned TypeBits = Ty->getPrimitiveSizeInBits(); int64_t Val = INT64_MAX; // All ones Val >>= 64-TypeBits; // Shift out unwanted 1 bits... return ConstantInt::get(Ty, Val); @@ -53,7 +53,7 @@ if (Ty->isInteger()) { if (isSigned) { // Calculate 11 - unsigned TypeBits = Ty->getPrimitiveSize()*8; + unsigned TypeBits = Ty->getPrimitiveSizeInBits(); int64_t Val = -1;// All ones Val <<= TypeBits-1; // Shift over to the right spot return ConstantInt::get(Ty, Val); @@ -334,13 +334,12 @@ /// correspond to the possible range of values as if the source range had been /// zero extended. ConstantRange ConstantRange::zeroExtend(const Type *Ty) const { - assert(getLower()->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() && - "Not a value extension"); + unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits(); + assert(SrcTySize < Ty->getPrimitiveSizeInBits() && "Not a value extension"); if (isFullSet()) { // Change a source full set into [0, 1 << 8*numbytes) -unsigned SrcTySize = getLower()->getType()->getPrimitiveSize(); return ConstantRange(Constant::getNullValue(Ty), - ConstantInt::get(Ty, 1ULL << SrcTySize*8)); + ConstantInt::get(Ty, 1ULL << SrcTySize)); } Constant *Lower = getLower(); @@ -355,9 +354,9 @@ /// correspond to the possible range of values as if the source range had been /// truncated to the specified type. ConstantRange ConstantRange::truncate(const Type *Ty) const { - assert(getLower()->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() && - "Not a value truncation"); - uint64_t Size = 1ULL << Ty->getPrimitiveSize()*8; + unsigned SrcTySize = getLower()->getType()->getPrimitiveSizeInBits(); + assert(SrcTySize > Ty->getPrimitiveSize() && "Not a value truncation"); + uint64_t Size = 1ULL << Ty->getPrimitiveSizeInBits(); if (isFullSet() || getSetSize() >= Size) return ConstantRange(getType()); Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.80 llvm/lib/Analysis/ScalarEvolution.cpp:1.81 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.80 Sat Jan 6 20:24:26 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Sun Jan 7 19:26:33 2007 @@ -196,8 +196,8 @@ : SCEV(scTruncate), Op(op), Ty(ty) { assert(Op->getType()->isInteger() && Ty->isInteger() && "Cannot truncate non-integer value!"); - assert(Op->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() && - "This is not a truncating conversion!"); + assert(Op->getType()->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits() + && "This is not a truncating conversion!"); } SCEVTruncateExpr::~SCEVTruncateExpr() { @@ -222,8 +222,8 @@ : SCEV(scZeroExtend), Op(op), Ty(ty) { assert(Op->getType()->isInteger() && Ty->isInteger() && "Cannot zero extend non-integer value!"); - assert(Op->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() && - "This is not an extending conversion!"); + assert(Op->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits() + && "This is not an extending conversion!"); } SCEVZeroExtendExpr::~SCEVZeroExtendExpr() { @@ -461,9 +461,9 @@ const Type *SrcTy = V->getType(); assert(SrcTy->isInteger() && Ty->isInteger() && "Cannot truncate or zero extend with non-integer arguments!"); - if (SrcTy->getPrimitiveSize() == Ty->getPrimitiveSize()) + if (SrcTy->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits()) return V; // No conversion - if (SrcTy->getPrimitiveSize() > Ty->getPrimitiveSize()) + if (SrcTy->getPrimitiveSizeInBits() > Ty->getPrimitiveSizeInBits()) return SCEVTruncateExpr::get(V, Ty); return SCEVZeroExtendExpr::get(V, Ty); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.19 -> 1.20 --- Log message: Adjust to new ConstantIntegral interface for Max/Min tests. --- Diffs of the changes: (+56 -10) ConstantRange.cpp | 66 +- 1 files changed, 56 insertions(+), 10 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.19 llvm/lib/Analysis/ConstantRange.cpp:1.20 --- llvm/lib/Analysis/ConstantRange.cpp:1.19Sun Dec 3 20:46:44 2006 +++ llvm/lib/Analysis/ConstantRange.cpp Wed Dec 6 14:45:15 2006 @@ -29,6 +29,52 @@ #include using namespace llvm; +static ConstantIntegral *getMaxValue(const Type *Ty) { + switch (Ty->getTypeID()) { + case Type::BoolTyID: return ConstantBool::getTrue(); + case Type::SByteTyID: + case Type::ShortTyID: + case Type::IntTyID: + case Type::LongTyID: { +// Calculate 011... +unsigned TypeBits = Ty->getPrimitiveSize()*8; +int64_t Val = INT64_MAX; // All ones +Val >>= 64-TypeBits; // Shift out unwanted 1 bits... +return ConstantInt::get(Ty, Val); + } + + case Type::UByteTyID: + case Type::UShortTyID: + case Type::UIntTyID: + case Type::ULongTyID: return ConstantInt::getAllOnesValue(Ty); + + default: return 0; + } +} + +// Static constructor to create the minimum constant for an integral type... +static ConstantIntegral *getMinValue(const Type *Ty) { + switch (Ty->getTypeID()) { + case Type::BoolTyID: return ConstantBool::getFalse(); + case Type::SByteTyID: + case Type::ShortTyID: + case Type::IntTyID: + case Type::LongTyID: { + // Calculate 11 + unsigned TypeBits = Ty->getPrimitiveSize()*8; + int64_t Val = -1;// All ones + Val <<= TypeBits-1; // Shift over to the right spot + return ConstantInt::get(Ty, Val); + } + + case Type::UByteTyID: + case Type::UShortTyID: + case Type::UIntTyID: + case Type::ULongTyID: return ConstantInt::get(Ty, 0); + + default: return 0; + } +} static ConstantIntegral *Next(ConstantIntegral *CI) { if (ConstantBool *CB = dyn_cast(CI)) return ConstantBool::get(!CB->getValue()); @@ -65,9 +111,9 @@ assert(Ty->isIntegral() && "Cannot make constant range of non-integral type!"); if (Full) -Lower = Upper = ConstantIntegral::getMaxValue(Ty); +Lower = Upper = getMaxValue(Ty); else -Lower = Upper = ConstantIntegral::getMinValue(Ty); +Lower = Upper = getMinValue(Ty); } /// Initialize a range to hold the single specified value. @@ -86,8 +132,8 @@ "Incompatible types for ConstantRange!"); // Make sure that if L & U are equal that they are either Min or Max... - assert((L != U || (L == ConstantIntegral::getMaxValue(L->getType()) || - L == ConstantIntegral::getMinValue(L->getType( && + assert((L != U || (L == getMaxValue(L->getType()) || + L == getMinValue(L->getType( && "Lower == Upper, but they aren't min or max for type!"); } @@ -99,20 +145,20 @@ case Instruction::SetEQ: Lower = C; Upper = Next(C); return; case Instruction::SetNE: Upper = C; Lower = Next(C); return; case Instruction::SetLT: -Lower = ConstantIntegral::getMinValue(C->getType()); +Lower = getMinValue(C->getType()); Upper = C; return; case Instruction::SetGT: Lower = Next(C); -Upper = ConstantIntegral::getMinValue(C->getType()); // Min = Next(Max) +Upper = getMinValue(C->getType()); // Min = Next(Max) return; case Instruction::SetLE: -Lower = ConstantIntegral::getMinValue(C->getType()); +Lower = getMinValue(C->getType()); Upper = Next(C); return; case Instruction::SetGE: Lower = C; -Upper = ConstantIntegral::getMinValue(C->getType()); // Min = Next(Max) +Upper = getMinValue(C->getType()); // Min = Next(Max) return; } } @@ -124,13 +170,13 @@ /// isFullSet - Return true if this set contains all of the elements possible /// for this data-type bool ConstantRange::isFullSet() const { - return Lower == Upper && Lower == ConstantIntegral::getMaxValue(getType()); + return Lower == Upper && Lower == getMaxValue(getType()); } /// isEmptySet - Return true if this set contains no members. /// bool ConstantRange::isEmptySet() const { - return Lower == Upper && Lower == ConstantIntegral::getMinValue(getType()); + return Lower == Upper && Lower == getMinValue(getType()); } /// isWrappedSet - Return true if this set wraps around the top of the range, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.18 -> 1.19 --- Log message: Change inferred casts to explicit casts. --- Diffs of the changes: (+5 -9) ConstantRange.cpp | 14 +- 1 files changed, 5 insertions(+), 9 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.18 llvm/lib/Analysis/ConstantRange.cpp:1.19 --- llvm/lib/Analysis/ConstantRange.cpp:1.18Tue Nov 28 19:14:00 2006 +++ llvm/lib/Analysis/ConstantRange.cpp Sun Dec 3 20:46:44 2006 @@ -293,14 +293,9 @@ Constant *Lower = getLower(); Constant *Upper = getUpper(); - if (Lower->getType()->isInteger() && !Lower->getType()->isUnsigned()) { -// Ensure we are doing a ZERO extension even if the input range is signed. -Lower = ConstantExpr::getCast(Lower, Ty->getUnsignedVersion()); -Upper = ConstantExpr::getCast(Upper, Ty->getUnsignedVersion()); - } - return ConstantRange(ConstantExpr::getCast(Lower, Ty), - ConstantExpr::getCast(Upper, Ty)); + return ConstantRange(ConstantExpr::getCast(Instruction::ZExt, Lower, Ty), + ConstantExpr::getCast(Instruction::ZExt, Upper, Ty)); } /// truncate - Return a new range in the specified integer type, which must be @@ -314,8 +309,9 @@ if (isFullSet() || getSetSize() >= Size) return ConstantRange(getType()); - return ConstantRange(ConstantExpr::getCast(getLower(), Ty), - ConstantExpr::getCast(getUpper(), Ty)); + return ConstantRange( + ConstantExpr::getCast(Instruction::Trunc, getLower(), Ty), + ConstantExpr::getCast(Instruction::Trunc, getUpper(), Ty)); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.17 -> 1.18 --- Log message: WTF? These weird newlines got in there... --- Diffs of the changes: (+0 -26) ConstantRange.cpp | 26 -- 1 files changed, 26 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.17 llvm/lib/Analysis/ConstantRange.cpp:1.18 --- llvm/lib/Analysis/ConstantRange.cpp:1.17Tue Nov 28 16:46:12 2006 +++ llvm/lib/Analysis/ConstantRange.cpp Tue Nov 28 19:14:00 2006 @@ -50,32 +50,6 @@ return cast(C)->getValue(); } - - - - - - - - - - - - - - - - - - - - - - - - - - static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); } static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B) { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp
Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.14 -> 1.15 --- Log message: Simplify some code --- Diffs of the changes: (+2 -2) ConstantRange.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.14 llvm/lib/Analysis/ConstantRange.cpp:1.15 --- llvm/lib/Analysis/ConstantRange.cpp:1.14Thu Apr 21 18:46:51 2005 +++ llvm/lib/Analysis/ConstantRange.cpp Thu Sep 28 18:14:29 2006 @@ -30,8 +30,8 @@ using namespace llvm; static ConstantIntegral *Next(ConstantIntegral *CI) { - if (CI->getType() == Type::BoolTy) -return CI == ConstantBool::True ? ConstantBool::False : ConstantBool::True; + if (ConstantBool *CB = dyn_cast(CI)) +return ConstantBool::get(!CB->getValue()); Constant *Result = ConstantExpr::getAdd(CI, ConstantInt::get(CI->getType(), 1)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits