NameStr, InsertAtEnd);
}
- /// Create an "inbounds" getelementptr. See the documentation for the
- /// "inbounds" flag in LangRef.html for details.
- static GetElementPtrInst *CreateInBounds(Value *Ptr,
- ArrayRef<Value *> IdxList,
- const Twine &NameStr = "",
- Instruction *InsertBefore = nullptr){
+ LLVM_ATTRIBUTE_DEPRECATED(static GetElementPtrInst *CreateInBounds(
+ Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr = "",
+ Instruction *InsertBefore = nullptr),
+ "Use the version with explicit element type instead") {
return CreateInBounds(nullptr, Ptr, IdxList, NameStr, InsertBefore);
}
+ /// Create an "inbounds" getelementptr. See the documentation for the
+ /// "inbounds" flag in LangRef.html for details.
static GetElementPtrInst *
CreateInBounds(Type *PointeeType, Value *Ptr, ArrayRef<Value *> IdxList,
const Twine &NameStr = "",
return GEP;
}
- static GetElementPtrInst *CreateInBounds(Value *Ptr,
- ArrayRef<Value *> IdxList,
- const Twine &NameStr,
- BasicBlock *InsertAtEnd) {
+ LLVM_ATTRIBUTE_DEPRECATED(static GetElementPtrInst *CreateInBounds(
+ Value *Ptr, ArrayRef<Value *> IdxList, const Twine &NameStr,
+ BasicBlock *InsertAtEnd),
+ "Use the version with explicit element type instead") {
return CreateInBounds(nullptr, Ptr, IdxList, NameStr, InsertAtEnd);
}
IdxList.push_back(Zero);
IdxList.push_back(Call->getArgOperand(GEPIndex));
- auto *GEP = GetElementPtrInst::CreateInBounds(Call->getArgOperand(0),
- IdxList, "", Call);
+ auto *GEP = GetElementPtrInst::CreateInBounds(
+ Call->getArgOperand(0)->getType()->getPointerElementType(),
+ Call->getArgOperand(0), IdxList, "", Call);
Call->replaceAllUsesWith(GEP);
Call->eraseFromParent();
}
MemoryLocation::get(SI), AA))
return false;
- Value *GEP = GetElementPtrInst::CreateInBounds(
- SI->getPointerOperand(), {ConstantInt::get(Idx->getType(), 0), Idx});
- Builder.Insert(GEP);
+ Value *GEP = Builder.CreateInBoundsGEP(
+ SI->getValueOperand()->getType(), SI->getPointerOperand(),
+ {ConstantInt::get(Idx->getType(), 0), Idx});
StoreInst *NSI = Builder.CreateStore(NewElement, GEP);
NSI->copyMetadata(*SI);
Align ScalarOpAlignment = computeAlignmentAfterScalarization(