if (Val != Val2)
return 0;
}
- return Context.getConstantInt(Val);
+ return ConstantInt::get(Context, Val);
}
}
TargetData &TD = getAnalysis<TargetData>();
AliasAnalysis &AA = getAnalysis<AliasAnalysis>();
+ LLVMContext &Context = SI->getContext();
+ Module *M = SI->getParent()->getParent()->getParent();
// Okay, so we now have a single store that can be splatable. Scan to find
// all subsequent stores of the same value to offset from the same pointer.
if (MemSetF == 0) {
const Type *Tys[] = {Type::Int64Ty};
- MemSetF = Intrinsic::getDeclaration(SI->getParent()->getParent()
- ->getParent(), Intrinsic::memset,
+ MemSetF = Intrinsic::getDeclaration(M, Intrinsic::memset,
Tys, 1);
}
StartPtr = Range.StartPtr;
// Cast the start ptr to be i8* as memset requires.
- const Type *i8Ptr = SI->getContext().getPointerTypeUnqual(Type::Int8Ty);
+ const Type *i8Ptr = Context.getPointerTypeUnqual(Type::Int8Ty);
if (StartPtr->getType() != i8Ptr)
- StartPtr = new BitCastInst(StartPtr, i8Ptr, StartPtr->getNameStart(),
+ StartPtr = new BitCastInst(StartPtr, i8Ptr, StartPtr->getName(),
InsertPt);
Value *Ops[] = {
StartPtr, ByteVal, // Start, value
// size
- SI->getContext().getConstantInt(Type::Int64Ty, Range.End-Range.Start),
+ ConstantInt::get(Type::Int64Ty, Range.End-Range.Start),
// align
- SI->getContext().getConstantInt(Type::Int32Ty, Range.Alignment)
+ ConstantInt::get(Type::Int32Ty, Range.Alignment)
};
Value *C = CallInst::Create(MemSetF, Ops, Ops+4, "", InsertPt);
DEBUG(cerr << "Replace stores:\n";