aboutsummaryrefslogtreecommitdiff
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
parente8530a3d8c940fb7710be7e25098b5c3b2c2de19 (diff)
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
-rw-r--r--examples/BrainF/BrainF.cpp16
-rw-r--r--examples/BrainF/BrainFDriver.cpp2
-rw-r--r--examples/Fibonacci/fibonacci.cpp4
-rw-r--r--examples/HowToUseJIT/HowToUseJIT.cpp4
-rw-r--r--examples/ModuleMaker/ModuleMaker.cpp4
-rw-r--r--examples/ParallelJIT/ParallelJIT.cpp6
-rw-r--r--include/llvm/Constants.h29
-rw-r--r--include/llvm/LLVMContext.h32
-rw-r--r--include/llvm/Support/IRBuilder.h14
-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
-rw-r--r--lib/AsmParser/LLParser.cpp2
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp11
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp62
-rw-r--r--lib/CodeGen/SelectionDAG/FastISel.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp2
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
-rw-r--r--lib/CodeGen/ShadowStackGC.cpp18
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp6
-rw-r--r--lib/Target/ARM/ARMBaseRegisterInfo.cpp3
-rw-r--r--lib/Target/ARM/ARMISelDAGToDAG.cpp3
-rw-r--r--lib/Target/ARM/Thumb1RegisterInfo.cpp3
-rw-r--r--lib/Target/ARM/Thumb2RegisterInfo.cpp3
-rw-r--r--lib/Target/Alpha/AlphaISelDAGToDAG.cpp2
-rw-r--r--lib/Target/CBackend/CBackend.cpp2
-rw-r--r--lib/Target/X86/X86ISelLowering.cpp8
-rw-r--r--lib/Target/XCore/XCoreISelDAGToDAG.cpp3
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp10
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp12
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp8
-rw-r--r--lib/Transforms/Instrumentation/ProfilingUtils.cpp6
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.cpp28
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp4
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp6
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp264
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp5
-rw-r--r--lib/Transforms/Scalar/LoopIndexSplit.cpp4
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp8
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp2
-rw-r--r--lib/Transforms/Scalar/MemCpyOptimizer.cpp6
-rw-r--r--lib/Transforms/Scalar/PredicateSimplifier.cpp23
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp2
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp34
-rw-r--r--lib/Transforms/Scalar/SimplifyLibCalls.cpp80
-rw-r--r--lib/Transforms/Utils/CodeExtractor.cpp14
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp4
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp2
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp12
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp4
-rw-r--r--lib/VMCore/AutoUpgrade.cpp36
-rw-r--r--lib/VMCore/ConstantFold.cpp90
-rw-r--r--lib/VMCore/Constants.cpp336
-rw-r--r--lib/VMCore/Core.cpp3
-rw-r--r--lib/VMCore/Instructions.cpp2
-rw-r--r--lib/VMCore/LLVMContext.cpp59
-rw-r--r--lib/VMCore/LLVMContextImpl.cpp386
-rw-r--r--lib/VMCore/LLVMContextImpl.h350
-rw-r--r--tools/bugpoint/ExtractFunction.cpp2
-rw-r--r--unittests/ExecutionEngine/JIT/JITTest.cpp3
-rw-r--r--unittests/Support/ValueHandleTest.cpp2
-rw-r--r--unittests/VMCore/ConstantsTest.cpp24
-rw-r--r--unittests/VMCore/MetadataTest.cpp4
-rw-r--r--win32/unistd.h2
67 files changed, 960 insertions, 1254 deletions
diff --git a/examples/BrainF/BrainF.cpp b/examples/BrainF/BrainF.cpp
index 4969a55a66..97a9b0579e 100644
--- a/examples/BrainF/BrainF.cpp
+++ b/examples/BrainF/BrainF.cpp
@@ -77,16 +77,16 @@ void BrainF::header(LLVMContext& C) {
builder = new IRBuilder<>(BasicBlock::Create(label, brainf_func));
//%arr = malloc i8, i32 %d
- ConstantInt *val_mem = C.getConstantInt(APInt(32, memtotal));
+ ConstantInt *val_mem = ConstantInt::get(C, APInt(32, memtotal));
ptr_arr = builder->CreateMalloc(IntegerType::Int8Ty, val_mem, "arr");
//call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1)
{
Value *memset_params[] = {
ptr_arr,
- C.getConstantInt(APInt(8, 0)),
+ ConstantInt::get(C, APInt(8, 0)),
val_mem,
- C.getConstantInt(APInt(32, 1))
+ ConstantInt::get(C, APInt(32, 1))
};
CallInst *memset_call = builder->
@@ -97,12 +97,12 @@ void BrainF::header(LLVMContext& C) {
//%arrmax = getelementptr i8 *%arr, i32 %d
if (comflag & flag_arraybounds) {
ptr_arrmax = builder->
- CreateGEP(ptr_arr, C.getConstantInt(APInt(32, memtotal)), "arrmax");
+ CreateGEP(ptr_arr, ConstantInt::get(C, APInt(32, memtotal)), "arrmax");
}
//%head.%d = getelementptr i8 *%arr, i32 %d
curhead = builder->CreateGEP(ptr_arr,
- C.getConstantInt(APInt(32, memtotal/2)),
+ ConstantInt::get(C, APInt(32, memtotal/2)),
headreg);
@@ -229,7 +229,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
{
//%head.%d = getelementptr i8 *%head.%d, i32 %d
curhead = builder->
- CreateGEP(curhead, C.getConstantInt(APInt(32, curvalue)),
+ CreateGEP(curhead, ConstantInt::get(C, APInt(32, curvalue)),
headreg);
//Error block for array out of bounds
@@ -264,7 +264,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
//%tape.%d = add i8 %tape.%d, %d
Value *tape_1 = builder->
- CreateAdd(tape_0, C.getConstantInt(APInt(8, curvalue)), tapereg);
+ CreateAdd(tape_0, ConstantInt::get(C, APInt(8, curvalue)), tapereg);
//store i8 %tape.%d, i8 *%head.%d\n"
builder->CreateStore(tape_1, curhead);
@@ -429,7 +429,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
//%test.%d = icmp eq i8 %tape.%d, 0
ICmpInst *test_0 = new ICmpInst(*testbb, ICmpInst::ICMP_EQ, tape_0,
- C.getConstantInt(APInt(8, 0)), testreg);
+ ConstantInt::get(C, APInt(8, 0)), testreg);
//br i1 %test.%d, label %main.%d, label %main.%d
BasicBlock *bb_0 = BasicBlock::Create(label, brainf_func);
diff --git a/examples/BrainF/BrainFDriver.cpp b/examples/BrainF/BrainFDriver.cpp
index fba79cfbd5..8c62ae2900 100644
--- a/examples/BrainF/BrainFDriver.cpp
+++ b/examples/BrainF/BrainFDriver.cpp
@@ -80,7 +80,7 @@ void addMainFunction(Module *mod) {
}
//ret i32 0
- ReturnInst::Create(getGlobalContext().getConstantInt(APInt(32, 0)), bb);
+ ReturnInst::Create(ConstantInt::get(getGlobalContext(), APInt(32, 0)), bb);
}
int main(int argc, char **argv) {
diff --git a/examples/Fibonacci/fibonacci.cpp b/examples/Fibonacci/fibonacci.cpp
index c5c8f0de89..48efd5a1cc 100644
--- a/examples/Fibonacci/fibonacci.cpp
+++ b/examples/Fibonacci/fibonacci.cpp
@@ -47,8 +47,8 @@ static Function *CreateFibFunction(Module *M, LLVMContext &Context) {
BasicBlock *BB = BasicBlock::Create("EntryBlock", FibF);
// Get pointers to the constants.
- Value *One = Context.getConstantInt(Type::Int32Ty, 1);
- Value *Two = Context.getConstantInt(Type::Int32Ty, 2);
+ Value *One = ConstantInt::get(Type::Int32Ty, 1);
+ Value *Two = ConstantInt::get(Type::Int32Ty, 2);
// Get pointer to the integer argument of the add1 function...
Argument *ArgX = FibF->arg_begin(); // Get the arg.
diff --git a/examples/HowToUseJIT/HowToUseJIT.cpp b/examples/HowToUseJIT/HowToUseJIT.cpp
index 8a788491fd..7a99ed4473 100644
--- a/examples/HowToUseJIT/HowToUseJIT.cpp
+++ b/examples/HowToUseJIT/HowToUseJIT.cpp
@@ -69,7 +69,7 @@ int main() {
BasicBlock *BB = BasicBlock::Create("EntryBlock", Add1F);
// Get pointers to the constant `1'.
- Value *One = Context.getConstantInt(Type::Int32Ty, 1);
+ Value *One = ConstantInt::get(Type::Int32Ty, 1);
// Get pointers to the integer argument of the add1 function...
assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg
@@ -94,7 +94,7 @@ int main() {
BB = BasicBlock::Create("EntryBlock", FooF);
// Get pointers to the constant `10'.
- Value *Ten = Context.getConstantInt(Type::Int32Ty, 10);
+ Value *Ten = ConstantInt::get(Type::Int32Ty, 10);
// Pass Ten to the call call:
CallInst *Add1CallRes = CallInst::Create(Add1F, Ten, "add1", BB);
diff --git a/examples/ModuleMaker/ModuleMaker.cpp b/examples/ModuleMaker/ModuleMaker.cpp
index 537ee341dc..1baa8c98ef 100644
--- a/examples/ModuleMaker/ModuleMaker.cpp
+++ b/examples/ModuleMaker/ModuleMaker.cpp
@@ -42,8 +42,8 @@ int main() {
BasicBlock *BB = BasicBlock::Create("EntryBlock", F);
// Get pointers to the constant integers...
- Value *Two = Context.getConstantInt(Type::Int32Ty, 2);
- Value *Three = Context.getConstantInt(Type::Int32Ty, 3);
+ Value *Two = ConstantInt::get(Type::Int32Ty, 2);
+ Value *Three = ConstantInt::get(Type::Int32Ty, 3);
// Create the add instruction... does not insert...
Instruction *Add = BinaryOperator::Create(Instruction::Add, Two, Three,
diff --git a/examples/ParallelJIT/ParallelJIT.cpp b/examples/ParallelJIT/ParallelJIT.cpp
index 464bd22e8f..83e2640636 100644
--- a/examples/ParallelJIT/ParallelJIT.cpp
+++ b/examples/ParallelJIT/ParallelJIT.cpp
@@ -44,7 +44,7 @@ static Function* createAdd1(Module *M) {
BasicBlock *BB = BasicBlock::Create("EntryBlock", Add1F);
// Get pointers to the constant `1'.
- Value *One = M->getContext().getConstantInt(Type::Int32Ty, 1);
+ Value *One = ConstantInt::get(Type::Int32Ty, 1);
// Get pointers to the integer argument of the add1 function...
assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg
@@ -72,8 +72,8 @@ static Function *CreateFibFunction(Module *M) {
BasicBlock *BB = BasicBlock::Create("EntryBlock", FibF);
// Get pointers to the constants.
- Value *One = M->getContext().getConstantInt(Type::Int32Ty, 1);
- Value *Two = M->getContext().getConstantInt(Type::Int32Ty, 2);
+ Value *One = ConstantInt::get(Type::Int32Ty, 1);
+ Value *Two = ConstantInt::get(Type::Int32Ty, 2);
// Get pointer to the integer argument of the add1 function...
Argument *ArgX = FibF->arg_begin(); // Get the arg.
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index f9fd636e3a..d59621a453 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -57,6 +57,35 @@ protected:
return User::operator new(s, 0);
}
public:
+ /// If Ty is a vector type, return a Constant with a splat of the given
+ /// value. Otherwise return a ConstantInt for the given value.
+ static Constant* get(const Type* Ty, uint64_t V, bool isSigned = false);
+
+ /// Return a ConstantInt with the specified integer value for the specified
+ /// type. If the type is wider than 64 bits, the value will be zero-extended
+ /// to fit the type, unless isSigned is true, in which case the value will
+ /// be interpreted as a 64-bit signed integer and sign-extended to fit
+ /// the type.
+ /// @brief Get a ConstantInt for a specific value.
+ static ConstantInt* get(const IntegerType* Ty, uint64_t V,
+ bool isSigned = false);
+
+ /// Return a ConstantInt with the specified value for the specified type. The
+ /// value V will be canonicalized to a an unsigned APInt. Accessing it with
+ /// either getSExtValue() or getZExtValue() will yield a correctly sized and
+ /// signed value for the type Ty.
+ /// @brief Get a ConstantInt for a specific signed value.
+ static ConstantInt* getSigned(const IntegerType* Ty, int64_t V);
+ static Constant *getSigned(const Type *Ty, int64_t V);
+
+ /// Return a ConstantInt with the specified value and an implied Type. The
+ /// type is the integer type that corresponds to the bit width of the value.
+ static ConstantInt* get(LLVMContext &Context, const APInt& V);
+
+ /// If Ty is a vector type, return a Constant with a splat of the given
+ /// value. Otherwise return a ConstantInt for the given value.
+ static Constant* get(const Type* Ty, const APInt& V);
+
/// Return the constant as an APInt value reference. This allows clients to
/// obtain a copy of the value, with all its precision in tact.
/// @brief Return the constant's value.
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
index a2fa569ce5..73d88984c1 100644
--- a/include/llvm/LLVMContext.h
+++ b/include/llvm/LLVMContext.h
@@ -53,6 +53,8 @@ class Use;
/// to have one context per thread.
class LLVMContext {
LLVMContextImpl* pImpl;
+
+ friend class ConstantInt;
public:
LLVMContext();
~LLVMContext();
@@ -72,36 +74,6 @@ public:
ConstantInt* getTrue();
ConstantInt* getFalse();
- /// If Ty is a vector type, return a Constant with a splat of the given
- /// value. Otherwise return a ConstantInt for the given value.
- Constant* getConstantInt(const Type* Ty, uint64_t V,
- bool isSigned = false);
-
- /// Return a ConstantInt with the specified integer value for the specified
- /// type. If the type is wider than 64 bits, the value will be zero-extended
- /// to fit the type, unless isSigned is true, in which case the value will
- /// be interpreted as a 64-bit signed integer and sign-extended to fit
- /// the type.
- /// @brief Get a ConstantInt for a specific value.
- ConstantInt* getConstantInt(const IntegerType* Ty, uint64_t V,
- bool isSigned = false);
-
- /// Return a ConstantInt with the specified value for the specified type. The
- /// value V will be canonicalized to a an unsigned APInt. Accessing it with
- /// either getSExtValue() or getZExtValue() will yield a correctly sized and
- /// signed value for the type Ty.
- /// @brief Get a ConstantInt for a specific signed value.
- ConstantInt* getConstantIntSigned(const IntegerType* Ty, int64_t V);
- Constant *getConstantIntSigned(const Type *Ty, int64_t V);
-
- /// Return a ConstantInt with the specified value and an implied Type. The
- /// type is the integer type that corresponds to the bit width of the value.
- ConstantInt* getConstantInt(const APInt& V);
-
- /// If Ty is a vector type, return a Constant with a splat of the given
- /// value. Otherwise return a ConstantInt for the given value.
- Constant* getConstantInt(const Type* Ty, const APInt& V);
-
// ConstantPointerNull accessors
ConstantPointerNull* getConstantPointerNull(const PointerType* T);
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 835a28622f..ac134ec303 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -370,7 +370,7 @@ public:
return Insert(GetElementPtrInst::Create(Ptr, Idx), Name);
}
Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const char *Name = "") {
- Value *Idx = Context.getConstantInt(Type::Int32Ty, Idx0);
+ Value *Idx = ConstantInt::get(Type::Int32Ty, Idx0);
if (Constant *PC = dyn_cast<Constant>(Ptr))
return Folder.CreateGetElementPtr(PC, &Idx, 1);
@@ -380,8 +380,8 @@ public:
Value *CreateConstGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
const char *Name = "") {
Value *Idxs[] = {
- Context.getConstantInt(Type::Int32Ty, Idx0),
- Context.getConstantInt(Type::Int32Ty, Idx1)
+ ConstantInt::get(Type::Int32Ty, Idx0),
+ ConstantInt::get(Type::Int32Ty, Idx1)
};
if (Constant *PC = dyn_cast<Constant>(Ptr))
@@ -390,7 +390,7 @@ public:
return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name);
}
Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const char *Name = "") {
- Value *Idx = Context.getConstantInt(Type::Int64Ty, Idx0);
+ Value *Idx = ConstantInt::get(Type::Int64Ty, Idx0);
if (Constant *PC = dyn_cast<Constant>(Ptr))
return Folder.CreateGetElementPtr(PC, &Idx, 1);
@@ -400,8 +400,8 @@ public:
Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
const char *Name = "") {
Value *Idxs[] = {
- Context.getConstantInt(Type::Int64Ty, Idx0),
- Context.getConstantInt(Type::Int64Ty, Idx1)
+ ConstantInt::get(Type::Int64Ty, Idx0),
+ ConstantInt::get(Type::Int64Ty, Idx1)
};
if (Constant *PC = dyn_cast<Constant>(Ptr))
@@ -428,7 +428,7 @@ public:
}
Value *CreateGlobalStringPtr(const char *Str = "", const char *Name = "") {
Value *gv = CreateGlobalString(Str, Name);
- Value *zero = Context.getConstantInt(Type::Int32Ty, 0);
+ Value *zero = ConstantInt::get(Type::Int32Ty, 0);
Value *Args[] = { zero, zero };
return CreateGEP(gv, Args, Args+2, Name);
}
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());