[llvm] 3f7aea1 - [DFAJumpThreading] Use insert return value (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 2 12:21:31 PDT 2021
Author: Nikita Popov
Date: 2021-08-02T21:21:21+02:00
New Revision: 3f7aea1a376d2def716113874cd382010f63897f
URL: https://github.com/llvm/llvm-project/commit/3f7aea1a376d2def716113874cd382010f63897f
DIFF: https://github.com/llvm/llvm-project/commit/3f7aea1a376d2def716113874cd382010f63897f.diff
LOG: [DFAJumpThreading] Use insert return value (NFC)
Rather than find + insert. Also use range based for loop.
Added:
Modified:
llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
index 17354401cb83..b252c4229387 100644
--- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
@@ -620,13 +620,9 @@ struct AllSwitchPaths {
// Some blocks have multiple edges to the same successor, and this set
// is used to prevent a duplicate path from being generated
SmallSet<BasicBlock *, 4> Successors;
-
- for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) {
- BasicBlock *Succ = *SI;
-
- if (Successors.find(Succ) != Successors.end())
+ for (BasicBlock *Succ : successors(BB)) {
+ if (!Successors.insert(Succ).second)
continue;
- Successors.insert(Succ);
// Found a cycle through the SwitchBlock
if (Succ == SwitchBlock) {
More information about the llvm-commits
mailing list