Skip to content

Commit 3f7aea1

Browse files
committed
[DFAJumpThreading] Use insert return value (NFC)
Rather than find + insert. Also use range based for loop.
1 parent b537c5b commit 3f7aea1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -620,13 +620,9 @@ struct AllSwitchPaths {
620620
// Some blocks have multiple edges to the same successor, and this set
621621
// is used to prevent a duplicate path from being generated
622622
SmallSet<BasicBlock *, 4> Successors;
623-
624-
for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) {
625-
BasicBlock *Succ = *SI;
626-
627-
if (Successors.find(Succ) != Successors.end())
623+
for (BasicBlock *Succ : successors(BB)) {
624+
if (!Successors.insert(Succ).second)
628625
continue;
629-
Successors.insert(Succ);
630626

631627
// Found a cycle through the SwitchBlock
632628
if (Succ == SwitchBlock) {

0 commit comments

Comments
 (0)