diff --git a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp index 1dedfb62946904..52bd6da1d3ae58 100644 --- a/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp +++ b/llvm/lib/Target/BPF/BPFAbstractMemberAccess.cpp @@ -107,7 +107,7 @@ Instruction *BPFCoreSharedInfo::insertPassThrough(Module *M, BasicBlock *BB, BPFCoreSharedInfo::SeqNum++); auto *NewInst = CallInst::Create(Fn, {SeqNumVal, Input}); - BB->getInstList().insert(Before->getIterator(), NewInst); + NewInst->insertBefore(Before); return NewInst; } } // namespace llvm @@ -1135,16 +1135,16 @@ bool BPFAbstractMemberAccess::transformGEPChain(CallInst *Call, // Generate a BitCast auto *BCInst = new BitCastInst(Base, Type::getInt8PtrTy(BB->getContext())); - BB->getInstList().insert(Call->getIterator(), BCInst); + BCInst->insertBefore(Call); // Generate a GetElementPtr auto *GEP = GetElementPtrInst::Create(Type::getInt8Ty(BB->getContext()), BCInst, LDInst); - BB->getInstList().insert(Call->getIterator(), GEP); + GEP->insertBefore(Call); // Generate a BitCast auto *BCInst2 = new BitCastInst(GEP, Call->getType()); - BB->getInstList().insert(Call->getIterator(), BCInst2); + BCInst2->insertBefore(Call); // For the following code, // Block0: diff --git a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp index 98f8d59fbe0133..e109235434e9d8 100644 --- a/llvm/lib/Target/BPF/BPFAdjustOpt.cpp +++ b/llvm/lib/Target/BPF/BPFAdjustOpt.cpp @@ -146,7 +146,7 @@ bool BPFAdjustOptImpl::adjustICmpToBuiltin() { Function *Fn = Intrinsic::getDeclaration( M, Intrinsic::bpf_compare, {Op0->getType(), ConstOp1->getType()}); auto *NewInst = CallInst::Create(Fn, {Opcode, Op0, ConstOp1}); - BB.getInstList().insert(I.getIterator(), NewInst); + NewInst->insertBefore(&I); Icmp->replaceAllUsesWith(NewInst); Changed = true; ToBeDeleted = Icmp; diff --git a/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp b/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp index cf1bc3f7c5bc03..6b74e56d6b3e9b 100644 --- a/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp +++ b/llvm/lib/Target/BPF/BPFCheckAndAdjustIR.cpp @@ -153,7 +153,7 @@ bool BPFCheckAndAdjustIR::removeCompareBuiltin(Module &M) { CmpInst::Predicate Opcode = (CmpInst::Predicate)OpVal; auto *ICmp = new ICmpInst(Opcode, Arg1, Arg2); - BB.getInstList().insert(Call->getIterator(), ICmp); + ICmp->insertBefore(Call); Call->replaceAllUsesWith(ICmp); ToBeDeleted = Call; diff --git a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp index 4811958409d268..cdb2d134d08d6d 100644 --- a/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp +++ b/llvm/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp @@ -522,7 +522,7 @@ void Simplifier::Context::link(Instruction *I, BasicBlock *B, link(OpI, B, At); } - B->getInstList().insert(At, I); + I->insertAt(B, At); } Value *Simplifier::Context::materialize(BasicBlock *B, diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp index 2a4349e02f1b7d..064890cf89eab1 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp @@ -141,7 +141,7 @@ static Function *createWrapper(Function *F, FunctionType *Ty) { if (CastInst::isBitOrNoopPointerCastable(ArgType, ParamType, DL)) { Instruction *PtrCast = CastInst::CreateBitOrPointerCast(AI, ParamType, "cast"); - BB->getInstList().push_back(PtrCast); + PtrCast->insertAt(BB, BB->end()); Args.push_back(PtrCast); } else if (ArgType->isStructTy() || ParamType->isStructTy()) { LLVM_DEBUG(dbgs() << "createWrapper: struct param type in bitcast: " @@ -181,7 +181,7 @@ static Function *createWrapper(Function *F, FunctionType *Ty) { DL)) { Instruction *Cast = CastInst::CreateBitOrPointerCast(Call, RtnType, "cast"); - BB->getInstList().push_back(Cast); + Cast->insertAt(BB, BB->end()); ReturnInst::Create(M->getContext(), Cast, BB); } else if (RtnType->isStructTy() || ExpectedRtnType->isStructTy()) { LLVM_DEBUG(dbgs() << "createWrapper: struct return type in bitcast: " diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp index 7eca7d9ea870b1..478e235175f002 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp @@ -1630,7 +1630,7 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForEmscriptenSjLj( // Create switch instruction IRB.SetInsertPoint(EndBB); - IRB.SetCurrentDebugLocation(EndBB->getInstList().back().getDebugLoc()); + IRB.SetCurrentDebugLocation(EndBB->back().getDebugLoc()); SwitchInst *SI = IRB.CreateSwitch(Label, Tail, SetjmpRetPHIs.size()); // -1 means no longjmp happened, continue normally (will hit the default // switch case). 0 means a longjmp that is not ours to handle, needs a