[llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ConstantFolding.cpp ConstantRange.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp
Reid Spencer
reid at x10sys.com
Fri Oct 20 00:08:32 PDT 2006
Changes in directory llvm/lib/Analysis:
BasicAliasAnalysis.cpp updated: 1.86 -> 1.87
ConstantFolding.cpp updated: 1.4 -> 1.5
ConstantRange.cpp updated: 1.15 -> 1.16
ScalarEvolution.cpp updated: 1.53 -> 1.54
ScalarEvolutionExpander.cpp updated: 1.3 -> 1.4
---
Log message:
For PR950: http://llvm.org/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.
---
Diffs of the changes: (+30 -30)
BasicAliasAnalysis.cpp | 15 +++++++--------
ConstantFolding.cpp | 11 ++++++-----
ConstantRange.cpp | 4 ++--
ScalarEvolution.cpp | 28 ++++++++++++++--------------
ScalarEvolutionExpander.cpp | 2 +-
5 files changed, 30 insertions(+), 30 deletions(-)
Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.87
--- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.86 Wed Oct 4 16:52:35 2006
+++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Fri Oct 20 02:07:24 2006
@@ -468,11 +468,10 @@
/// CheckGEPInstructions - Check two GEP instructions with known must-aliasing
/// base pointers. This checks to see if the index expressions preclude the
/// pointers from aliasing...
-AliasAnalysis::AliasResult BasicAliasAnalysis::
-CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops,
- unsigned G1S,
- const Type *BasePtr2Ty, std::vector<Value*> &GEP2Ops,
- unsigned G2S) {
+AliasAnalysis::AliasResult
+BasicAliasAnalysis::CheckGEPInstructions(
+ const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, unsigned G1S,
+ const Type *BasePtr2Ty, std::vector<Value*> &GEP2Ops, unsigned G2S) {
// We currently can't handle the case when the base pointers have different
// primitive types. Since this is uncommon anyway, we are happy being
// extremely conservative.
@@ -670,7 +669,7 @@
if (const ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
// If this is an array index, make sure the array element is in range.
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
- if (Op1C->getRawValue() >= AT->getNumElements())
+ if (Op1C->getZExtValue() >= AT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses
} else {
@@ -685,7 +684,7 @@
// value possible.
//
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
- GEP1Ops[i] = ConstantSInt::get(Type::LongTy,AT->getNumElements()-1);
+ GEP1Ops[i] = ConstantInt::get(Type::LongTy, AT->getNumElements()-1);
}
}
@@ -693,7 +692,7 @@
if (const ConstantInt *Op2C = dyn_cast<ConstantInt>(Op2)) {
// If this is an array index, make sure the array element is in range.
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
- if (Op2C->getRawValue() >= AT->getNumElements())
+ if (Op2C->getZExtValue() >= AT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses
} else { // Conservatively assume the minimum value for this index
GEP2Ops[i] = Constant::getNullValue(Op2->getType());
Index: llvm/lib/Analysis/ConstantFolding.cpp
diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.4 llvm/lib/Analysis/ConstantFolding.cpp:1.5
--- llvm/lib/Analysis/ConstantFolding.cpp:1.4 Sat Jun 17 13:17:52 2006
+++ llvm/lib/Analysis/ConstantFolding.cpp Fri Oct 20 02:07:24 2006
@@ -163,14 +163,15 @@
default:
break;
}
- } else if (ConstantUInt *Op = dyn_cast<ConstantUInt>(Operands[0])) {
- uint64_t V = Op->getValue();
+ } else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) {
+ assert(Op->getType()->isUnsigned() && "bswap args must be unsigned");
+ uint64_t V = Op->getZExtValue();
if (Name == "llvm.bswap.i16")
- return ConstantUInt::get(Ty, ByteSwap_16(V));
+ return ConstantInt::get(Ty, ByteSwap_16(V));
else if (Name == "llvm.bswap.i32")
- return ConstantUInt::get(Ty, ByteSwap_32(V));
+ return ConstantInt::get(Ty, ByteSwap_32(V));
else if (Name == "llvm.bswap.i64")
- return ConstantUInt::get(Ty, ByteSwap_64(V));
+ return ConstantInt::get(Ty, ByteSwap_64(V));
}
} else if (Operands.size() == 2) {
if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) {
Index: llvm/lib/Analysis/ConstantRange.cpp
diff -u llvm/lib/Analysis/ConstantRange.cpp:1.15 llvm/lib/Analysis/ConstantRange.cpp:1.16
--- llvm/lib/Analysis/ConstantRange.cpp:1.15 Thu Sep 28 18:14:29 2006
+++ llvm/lib/Analysis/ConstantRange.cpp Fri Oct 20 02:07:24 2006
@@ -161,7 +161,7 @@
// Simply subtract the bounds...
Constant *Result = ConstantExpr::getSub(Upper, Lower);
- return cast<ConstantInt>(Result)->getRawValue();
+ return cast<ConstantInt>(Result)->getZExtValue();
}
/// contains - Return true if the specified value is in the set.
@@ -288,7 +288,7 @@
// Change a source full set into [0, 1 << 8*numbytes)
unsigned SrcTySize = getLower()->getType()->getPrimitiveSize();
return ConstantRange(Constant::getNullValue(Ty),
- ConstantUInt::get(Ty, 1ULL << SrcTySize*8));
+ ConstantInt::get(Ty, 1ULL << SrcTySize*8));
}
Constant *Lower = getLower();
Index: llvm/lib/Analysis/ScalarEvolution.cpp
diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.53 llvm/lib/Analysis/ScalarEvolution.cpp:1.54
--- llvm/lib/Analysis/ScalarEvolution.cpp:1.53 Wed Oct 4 16:49:37 2006
+++ llvm/lib/Analysis/ScalarEvolution.cpp Fri Oct 20 02:07:24 2006
@@ -177,7 +177,7 @@
// Make sure that SCEVConstant instances are all unsigned.
if (V->getType()->isSigned()) {
const Type *NewTy = V->getType()->getUnsignedVersion();
- V = cast<ConstantUInt>(ConstantExpr::getCast(V, NewTy));
+ V = cast<ConstantInt>(ConstantExpr::getCast(V, NewTy));
}
SCEVConstant *&R = (*SCEVConstants)[V];
@@ -463,9 +463,9 @@
else if (Ty->isFloatingPoint())
C = ConstantFP::get(Ty, Val);
else if (Ty->isSigned())
- C = ConstantSInt::get(Ty, Val);
+ C = ConstantInt::get(Ty, Val);
else {
- C = ConstantSInt::get(Ty->getSignedVersion(), Val);
+ C = ConstantInt::get(Ty->getSignedVersion(), Val);
C = ConstantExpr::getCast(C, Ty);
}
return SCEVUnknown::get(C);
@@ -507,11 +507,11 @@
// Handle this case efficiently, it is common to have constant iteration
// counts while computing loop exit values.
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) {
- uint64_t Val = SC->getValue()->getRawValue();
+ uint64_t Val = SC->getValue()->getZExtValue();
uint64_t Result = 1;
for (; NumSteps; --NumSteps)
Result *= Val-(NumSteps-1);
- Constant *Res = ConstantUInt::get(Type::ULongTy, Result);
+ Constant *Res = ConstantInt::get(Type::ULongTy, Result);
return SCEVUnknown::get(ConstantExpr::getCast(Res, V->getType()));
}
@@ -1605,7 +1605,7 @@
const std::vector<ConstantInt*> &Indices) {
Constant *Init = GV->getInitializer();
for (unsigned i = 0, e = Indices.size(); i != e; ++i) {
- uint64_t Idx = Indices[i]->getRawValue();
+ uint64_t Idx = Indices[i]->getZExtValue();
if (ConstantStruct *CS = dyn_cast<ConstantStruct>(Init)) {
assert(Idx < CS->getNumOperands() && "Bad struct index!");
Init = cast<Constant>(CS->getOperand(Idx));
@@ -1679,8 +1679,8 @@
unsigned MaxSteps = MaxBruteForceIterations;
for (unsigned IterationNum = 0; IterationNum != MaxSteps; ++IterationNum) {
- ConstantUInt *ItCst =
- ConstantUInt::get(IdxExpr->getType()->getUnsignedVersion(), IterationNum);
+ ConstantInt *ItCst =
+ ConstantInt::get(IdxExpr->getType()->getUnsignedVersion(), IterationNum);
ConstantInt *Val = EvaluateConstantChrecAtConstant(IdxExpr, ItCst);
// Form the GEP offset.
@@ -1896,7 +1896,7 @@
if (CondVal->getValue() == ExitWhen) {
ConstantEvolutionLoopExitValue[PN] = PHIVal;
++NumBruteForceTripCountsComputed;
- return SCEVConstant::get(ConstantUInt::get(Type::UIntTy, IterationNum));
+ return SCEVConstant::get(ConstantInt::get(Type::UIntTy, IterationNum));
}
// Compute the value of the PHI node for the next iteration.
@@ -1935,7 +1935,7 @@
// this is a constant evolving PHI node, get the final value at
// the specified iteration number.
Constant *RV = getConstantEvolutionLoopExitValue(PN,
- ICC->getValue()->getRawValue(),
+ ICC->getValue()->getZExtValue(),
LI);
if (RV) return SCEVUnknown::get(RV);
}
@@ -2076,10 +2076,10 @@
SqrtTerm = ConstantExpr::getSub(ConstantExpr::getMul(B, B), SqrtTerm);
// Compute floor(sqrt(B^2-4ac))
- ConstantUInt *SqrtVal =
- cast<ConstantUInt>(ConstantExpr::getCast(SqrtTerm,
+ ConstantInt *SqrtVal =
+ cast<ConstantInt>(ConstantExpr::getCast(SqrtTerm,
SqrtTerm->getType()->getUnsignedVersion()));
- uint64_t SqrtValV = SqrtVal->getValue();
+ uint64_t SqrtValV = SqrtVal->getZExtValue();
uint64_t SqrtValV2 = (uint64_t)sqrt((double)SqrtValV);
// The square root might not be precise for arbitrary 64-bit integer
// values. Do some sanity checks to ensure it's correct.
@@ -2089,7 +2089,7 @@
return std::make_pair(CNC, CNC);
}
- SqrtVal = ConstantUInt::get(Type::ULongTy, SqrtValV2);
+ SqrtVal = ConstantInt::get(Type::ULongTy, SqrtValV2);
SqrtTerm = ConstantExpr::getCast(SqrtVal, SqrtTerm->getType());
Constant *NegB = ConstantExpr::getNeg(B);
Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp
diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.4
--- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.3 Sat Feb 4 03:51:53 2006
+++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Fri Oct 20 02:07:24 2006
@@ -144,7 +144,7 @@
// IF the step is by one, just return the inserted IV.
if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(F))
- if (CI->getRawValue() == 1)
+ if (CI->getZExtValue() == 1)
return I;
// If the insert point is directly inside of the loop, emit the multiply at
More information about the llvm-commits
mailing list