diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index f3264cf87552..f0e1d97b2676 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -574,9 +574,9 @@ void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) { // Place the block after the current block, if possible, or else at // the end of the function. if (CurBB && CurBB->getParent()) - CurFn->insertBasicBlockAt(std::next(CurBB->getIterator()), BB); + CurFn->insert(std::next(CurBB->getIterator()), BB); else - CurFn->insertBasicBlockAt(CurFn->end(), BB); + CurFn->insert(CurFn->end(), BB); Builder.SetInsertPoint(BB); } @@ -601,15 +601,14 @@ void CodeGenFunction::EmitBlockAfterUses(llvm::BasicBlock *block) { bool inserted = false; for (llvm::User *u : block->users()) { if (llvm::Instruction *insn = dyn_cast(u)) { - CurFn->insertBasicBlockAt(std::next(insn->getParent()->getIterator()), - block); + CurFn->insert(std::next(insn->getParent()->getIterator()), block); inserted = true; break; } } if (!inserted) - CurFn->insertBasicBlockAt(CurFn->end(), block); + CurFn->insert(CurFn->end(), block); Builder.SetInsertPoint(block); } @@ -1469,7 +1468,7 @@ void CodeGenFunction::EmitCaseStmtRange(const CaseStmt &S, llvm::BasicBlock *FalseDest = CaseRangeBlock; CaseRangeBlock = createBasicBlock("sw.caserange"); - CurFn->insertBasicBlockAt(CurFn->end(), CaseRangeBlock); + CurFn->insert(CurFn->end(), CaseRangeBlock); Builder.SetInsertPoint(CaseRangeBlock); // Emit range check. diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 09dc638a2ac3..ad5ffece8cae 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -320,7 +320,7 @@ llvm::DebugLoc CodeGenFunction::EmitReturnBlock() { static void EmitIfUsed(CodeGenFunction &CGF, llvm::BasicBlock *BB) { if (!BB) return; if (!BB->use_empty()) { - CGF.CurFn->insertBasicBlockAt(CGF.CurFn->end(), BB); + CGF.CurFn->insert(CGF.CurFn->end(), BB); return; } delete BB; diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp index 1f0036922b67..e29de191515a 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp @@ -863,7 +863,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -875,7 +875,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp index 1f0036922b67..e29de191515a 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp @@ -863,7 +863,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -875,7 +875,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp index 1f0036922b67..e29de191515a 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp @@ -863,7 +863,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -875,7 +875,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp index f81dac35088b..09f8ec86eb99 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp @@ -846,7 +846,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -858,7 +858,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp index 1c5416f73a6f..51420a972aa0 100644 --- a/llvm/examples/Kaleidoscope/Chapter5/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter5/toy.cpp @@ -650,7 +650,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -662,7 +662,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp index 2782f23177fa..4ebae0f307d9 100644 --- a/llvm/examples/Kaleidoscope/Chapter6/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter6/toy.cpp @@ -762,7 +762,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -774,7 +774,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp index 2c9c3bc44a94..c106c5a8160f 100644 --- a/llvm/examples/Kaleidoscope/Chapter7/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter7/toy.cpp @@ -869,7 +869,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -881,7 +881,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp index 67d9be3aef0b..ff3801eebb77 100644 --- a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp @@ -867,7 +867,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -879,7 +879,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp index 38492474a314..e579371ee533 100644 --- a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp @@ -1037,7 +1037,7 @@ Value *IfExprAST::codegen() { ThenBB = Builder->GetInsertBlock(); // Emit else block. - TheFunction->insertBasicBlockAt(TheFunction->end(), ElseBB); + TheFunction->insert(TheFunction->end(), ElseBB); Builder->SetInsertPoint(ElseBB); Value *ElseV = Else->codegen(); @@ -1049,7 +1049,7 @@ Value *IfExprAST::codegen() { ElseBB = Builder->GetInsertBlock(); // Emit merge block. - TheFunction->insertBasicBlockAt(TheFunction->end(), MergeBB); + TheFunction->insert(TheFunction->end(), MergeBB); Builder->SetInsertPoint(MergeBB); PHINode *PN = Builder->CreatePHI(Type::getDoubleTy(*TheContext), 2, "iftmp"); diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index 995f797e2ec3..8d0f318cf56a 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -689,7 +689,7 @@ public: /// Insert \p BB in the basic block list at \p Position. \Returns an iterator /// to the newly inserted BB. - Function::iterator insertBasicBlockAt(Function::iterator Position, BasicBlock *BB) { + Function::iterator insert(Function::iterator Position, BasicBlock *BB) { return BasicBlocks.insert(Position, BB); } @@ -722,6 +722,9 @@ public: /// Get the underlying elements of the Function... the basic block list is /// empty for external functions. /// + /// This is deliberately private because we have implemented an adequate set + /// of functions to modify the list, including Function::splice(), + /// Function::erase(), Function::insert() etc. const BasicBlockListType &getBasicBlockList() const { return BasicBlocks; } BasicBlockListType &getBasicBlockList() { return BasicBlocks; } diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp index 8be2b6647cce..29d3e96fd283 100644 --- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp +++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp @@ -3617,7 +3617,7 @@ OpenMPIRBuilder::InsertPointTy OpenMPIRBuilder::emitCommonDirectiveEntry( // Emit thenBB and set the Builder's insertion point there for // body generation next. Place the block after the current block. Function *CurFn = EntryBB->getParent(); - CurFn->insertBasicBlockAt(std::next(EntryBB->getIterator()), ThenBB); + CurFn->insert(std::next(EntryBB->getIterator()), ThenBB); // Move Entry branch to end of ThenBB, and replace with conditional // branch (If-stmt) diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index 273a31fa9069..63d363e2d082 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -62,9 +62,9 @@ void BasicBlock::insertInto(Function *NewParent, BasicBlock *InsertBefore) { assert(!Parent && "Already has a parent"); if (InsertBefore) - NewParent->insertBasicBlockAt(InsertBefore->getIterator(), this); + NewParent->insert(InsertBefore->getIterator(), this); else - NewParent->insertBasicBlockAt(NewParent->end(), this); + NewParent->insert(NewParent->end(), this); } BasicBlock::~BasicBlock() { diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp index d642d415e7f8..7a34684db425 100644 --- a/llvm/lib/IR/Core.cpp +++ b/llvm/lib/IR/Core.cpp @@ -2655,14 +2655,12 @@ void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder, BasicBlock *ToInsert = unwrap(BB); BasicBlock *CurBB = unwrap(Builder)->GetInsertBlock(); assert(CurBB && "current insertion point is invalid!"); - CurBB->getParent()->insertBasicBlockAt(std::next(CurBB->getIterator()), - ToInsert); + CurBB->getParent()->insert(std::next(CurBB->getIterator()), ToInsert); } void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB) { - unwrap(Fn)->insertBasicBlockAt(unwrap(Fn)->end(), - unwrap(BB)); + unwrap(Fn)->insert(unwrap(Fn)->end(), unwrap(BB)); } LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, diff --git a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp index 20a26b557a6c..ddb35756030f 100644 --- a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp +++ b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp @@ -179,7 +179,7 @@ llvm::SplitKnownCriticalEdge(Instruction *TI, unsigned SuccNum, // Insert the block into the function... right after the block TI lives in. Function &F = *TIBB->getParent(); Function::iterator FBBI = TIBB->getIterator(); - F.insertBasicBlockAt(++FBBI, NewBB); + F.insert(++FBBI, NewBB); // Branch to the new block, breaking the edge. TI->setSuccessor(SuccNum, NewBB); diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 1e0400a409e9..c6c864e46194 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -670,7 +670,7 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc, continue; // Dead block. // Add the new block to the new function. - NewFunc->insertBasicBlockAt(NewFunc->end(), NewBB); + NewFunc->insert(NewFunc->end(), NewBB); // Handle PHI nodes specially, as we have to remove references to dead // blocks. diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index 67428b6e3490..f07220aadb94 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -999,7 +999,7 @@ Function *CodeExtractor::constructFunction(const ValueSet &inputs, newFunction->addFnAttr(Attr); } - newFunction->insertBasicBlockAt(newFunction->end(), newRootNode); + newFunction->insert(newFunction->end(), newRootNode); // Create scalar and aggregate iterators to name all of the arguments we // inserted. @@ -1445,7 +1445,7 @@ void CodeExtractor::moveCodeToFunction(Function *newFunction) { // for the new function. The entry block may be followed // by a set of exit blocks at this point, but these exit // blocks better be placed at the end of the new function. - newFuncIt = newFunction->insertBasicBlockAt(std::next(newFuncIt), Block); + newFuncIt = newFunction->insert(std::next(newFuncIt), Block); } } diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index bc577013748d..9fe530b4c2b3 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -539,7 +539,7 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI, for (LoopBlocksDFS::RPOIterator BB = BlockBegin; BB != BlockEnd; ++BB) { ValueToValueMapTy VMap; BasicBlock *New = CloneBasicBlock(*BB, VMap, "." + Twine(It)); - Header->getParent()->insertBasicBlockAt(BlockInsertPt, New); + Header->getParent()->insert(BlockInsertPt, New); assert((*BB != Header || LI->getLoopFor(*BB) == L) && "Header should not be in a sub-loop"); diff --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp index d854f669d96a..47d46c4c0bd5 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp @@ -374,7 +374,7 @@ llvm::UnrollAndJamLoop(Loop *L, unsigned Count, unsigned TripCount, for (LoopBlocksDFS::RPOIterator BB = BlockBegin; BB != BlockEnd; ++BB) { ValueToValueMapTy VMap; BasicBlock *New = CloneBasicBlock(*BB, VMap, "." + Twine(It)); - Header->getParent()->insertBasicBlockAt(Header->getParent()->end(), New); + Header->getParent()->insert(Header->getParent()->end(), New); // Tell LI about New. addClonedBlockToLoopInfo(*BB, New, LI, NewLoops); diff --git a/llvm/lib/Transforms/Utils/LowerSwitch.cpp b/llvm/lib/Transforms/Utils/LowerSwitch.cpp index 50fc2f99045b..36d3de3bf161 100644 --- a/llvm/lib/Transforms/Utils/LowerSwitch.cpp +++ b/llvm/lib/Transforms/Utils/LowerSwitch.cpp @@ -160,7 +160,7 @@ BasicBlock *NewLeafBlock(CaseRange &Leaf, Value *Val, ConstantInt *LowerBound, BasicBlock *Default) { Function *F = OrigBlock->getParent(); BasicBlock *NewLeaf = BasicBlock::Create(Val->getContext(), "LeafBlock"); - F->insertBasicBlockAt(++OrigBlock->getIterator(), NewLeaf); + F->insert(++OrigBlock->getIterator(), NewLeaf); // Emit comparison ICmpInst *Comp = nullptr; @@ -300,7 +300,7 @@ BasicBlock *SwitchConvert(CaseItr Begin, CaseItr End, ConstantInt *LowerBound, SwitchConvert(RHS.begin(), RHS.end(), NewLowerBound, UpperBound, Val, NewNode, OrigBlock, Default, UnreachableRanges); - F->insertBasicBlockAt(++OrigBlock->getIterator(), NewNode); + F->insert(++OrigBlock->getIterator(), NewNode); Comp->insertAt(NewNode, NewNode->end()); BranchInst::Create(LBranch, RBranch, Comp, NewNode); diff --git a/llvm/unittests/IR/FunctionTest.cpp b/llvm/unittests/IR/FunctionTest.cpp index d53578b38186..8e77dfbb9dbd 100644 --- a/llvm/unittests/IR/FunctionTest.cpp +++ b/llvm/unittests/IR/FunctionTest.cpp @@ -206,34 +206,34 @@ bar_bb2: // Insert foo_bb0 into bar() at the very top. FooBB0->removeFromParent(); - auto It = BarF->insertBasicBlockAt(BarF->begin(), FooBB0); + auto It = BarF->insert(BarF->begin(), FooBB0); EXPECT_EQ(BarBB0->getPrevNode(), FooBB0); EXPECT_EQ(It, FooBB0->getIterator()); // Insert foo_bb0 into bar() at the very end. FooBB0->removeFromParent(); - It = BarF->insertBasicBlockAt(BarF->end(), FooBB0); + It = BarF->insert(BarF->end(), FooBB0); EXPECT_EQ(FooBB0->getPrevNode(), BarBB2); EXPECT_EQ(FooBB0->getNextNode(), nullptr); EXPECT_EQ(It, FooBB0->getIterator()); // Insert foo_bb0 into bar() just before bar_bb0. FooBB0->removeFromParent(); - It = BarF->insertBasicBlockAt(BarBB0->getIterator(), FooBB0); + It = BarF->insert(BarBB0->getIterator(), FooBB0); EXPECT_EQ(FooBB0->getPrevNode(), nullptr); EXPECT_EQ(FooBB0->getNextNode(), BarBB0); EXPECT_EQ(It, FooBB0->getIterator()); // Insert foo_bb0 into bar() just before bar_bb1. FooBB0->removeFromParent(); - It = BarF->insertBasicBlockAt(BarBB1->getIterator(), FooBB0); + It = BarF->insert(BarBB1->getIterator(), FooBB0); EXPECT_EQ(FooBB0->getPrevNode(), BarBB0); EXPECT_EQ(FooBB0->getNextNode(), BarBB1); EXPECT_EQ(It, FooBB0->getIterator()); // Insert foo_bb0 into bar() just before bar_bb2. FooBB0->removeFromParent(); - It = BarF->insertBasicBlockAt(BarBB2->getIterator(), FooBB0); + It = BarF->insert(BarBB2->getIterator(), FooBB0); EXPECT_EQ(FooBB0->getPrevNode(), BarBB1); EXPECT_EQ(FooBB0->getNextNode(), BarBB2); EXPECT_EQ(It, FooBB0->getIterator());