summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp15
-rw-r--r--lib/Analysis/ConstantFolding.cpp11
-rw-r--r--lib/Analysis/ConstantRange.cpp4
-rw-r--r--lib/Analysis/DataStructure/Local.cpp2
-rw-r--r--lib/Analysis/ScalarEvolution.cpp28
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp2
6 files changed, 31 insertions, 31 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index fdc452b44f..8d4cbdb93d 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -468,11 +468,10 @@ static bool ValuesEqual(Value *V1, Value *V2) {
/// 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 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops,
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 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops,
// 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 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops,
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());
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index 7e802ba7dd..359766d444 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -163,14 +163,15 @@ llvm::ConstantFoldCall(Function *F, const std::vector<Constant*> &Operands) {
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])) {
diff --git a/lib/Analysis/ConstantRange.cpp b/lib/Analysis/ConstantRange.cpp
index beb61754fc..9e12c9343d 100644
--- a/lib/Analysis/ConstantRange.cpp
+++ b/lib/Analysis/ConstantRange.cpp
@@ -161,7 +161,7 @@ uint64_t ConstantRange::getSetSize() const {
// 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 @@ ConstantRange ConstantRange::zeroExtend(const Type *Ty) const {
// 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();
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index dbfbea3981..c5c68b3a69 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -407,7 +407,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) {
I != E; ++I)
if (const StructType *STy = dyn_cast<StructType>(*I)) {
unsigned FieldNo =
- (unsigned)cast<ConstantUInt>(I.getOperand())->getValue();
+ (unsigned)cast<ConstantInt>(I.getOperand())->getZExtValue();
Offset += (unsigned)TD.getStructLayout(STy)->MemberOffsets[FieldNo];
} else if (const PointerType *PTy = dyn_cast<PointerType>(*I)) {
if (!isa<Constant>(I.getOperand()) ||
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 93d20f474f..a992e51e0f 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -177,7 +177,7 @@ SCEVHandle SCEVConstant::get(ConstantInt *V) {
// 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 @@ SCEVHandle SCEVUnknown::getIntegerSCEV(int Val, const Type *Ty) {
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 @@ static SCEVHandle PartialFact(SCEVHandle V, unsigned NumSteps) {
// 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 @@ GetAddressedElementFromGlobal(GlobalVariable *GV,
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 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS,
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 @@ ComputeIterationCountExhaustively(const Loop *L, Value *Cond, bool ExitWhen) {
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 @@ SCEVHandle ScalarEvolutionsImpl::getSCEVAtScope(SCEV *V, const Loop *L) {
// 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 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) {
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 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec) {
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);
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index fd33e2fae2..68b52dd4fa 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -144,7 +144,7 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
// 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