diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -3326,7 +3326,7 @@ // Move the block to the end of the function. Forward ref'd blocks are // inserted wherever they happen to be referenced. - F.getBasicBlockList().splice(F.end(), F.getBasicBlockList(), BB); + F.splice(F.end(), &F, BB->getIterator()); // Remove the block from forward ref sets. if (Name.empty()) { diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -134,14 +134,13 @@ } void BasicBlock::moveBefore(BasicBlock *MovePos) { - MovePos->getParent()->getBasicBlockList().splice( - MovePos->getIterator(), getParent()->getBasicBlockList(), getIterator()); + MovePos->getParent()->splice(MovePos->getIterator(), getParent(), + getIterator()); } void BasicBlock::moveAfter(BasicBlock *MovePos) { - MovePos->getParent()->getBasicBlockList().splice( - ++MovePos->getIterator(), getParent()->getBasicBlockList(), - getIterator()); + MovePos->getParent()->splice(++MovePos->getIterator(), getParent(), + getIterator()); } const Module *BasicBlock::getModule() const { diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1120,7 +1120,7 @@ // Steal arguments and splice the body of Src into Dst. Dst.stealArgumentListFrom(Src); - Dst.getBasicBlockList().splice(Dst.end(), Src.getBasicBlockList()); + Dst.splice(Dst.end(), &Src); // Everything has been moved over. Remap it. Mapper.scheduleRemapFunction(Dst); diff --git a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp @@ -332,7 +332,7 @@ // Move the body of the function into the new rewritten function, and replace // this function with a stub. - NewFunc->getBasicBlockList().splice(NewFunc->begin(), F.getBasicBlockList()); + NewFunc->splice(NewFunc->begin(), &F); for (std::pair &Replacement : Replacements) { ReturnInst *RI = Replacement.first; diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp --- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp +++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp @@ -300,7 +300,7 @@ // Since we have now created the new function, splice the body of the old // function right into the new function, leaving the old rotting hulk of the // function empty. - NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); + NF->splice(NF->begin(), F); // We will collect all the new created allocas to promote them into registers // after the following loop diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -2686,8 +2686,7 @@ // Since we have now created the new function, splice the body of the old // function right into the new function, leaving the old rotting hulk of the // function empty. - NewFn->getBasicBlockList().splice(NewFn->begin(), - OldFn->getBasicBlockList()); + NewFn->splice(NewFn->begin(), OldFn); // Fixup block addresses to reference new function. SmallVector BlockAddresses; diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -222,7 +222,7 @@ // Since we have now created the new function, splice the body of the old // function right into the new function, leaving the old rotting hulk of the // function empty. - NF->getBasicBlockList().splice(NF->begin(), F.getBasicBlockList()); + NF->splice(NF->begin(), &F); // Loop over the argument list, transferring uses of the old arguments over to // the new arguments, also transferring over the names as well. While we're @@ -996,7 +996,7 @@ // Since we have now created the new function, splice the body of the old // function right into the new function, leaving the old rotting hulk of the // function empty. - NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); + NF->splice(NF->begin(), F); // Loop over the argument list, transferring uses of the old arguments over to // the new arguments, also transferring over the names as well. diff --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp --- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp +++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp @@ -1790,9 +1790,8 @@ // Place the cloned blocks right after the original blocks (right before the // exit block of.) if (ExitBlock) - F.getBasicBlockList().splice(ExitBlock->getIterator(), - F.getBasicBlockList(), - NewBlocks[0]->getIterator(), F.end()); + F.splice(ExitBlock->getIterator(), &F, NewBlocks[0]->getIterator(), + F.end()); // Update the cloned blocks/instructions to refer to themselves. for (BasicBlock *NewBB : NewBlocks) diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -1013,10 +1013,9 @@ } // Move them physically from the end of the block list. - F->getBasicBlockList().splice(Before->getIterator(), F->getBasicBlockList(), - NewPH); - F->getBasicBlockList().splice(Before->getIterator(), F->getBasicBlockList(), - NewLoop->getHeader()->getIterator(), F->end()); + F->splice(Before->getIterator(), F, NewPH->getIterator()); + F->splice(Before->getIterator(), F, NewLoop->getHeader()->getIterator(), + F->end()); return NewLoop; } diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -2834,9 +2834,8 @@ // Now that the function is correct, make it a little bit nicer. In // particular, move the basic blocks inserted from the end of the function // into the space made by splitting the source basic block. - Caller->getBasicBlockList().splice(AfterCallBB->getIterator(), - Caller->getBasicBlockList(), FirstNewBlock, - Caller->end()); + Caller->splice(AfterCallBB->getIterator(), Caller, FirstNewBlock, + Caller->end()); // Handle all of the return instructions that we just cloned in, and eliminate // any users of the original call/invoke instruction. diff --git a/llvm/lib/Transforms/Utils/LoopPeel.cpp b/llvm/lib/Transforms/Utils/LoopPeel.cpp --- a/llvm/lib/Transforms/Utils/LoopPeel.cpp +++ b/llvm/lib/Transforms/Utils/LoopPeel.cpp @@ -998,9 +998,8 @@ InsertBot = SplitBlock(InsertBot, InsertBot->getTerminator(), &DT, LI); InsertBot->setName(Header->getName() + ".peel.next"); - F->getBasicBlockList().splice(InsertTop->getIterator(), - F->getBasicBlockList(), - NewBlocks[0]->getIterator(), F->end()); + F->splice(InsertTop->getIterator(), F, NewBlocks[0]->getIterator(), + F->end()); } // Now adjust the phi nodes in the loop header to get their initial values diff --git a/llvm/lib/Transforms/Utils/LoopSimplify.cpp b/llvm/lib/Transforms/Utils/LoopSimplify.cpp --- a/llvm/lib/Transforms/Utils/LoopSimplify.cpp +++ b/llvm/lib/Transforms/Utils/LoopSimplify.cpp @@ -392,7 +392,7 @@ // Move the new backedge block to right after the last backedge block. Function::iterator InsertPos = ++BackedgeBlocks.back()->getIterator(); - F->getBasicBlockList().splice(InsertPos, F->getBasicBlockList(), BEBlock); + F->splice(InsertPos, F, BEBlock->getIterator()); // Now that the block has been inserted into the function, create PHI nodes in // the backedge block which correspond to any PHI nodes in the header block. diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -812,10 +812,7 @@ updateLatchBranchWeightsForRemainderLoop(L, remainderLoop, Count); // Insert the cloned blocks into the function. - F->getBasicBlockList().splice(InsertBot->getIterator(), - F->getBasicBlockList(), - NewBlocks[0]->getIterator(), - F->end()); + F->splice(InsertBot->getIterator(), F, NewBlocks[0]->getIterator(), F->end()); // Now the loop blocks are cloned and the other exiting blocks from the // remainder are connected to the original Loop's exit blocks. The remaining diff --git a/llvm/unittests/Analysis/LazyCallGraphTest.cpp b/llvm/unittests/Analysis/LazyCallGraphTest.cpp --- a/llvm/unittests/Analysis/LazyCallGraphTest.cpp +++ b/llvm/unittests/Analysis/LazyCallGraphTest.cpp @@ -2079,7 +2079,7 @@ D.replaceAllUsesWith(&E); // Splice the body of the old function into the new one. - E.getBasicBlockList().splice(E.begin(), D.getBasicBlockList()); + E.splice(E.begin(), &D); // And fix up the one argument. D.arg_begin()->replaceAllUsesWith(&*E.arg_begin()); E.arg_begin()->takeName(&*D.arg_begin());