aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/IndirectBrExpandPass.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-12-02 21:02:54 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-12-02 21:02:54 +0000
commitf65dcba83ce5035ab88a85fe17628b447eb56e1b (patch)
tree35f37bb72b3cfc6060193e66c76ee7c9478969b0 /llvm/lib/CodeGen/IndirectBrExpandPass.cpp
parent846a2208a8ab099f595fe7e8b2e6d54a7b5e67fb (diff)
Diffstat (limited to 'llvm/lib/CodeGen/IndirectBrExpandPass.cpp')
-rw-r--r--llvm/lib/CodeGen/IndirectBrExpandPass.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/IndirectBrExpandPass.cpp b/llvm/lib/CodeGen/IndirectBrExpandPass.cpp
index e4606daba352..2d38a44d5a33 100644
--- a/llvm/lib/CodeGen/IndirectBrExpandPass.cpp
+++ b/llvm/lib/CodeGen/IndirectBrExpandPass.cpp
@@ -260,10 +260,12 @@ bool IndirectBrExpandPass::runOnFunction(Function &F) {
if (DTU) {
// If there were multiple indirectbr's, they may have common successors,
// but in the dominator tree, we only track unique edges.
- SmallPtrSet<BasicBlock *, 8> UniqueSuccessors(BBs.begin(), BBs.end());
- Updates.reserve(Updates.size() + UniqueSuccessors.size());
- for (BasicBlock *BB : UniqueSuccessors)
- Updates.push_back({DominatorTree::Insert, SwitchBB, BB});
+ SmallPtrSet<BasicBlock *, 8> UniqueSuccessors;
+ Updates.reserve(Updates.size() + BBs.size());
+ for (BasicBlock *BB : BBs) {
+ if (UniqueSuccessors.insert(BB).second)
+ Updates.push_back({DominatorTree::Insert, SwitchBB, BB});
+ }
DTU->applyUpdates(Updates);
}