aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LowerSwitch.cpp
diff options
context:
space:
mode:
authorVasileios Porpodas <vporpodas@google.com>2022-12-12 14:57:47 -0800
committerVasileios Porpodas <vporpodas@google.com>2022-12-12 20:22:55 -0800
commita19ae77d2a9016428fee7cd5af03fd20ad6d4464 (patch)
tree68a8db9ead83aef2289609fac4be9bbf22828a8c /llvm/lib/Transforms/Utils/LowerSwitch.cpp
parent1bf261c89b96df33ed14c6695f5f8590578e825d (diff)
downloadllvm-a19ae77d2a9016428fee7cd5af03fd20ad6d4464.zip
llvm-a19ae77d2a9016428fee7cd5af03fd20ad6d4464.tar.gz
llvm-a19ae77d2a9016428fee7cd5af03fd20ad6d4464.tar.bz2
[IR][NFC] Adds Function::insertBasicBlockAt() to replace things like F->getBasicBlockList().insert()
This is part of a series of patches that aim at making Function::getBasicBlockList() private. Differential Revision: https://reviews.llvm.org/D139906
Diffstat (limited to 'llvm/lib/Transforms/Utils/LowerSwitch.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LowerSwitch.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LowerSwitch.cpp b/llvm/lib/Transforms/Utils/LowerSwitch.cpp
index 4a884af..50fc2f9 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->getBasicBlockList().insert(++OrigBlock->getIterator(), NewLeaf);
+ F->insertBasicBlockAt(++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->getBasicBlockList().insert(++OrigBlock->getIterator(), NewNode);
+ F->insertBasicBlockAt(++OrigBlock->getIterator(), NewNode);
Comp->insertAt(NewNode, NewNode->end());
BranchInst::Create(LBranch, RBranch, Comp, NewNode);