summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/MemCpyOptimizer.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-13 21:58:54 +0000
committerOwen Anderson <resistor@mac.com>2009-08-13 21:58:54 +0000
commit1d0be15f89cb5056e20e2d24faa8d6afb1573bca (patch)
tree2cdabe223bfce83bd12e10dd557147a2f68c9bf8 /lib/Transforms/Scalar/MemCpyOptimizer.cpp
parentd163e8b14c8aa5bbbb129e3f0dffdbe7213a3c72 (diff)
downloadexternal_llvm-1d0be15f89cb5056e20e2d24faa8d6afb1573bca.zip
external_llvm-1d0be15f89cb5056e20e2d24faa8d6afb1573bca.tar.gz
external_llvm-1d0be15f89cb5056e20e2d24faa8d6afb1573bca.tar.bz2
Push LLVMContexts through the IntegerType APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/MemCpyOptimizer.cpp')
-rw-r--r--lib/Transforms/Scalar/MemCpyOptimizer.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 224a136..1c8badc 100644
--- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp
@@ -38,15 +38,15 @@ STATISTIC(NumMemSetInfer, "Number of memsets inferred");
/// byte store (e.g. i16 0x1234), return null.
static Value *isBytewiseValue(Value *V, LLVMContext& Context) {
// All byte-wide stores are splatable, even of arbitrary variables.
- if (V->getType() == Type::Int8Ty) return V;
+ if (V->getType() == Type::getInt8Ty(Context)) return V;
// Constant float and double values can be handled as integer values if the
// corresponding integer value is "byteable". An important case is 0.0.
if (ConstantFP *CFP = dyn_cast<ConstantFP>(V)) {
- if (CFP->getType() == Type::FloatTy)
- V = ConstantExpr::getBitCast(CFP, Type::Int32Ty);
- if (CFP->getType() == Type::DoubleTy)
- V = ConstantExpr::getBitCast(CFP, Type::Int64Ty);
+ if (CFP->getType() == Type::getFloatTy(Context))
+ V = ConstantExpr::getBitCast(CFP, Type::getInt32Ty(Context));
+ if (CFP->getType() == Type::getDoubleTy(Context))
+ V = ConstantExpr::getBitCast(CFP, Type::getInt64Ty(Context));
// Don't handle long double formats, which have strange constraints.
}
@@ -431,7 +431,7 @@ bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator& BBI) {
BasicBlock::iterator InsertPt = BI;
if (MemSetF == 0) {
- const Type *Tys[] = {Type::Int64Ty};
+ const Type *Tys[] = {Type::getInt64Ty(SI->getContext())};
MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset,
Tys, 1);
}
@@ -440,7 +440,8 @@ bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator& BBI) {
StartPtr = Range.StartPtr;
// Cast the start ptr to be i8* as memset requires.
- const Type *i8Ptr = PointerType::getUnqual(Type::Int8Ty);
+ const Type *i8Ptr =
+ PointerType::getUnqual(Type::getInt8Ty(SI->getContext()));
if (StartPtr->getType() != i8Ptr)
StartPtr = new BitCastInst(StartPtr, i8Ptr, StartPtr->getName(),
InsertPt);
@@ -448,9 +449,10 @@ bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator& BBI) {
Value *Ops[] = {
StartPtr, ByteVal, // Start, value
// size
- ConstantInt::get(Type::Int64Ty, Range.End-Range.Start),
+ ConstantInt::get(Type::getInt64Ty(SI->getContext()),
+ Range.End-Range.Start),
// align
- ConstantInt::get(Type::Int32Ty, Range.Alignment)
+ ConstantInt::get(Type::getInt32Ty(SI->getContext()), Range.Alignment)
};
Value *C = CallInst::Create(MemSetF, Ops, Ops+4, "", InsertPt);
DEBUG(cerr << "Replace stores:\n";