[llvm] f8b5be6 - [IPO] Call *set::insert without checking membership first (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 18 10:37:12 PDT 2022


Author: Kazu Hirata
Date: 2022-06-18T10:37:04-07:00
New Revision: f8b5be64ab46feeebb4aaec6c4a275e47cec23d3

URL: https://github.com/llvm/llvm-project/commit/f8b5be64ab46feeebb4aaec6c4a275e47cec23d3
DIFF: https://github.com/llvm/llvm-project/commit/f8b5be64ab46feeebb4aaec6c4a275e47cec23d3.diff

LOG: [IPO] Call *set::insert without checking membership first (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/IROutliner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 2ecfd5270a5d4..280474a14e746 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -2561,11 +2561,8 @@ static InstructionCost findCostForOutputBlocks(Module &M,
 
     for (Value *V : ID.OperVals) {
       BasicBlock *BB = static_cast<BasicBlock *>(V);
-      DenseSet<BasicBlock *>::iterator CBIt = CandidateBlocks.find(BB);
-      if (CBIt != CandidateBlocks.end() || FoundBlocks.contains(BB))
-        continue;
-      FoundBlocks.insert(BB);
-      NumOutputBranches++;
+      if (!CandidateBlocks.contains(BB) && FoundBlocks.insert(BB).second)
+        NumOutputBranches++;
     }
   }
 


        


More information about the llvm-commits mailing list