summaryrefslogtreecommitdiff
path: root/lib/Analysis
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-24 23:12:02 +0000
committerOwen Anderson <resistor@mac.com>2009-07-24 23:12:02 +0000
commiteed707b1e6097aac2bb6b3d47271f6300ace7f2e (patch)
treec7390f63d90fc0c0ac483a90275863f41b69c085 /lib/Analysis
parente8530a3d8c940fb7710be7e25098b5c3b2c2de19 (diff)
downloadllvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.gz
llvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.bz2
llvm-eed707b1e6097aac2bb6b3d47271f6300ace7f2e.tar.xz
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp4
-rw-r--r--lib/Analysis/ConstantFolding.cpp20
-rw-r--r--lib/Analysis/DebugInfo.cpp68
-rw-r--r--lib/Analysis/ScalarEvolution.cpp31
-rw-r--r--lib/Analysis/ScalarEvolutionExpander.cpp9
5 files changed, 66 insertions, 66 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 49d771a42d..ed78c7ea46 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -780,10 +780,10 @@ BasicAliasAnalysis::CheckGEPInstructions(
//
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
GEP1Ops[i] =
- Context.getConstantInt(Type::Int64Ty,AT->getNumElements()-1);
+ ConstantInt::get(Type::Int64Ty,AT->getNumElements()-1);
else if (const VectorType *VT = dyn_cast<VectorType>(BasePtr1Ty))
GEP1Ops[i] =
- Context.getConstantInt(Type::Int64Ty,VT->getNumElements()-1);
+ ConstantInt::get(Type::Int64Ty,VT->getNumElements()-1);
}
}
diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp
index d60b4f6800..7ac8b97768 100644
--- a/lib/Analysis/ConstantFolding.cpp
+++ b/lib/Analysis/ConstantFolding.cpp
@@ -113,7 +113,7 @@ static Constant *SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0,
if (IsConstantOffsetFromGlobal(Op1, GV2, Offs2, *TD) &&
GV1 == GV2) {
// (&GV+C1) - (&GV+C2) -> C1-C2, pointer arithmetic cannot overflow.
- return Context.getConstantInt(Op0->getType(), Offs1-Offs2);
+ return ConstantInt::get(Op0->getType(), Offs1-Offs2);
}
}
@@ -151,7 +151,7 @@ static Constant *SymbolicallyEvaluateGEP(Constant* const* Ops, unsigned NumOps,
uint64_t Offset = TD->getIndexedOffset(Ptr->getType(),
(Value**)Ops+1, NumOps-1);
- Constant *C = Context.getConstantInt(TD->getIntPtrType(), Offset+BasePtr);
+ Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset+BasePtr);
return Context.getConstantExprIntToPtr(C, ResultTy);
}
@@ -232,7 +232,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
// Shift it to the right place, depending on endianness.
Src = Context.getConstantExprShl(Src,
- Context.getConstantInt(Src->getType(), ShiftAmt));
+ ConstantInt::get(Src->getType(), ShiftAmt));
ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize;
// Mix it in.
@@ -255,7 +255,7 @@ static Constant *FoldBitCast(Constant *C, const Type *DestTy,
// Shift the piece of the value into the right place, depending on
// endianness.
Constant *Elt = Context.getConstantExprLShr(Src,
- Context.getConstantInt(Src->getType(), ShiftAmt));
+ ConstantInt::get(Src->getType(), ShiftAmt));
ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize;
// Truncate and remember this piece.
@@ -376,7 +376,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
unsigned InWidth = Input->getType()->getScalarSizeInBits();
if (TD->getPointerSizeInBits() < InWidth) {
Constant *Mask =
- Context.getConstantInt(APInt::getLowBitsSet(InWidth,
+ ConstantInt::get(Context, APInt::getLowBitsSet(InWidth,
TD->getPointerSizeInBits()));
Input = Context.getConstantExprAnd(Input, Mask);
}
@@ -420,7 +420,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy,
AT->getNumElements()))) {
Constant *Index[] = {
Context.getNullValue(CE->getType()),
- Context.getConstantInt(ElemIdx)
+ ConstantInt::get(Context, ElemIdx)
};
return
Context.getConstantExprGetElementPtr(GV, &Index[0], 2);
@@ -801,13 +801,13 @@ llvm::ConstantFoldCall(Function *F,
}
} else if (ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) {
if (Len > 11 && !memcmp(Str, "llvm.bswap", 10))
- return Context.getConstantInt(Op->getValue().byteSwap());
+ return ConstantInt::get(Context, Op->getValue().byteSwap());
else if (Len > 11 && !memcmp(Str, "llvm.ctpop", 10))
- return Context.getConstantInt(Ty, Op->getValue().countPopulation());
+ return ConstantInt::get(Ty, Op->getValue().countPopulation());
else if (Len > 10 && !memcmp(Str, "llvm.cttz", 9))
- return Context.getConstantInt(Ty, Op->getValue().countTrailingZeros());
+ return ConstantInt::get(Ty, Op->getValue().countTrailingZeros());
else if (Len > 10 && !memcmp(Str, "llvm.ctlz", 9))
- return Context.getConstantInt(Ty, Op->getValue().countLeadingZeros());
+ return ConstantInt::get(Ty, Op->getValue().countLeadingZeros());
}
} else if (NumOperands == 2) {
if (ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) {
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index f1ad08aefa..aded6d8eee 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -482,7 +482,7 @@ Constant *DIFactory::getCastToEmpty(DIDescriptor D) {
Constant *DIFactory::GetTagConstant(unsigned TAG) {
assert((TAG & LLVMDebugVersionMask) == 0 &&
"Tag too large for debug encoding!");
- return VMContext.getConstantInt(Type::Int32Ty, TAG | LLVMDebugVersion);
+ return ConstantInt::get(Type::Int32Ty, TAG | LLVMDebugVersion);
}
Constant *DIFactory::GetStringConstant(const std::string &String) {
@@ -541,8 +541,8 @@ DIArray DIFactory::GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys) {
DISubrange DIFactory::GetOrCreateSubrange(int64_t Lo, int64_t Hi) {
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_subrange_type),
- VMContext.getConstantInt(Type::Int64Ty, Lo),
- VMContext.getConstantInt(Type::Int64Ty, Hi)
+ ConstantInt::get(Type::Int64Ty, Lo),
+ ConstantInt::get(Type::Int64Ty, Hi)
};
Constant *Init = VMContext.getConstantStruct(Elts,
@@ -577,14 +577,14 @@ DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID,
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_compile_unit),
VMContext.getNullValue(EmptyStructPtr),
- VMContext.getConstantInt(Type::Int32Ty, LangID),
+ ConstantInt::get(Type::Int32Ty, LangID),
GetStringConstant(Filename),
GetStringConstant(Directory),
GetStringConstant(Producer),
- VMContext.getConstantInt(Type::Int1Ty, isMain),
- VMContext.getConstantInt(Type::Int1Ty, isOptimized),
+ ConstantInt::get(Type::Int1Ty, isMain),
+ ConstantInt::get(Type::Int1Ty, isOptimized),
GetStringConstant(Flags),
- VMContext.getConstantInt(Type::Int32Ty, RunTimeVer)
+ ConstantInt::get(Type::Int32Ty, RunTimeVer)
};
Constant *Init = VMContext.getConstantStruct(Elts,
@@ -603,7 +603,7 @@ DIEnumerator DIFactory::CreateEnumerator(const std::string &Name, uint64_t Val){
Constant *Elts[] = {
GetTagConstant(dwarf::DW_TAG_enumerator),
GetStringConstant(Name),
- VMContext.getConstantInt(Type::Int64Ty, Val)
+ ConstantInt::get(Type::Int64Ty, Val)
};
Constant *Init = VMContext.getConstantStruct(Elts,
@@ -632,12 +632,12 @@ DIBasicType DIFactory::CreateBasicType(DIDescriptor Context,
getCastToEmpty(Context),
GetStringConstant(Name),
getCastToEmpty(CompileUnit),
- VMContext.getConstantInt(Type::Int32Ty, LineNumber),
- VMContext.getConstantInt(Type::Int64Ty, SizeInBits),
- VMContext.getConstantInt(Type::Int64Ty, AlignInBits),
- VMContext.getConstantInt(Type::Int64Ty, OffsetInBits),
- VMContext.getConstantInt(Type::Int32Ty, Flags),
- VMContext.getConstantInt(Type::Int32Ty, Encoding)
+ ConstantInt::get(Type::Int32Ty, LineNumber),
+ ConstantInt::get(Type::Int64Ty, SizeInBits),
+ ConstantInt::get(Type::Int64Ty, AlignInBits),
+ ConstantInt::get(Type::Int64Ty, OffsetInBits),
+ ConstantInt::get(Type::Int32Ty, Flags),
+ ConstantInt::get(Type::Int32Ty, Encoding)
};
Constant *Init = VMContext.getConstantStruct(Elts,
@@ -668,11 +668,11 @@ DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
getCastToEmpty(Context),
GetStringConstant(Name),
getCastToEmpty(CompileUnit),
- VMContext.getConstantInt(Type::Int32Ty, LineNumber),
- VMContext.getConstantInt(Type::Int64Ty, SizeInBits),
- VMContext.getConstantInt(Type::Int64Ty, AlignInBits),
- VMContext.getConstantInt(Type::Int64Ty, OffsetInBits),
- VMContext.getConstantInt(Type::Int32Ty, Flags),
+ ConstantInt::get(Type::Int32Ty, LineNumber),
+ ConstantInt::get(Type::Int64Ty, SizeInBits),
+ ConstantInt::get(Type::Int64Ty, AlignInBits),
+ ConstantInt::get(Type::Int64Ty, OffsetInBits),
+ ConstantInt::get(Type::Int32Ty, Flags),
getCastToEmpty(DerivedFrom)
};
@@ -706,14 +706,14 @@ DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
getCastToEmpty(Context),
GetStringConstant(Name),
getCastToEmpty(CompileUnit),
- VMContext.getConstantInt(Type::Int32Ty, LineNumber),
- VMContext.getConstantInt(Type::Int64Ty, SizeInBits),
- VMContext.getConstantInt(Type::Int64Ty, AlignInBits),
- VMContext.getConstantInt(Type::Int64Ty, OffsetInBits),
- VMContext.getConstantInt(Type::Int32Ty, Flags),
+ ConstantInt::get(Type::Int32Ty, LineNumber),
+ ConstantInt::get(Type::Int64Ty, SizeInBits),
+ ConstantInt::get(Type::Int64Ty, AlignInBits),
+ ConstantInt::get(Type::Int64Ty, OffsetInBits),
+ ConstantInt::get(Type::Int32Ty, Flags),
getCastToEmpty(DerivedFrom),
getCastToEmpty(Elements),
- VMContext.getConstantInt(Type::Int32Ty, RuntimeLang)
+ ConstantInt::get(Type::Int32Ty, RuntimeLang)
};
Constant *Init = VMContext.getConstantStruct(Elts,
@@ -748,10 +748,10 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context,
GetStringConstant(DisplayName),
GetStringConstant(LinkageName),
getCastToEmpty(CompileUnit),
- VMContext.getConstantInt(Type::Int32Ty, LineNo),
+ ConstantInt::get(Type::Int32Ty, LineNo),
getCastToEmpty(Type),
- VMContext.getConstantInt(Type::Int1Ty, isLocalToUnit),
- VMContext.getConstantInt(Type::Int1Ty, isDefinition)
+ ConstantInt::get(Type::Int1Ty, isLocalToUnit),
+ ConstantInt::get(Type::Int1Ty, isDefinition)
};
Constant *Init = VMContext.getConstantStruct(Elts,
@@ -781,10 +781,10 @@ DIFactory::CreateGlobalVariable(DIDescriptor Context, const std::string &Name,
GetStringConstant(DisplayName),
GetStringConstant(LinkageName),
getCastToEmpty(CompileUnit),
- VMContext.getConstantInt(Type::Int32Ty, LineNo),
+ ConstantInt::get(Type::Int32Ty, LineNo),
getCastToEmpty(Type),
- VMContext.getConstantInt(Type::Int1Ty, isLocalToUnit),
- VMContext.getConstantInt(Type::Int1Ty, isDefinition),
+ ConstantInt::get(Type::Int1Ty, isLocalToUnit),
+ ConstantInt::get(Type::Int1Ty, isDefinition),
VMContext.getConstantExprBitCast(Val, EmptyStructPtr)
};
@@ -810,7 +810,7 @@ DIVariable DIFactory::CreateVariable(unsigned Tag, DIDescriptor Context,
getCastToEmpty(Context),
GetStringConstant(Name),
getCastToEmpty(CompileUnit),
- VMContext.getConstantInt(Type::Int32Ty, LineNo),
+ ConstantInt::get(Type::Int32Ty, LineNo),
getCastToEmpty(Type)
};
@@ -862,8 +862,8 @@ void DIFactory::InsertStopPoint(DICompileUnit CU, unsigned LineNo,
// Invoke llvm.dbg.stoppoint
Value *Args[] = {
- VMContext.getConstantInt(llvm::Type::Int32Ty, LineNo),
- VMContext.getConstantInt(llvm::Type::Int32Ty, ColNo),
+ ConstantInt::get(llvm::Type::Int32Ty, LineNo),
+ ConstantInt::get(llvm::Type::Int32Ty, ColNo),
getCastToEmpty(CU)
};
CallInst::Create(StopPointFn, Args, Args+3, "", BB);
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 28e9902ab7..6b64648f17 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -192,13 +192,13 @@ const SCEV *ScalarEvolution::getConstant(ConstantInt *V) {
}
const SCEV *ScalarEvolution::getConstant(const APInt& Val) {
- return getConstant(getContext().getConstantInt(Val));
+ return getConstant(ConstantInt::get(getContext(), Val));
}
const SCEV *
ScalarEvolution::getConstant(const Type *Ty, uint64_t V, bool isSigned) {
return getConstant(
- getContext().getConstantInt(cast<IntegerType>(Ty), V, isSigned));
+ ConstantInt::get(cast<IntegerType>(Ty), V, isSigned));
}
const Type *SCEVConstant::getType() const { return V->getType(); }
@@ -1518,7 +1518,8 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops) {
++Idx;
while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) {
// We found two constants, fold them together!
- ConstantInt *Fold = getContext().getConstantInt(LHSC->getValue()->getValue() *
+ ConstantInt *Fold = ConstantInt::get(getContext(),
+ LHSC->getValue()->getValue() *
RHSC->getValue()->getValue());
Ops[0] = getConstant(Fold);
Ops.erase(Ops.begin()+1); // Erase the folded element
@@ -1869,7 +1870,7 @@ ScalarEvolution::getSMaxExpr(SmallVectorImpl<const SCEV *> &Ops) {
assert(Idx < Ops.size());
while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) {
// We found two constants, fold them together!
- ConstantInt *Fold = getContext().getConstantInt(
+ ConstantInt *Fold = ConstantInt::get(getContext(),
APIntOps::smax(LHSC->getValue()->getValue(),
RHSC->getValue()->getValue()));
Ops[0] = getConstant(Fold);
@@ -1966,7 +1967,7 @@ ScalarEvolution::getUMaxExpr(SmallVectorImpl<const SCEV *> &Ops) {
assert(Idx < Ops.size());
while (const SCEVConstant *RHSC = dyn_cast<SCEVConstant>(Ops[Idx])) {
// We found two constants, fold them together!
- ConstantInt *Fold = getContext().getConstantInt(
+ ConstantInt *Fold = ConstantInt::get(getContext(),
APIntOps::umax(LHSC->getValue()->getValue(),
RHSC->getValue()->getValue()));
Ops[0] = getConstant(Fold);
@@ -2133,7 +2134,7 @@ const SCEV *ScalarEvolution::getSCEV(Value *V) {
/// specified signed integer value and return a SCEV for the constant.
const SCEV *ScalarEvolution::getIntegerSCEV(int Val, const Type *Ty) {
const IntegerType *ITy = cast<IntegerType>(getEffectiveSCEVType(Ty));
- return getConstant(getContext().getConstantInt(ITy, Val));
+ return getConstant(ConstantInt::get(ITy, Val));
}
/// getNegativeSCEV - Return a SCEV corresponding to -V = -1*V
@@ -2896,7 +2897,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
// Turn shift left of a constant amount into a multiply.
if (ConstantInt *SA = dyn_cast<ConstantInt>(U->getOperand(1))) {
uint32_t BitWidth = cast<IntegerType>(V->getType())->getBitWidth();
- Constant *X = getContext().getConstantInt(
+ Constant *X = ConstantInt::get(getContext(),
APInt(BitWidth, 1).shl(SA->getLimitedValue(BitWidth)));
return getMulExpr(getSCEV(U->getOperand(0)), getSCEV(X));
}
@@ -2906,7 +2907,7 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) {
// Turn logical shift right of a constant into a unsigned divide.
if (ConstantInt *SA = dyn_cast<ConstantInt>(U->getOperand(1))) {
uint32_t BitWidth = cast<IntegerType>(V->getType())->getBitWidth();
- Constant *X = getContext().getConstantInt(
+ Constant *X = ConstantInt::get(getContext(),
APInt(BitWidth, 1).shl(SA->getLimitedValue(BitWidth)));
return getUDivExpr(getSCEV(U->getOperand(0)), getSCEV(X));
}
@@ -3558,7 +3559,7 @@ ScalarEvolution::ComputeLoadConstantCompareBackedgeTakenCount(
unsigned MaxSteps = MaxBruteForceIterations;
for (unsigned IterationNum = 0; IterationNum != MaxSteps; ++IterationNum) {
- ConstantInt *ItCst = getContext().getConstantInt(
+ ConstantInt *ItCst = ConstantInt::get(
cast<IntegerType>(IdxExpr->getType()), IterationNum);
ConstantInt *Val = EvaluateConstantChrecAtConstant(IdxExpr, ItCst, *this);
@@ -4072,9 +4073,9 @@ SolveQuadraticEquation(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) {
LLVMContext &Context = SE.getContext();
ConstantInt *Solution1 =
- Context.getConstantInt((NegB + SqrtVal).sdiv(TwoA));
+ ConstantInt::get(Context, (NegB + SqrtVal).sdiv(TwoA));
ConstantInt *Solution2 =
- Context.getConstantInt((NegB - SqrtVal).sdiv(TwoA));
+ ConstantInt::get(Context, (NegB - SqrtVal).sdiv(TwoA));
return std::make_pair(SE.getConstant(Solution1),
SE.getConstant(Solution2));
@@ -4836,7 +4837,7 @@ const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
// The exit value should be (End+A)/A.
APInt ExitVal = (End + A).udiv(A);
- ConstantInt *ExitValue = SE.getContext().getConstantInt(ExitVal);
+ ConstantInt *ExitValue = ConstantInt::get(SE.getContext(), ExitVal);
// Evaluate at the exit value. If we really did fall out of the valid
// range, then we computed our trip count, otherwise wrap around or other
@@ -4848,7 +4849,7 @@ const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
// Ensure that the previous value is in the range. This is a sanity check.
assert(Range.contains(
EvaluateConstantChrecAtConstant(this,
- SE.getContext().getConstantInt(ExitVal - One), SE)->getValue()) &&
+ ConstantInt::get(SE.getContext(), ExitVal - One), SE)->getValue()) &&
"Linear scev computation is off in a bad way!");
return SE.getConstant(ExitValue);
} else if (isQuadratic()) {
@@ -4883,7 +4884,7 @@ const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
if (Range.contains(R1Val->getValue())) {
// The next iteration must be out of the range...
ConstantInt *NextVal =
- SE.getContext().getConstantInt(R1->getValue()->getValue()+1);
+ ConstantInt::get(SE.getContext(), R1->getValue()->getValue()+1);
R1Val = EvaluateConstantChrecAtConstant(this, NextVal, SE);
if (!Range.contains(R1Val->getValue()))
@@ -4894,7 +4895,7 @@ const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
// If R1 was not in the range, then it is a good return value. Make
// sure that R1-1 WAS in the range though, just in case.
ConstantInt *NextVal =
- SE.getContext().getConstantInt(R1->getValue()->getValue()-1);
+ ConstantInt::get(SE.getContext(), R1->getValue()->getValue()-1);
R1Val = EvaluateConstantChrecAtConstant(this, NextVal, SE);
if (Range.contains(R1Val->getValue()))
return R1;
diff --git a/lib/Analysis/ScalarEvolutionExpander.cpp b/lib/Analysis/ScalarEvolutionExpander.cpp
index 6d55ffc421..eb2236b2d7 100644
--- a/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -167,7 +167,7 @@ static bool FactorOutConstant(const SCEV *&S,
// For a Constant, check for a multiple of the given factor.
if (const SCEVConstant *C = dyn_cast<SCEVConstant>(S)) {
ConstantInt *CI =
- SE.getContext().getConstantInt(C->getValue()->getValue().sdiv(Factor));
+ ConstantInt::get(SE.getContext(), C->getValue()->getValue().sdiv(Factor));
// If the quotient is zero and the remainder is non-zero, reject
// the value at this scale. It will be considered for subsequent
// smaller scales.
@@ -298,8 +298,7 @@ Value *SCEVExpander::expandAddToGEP(const SCEV *const *op_begin,
uint64_t FullOffset = C->getValue()->getZExtValue();
if (FullOffset < SL.getSizeInBytes()) {
unsigned ElIdx = SL.getElementContainingOffset(FullOffset);
- GepIndices.push_back(
- getContext().getConstantInt(Type::Int32Ty, ElIdx));
+ GepIndices.push_back(ConstantInt::get(Type::Int32Ty, ElIdx));
ElTy = STy->getTypeAtIndex(ElIdx);
Ops[0] =
SE.getConstant(Ty, FullOffset - SL.getElementOffset(ElIdx));
@@ -412,7 +411,7 @@ Value *SCEVExpander::visitUDivExpr(const SCEVUDivExpr *S) {
const APInt &RHS = SC->getValue()->getValue();
if (RHS.isPowerOf2())
return InsertBinop(Instruction::LShr, LHS,
- getContext().getConstantInt(Ty, RHS.logBase2()));
+ ConstantInt::get(Ty, RHS.logBase2()));
}
Value *RHS = expandCodeFor(S->getRHS(), Ty);
@@ -532,7 +531,7 @@ Value *SCEVExpander::visitAddRecExpr(const SCEVAddRecExpr *S) {
// Insert a unit add instruction right before the terminator corresponding
// to the back-edge.
- Constant *One = getContext().getConstantInt(Ty, 1);
+ Constant *One = ConstantInt::get(Ty, 1);
Instruction *Add = BinaryOperator::CreateAdd(PN, One, "indvar.next",
(*HPI)->getTerminator());
InsertedValues.insert(Add);