diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index b911c3452378..9d9471f11153 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -987,15 +987,15 @@ public: NameStr, InsertAtEnd); } - /// Create an "inbounds" getelementptr. See the documentation for the - /// "inbounds" flag in LangRef.html for details. - static GetElementPtrInst *CreateInBounds(Value *Ptr, - ArrayRef IdxList, - const Twine &NameStr = "", - Instruction *InsertBefore = nullptr){ + LLVM_ATTRIBUTE_DEPRECATED(static GetElementPtrInst *CreateInBounds( + Value *Ptr, ArrayRef 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 IdxList, const Twine &NameStr = "", @@ -1006,10 +1006,10 @@ public: return GEP; } - static GetElementPtrInst *CreateInBounds(Value *Ptr, - ArrayRef IdxList, - const Twine &NameStr, - BasicBlock *InsertAtEnd) { + LLVM_ATTRIBUTE_DEPRECATED(static GetElementPtrInst *CreateInBounds( + Value *Ptr, ArrayRef IdxList, const Twine &NameStr, + BasicBlock *InsertAtEnd), + "Use the version with explicit element type instead") { return CreateInBounds(nullptr, Ptr, IdxList, NameStr, InsertAtEnd); } diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp index a12ef395b00b..e4c0cd70b353 100644 --- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp +++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp @@ -367,8 +367,9 @@ void BPFAbstractMemberAccess::replaceWithGEP(std::vector &CallList, 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(); } diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index 5fae27016729..d18bcd34620c 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -839,9 +839,9 @@ bool VectorCombine::foldSingleElementStore(Instruction &I) { 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(