]> granicus.if.org Git - clang/commitdiff
Reduce double set lookups. NFC.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Oct 2014 15:32:48 +0000 (15:32 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Oct 2014 15:32:48 +0000 (15:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219504 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/VTableBuilder.cpp
lib/CodeGen/CGOpenMPRuntime.cpp
lib/Frontend/SerializedDiagnosticPrinter.cpp
lib/Sema/SemaOpenMP.cpp
lib/StaticAnalyzer/Core/ExplodedGraph.cpp

index 7007c9593dd2eea2ac1285b6654e254f62c40253..43a0fb7d7555cb3dde7dc8626e5fb17f59a8eff9 100644 (file)
@@ -3302,9 +3302,8 @@ findPathForVPtr(ASTContext &Context, const ASTRecordLayout &MostDerivedLayout,
     if (!B.isVirtual())
       NewOffset = Offset + Layout.getBaseClassOffset(Base);
     else {
-      if (VBasesSeen.count(Base))
+      if (!VBasesSeen.insert(Base))
         return false;
-      VBasesSeen.insert(Base);
       NewOffset = MostDerivedLayout.getVBaseClassOffset(Base);
     }
     FullPath.push_back(Base);
index 08b2dad1022fce6f42e04cf4c3edf93b98a86754..b3e5c1123ce2ab30eebbe9e13d5692a7640a4b82 100644 (file)
@@ -232,8 +232,7 @@ llvm::Value *CGOpenMPRuntime::GetOpenMPThreadID(CodeGenFunction &CGF,
 
 void CGOpenMPRuntime::FunctionFinished(CodeGenFunction &CGF) {
   assert(CGF.CurFn && "No function in current CodeGenFunction.");
-  if (OpenMPLocThreadIDMap.count(CGF.CurFn))
-    OpenMPLocThreadIDMap.erase(CGF.CurFn);
+  OpenMPLocThreadIDMap.erase(CGF.CurFn);
 }
 
 llvm::Type *CGOpenMPRuntime::getIdentTyPointerTy() {
index 15f78d25259ec1264d90f769aa67e2c8916ca923..3d6e7578c78d805c3f1dba1ed088c4874b27b48f 100644 (file)
@@ -472,11 +472,9 @@ void SDiagsWriter::EmitMetaBlock() {
 }
 
 unsigned SDiagsWriter::getEmitCategory(unsigned int category) {
-  if (State->Categories.count(category))
+  if (!State->Categories.insert(category).second)
     return category;
-  
-  State->Categories.insert(category);
-  
+
   // We use a local version of 'Record' so that we can be generating
   // another record when we lazily generate one for the category entry.
   RecordData Record;
index 6e43a3d4b264606791bbf75cb7c4b41905b6f98f..23f5f13e8fdca8199ad05652c2271c6e759748f2 100644 (file)
@@ -2483,8 +2483,7 @@ static bool CheckOpenMPIterationSpace(
   // that is the increment of the associated for-loop.
   // Exclude loop var from the list of variables with implicitly defined data
   // sharing attributes.
-  while (VarsWithImplicitDSA.count(Var) > 0)
-    VarsWithImplicitDSA.erase(Var);
+  VarsWithImplicitDSA.erase(Var);
 
   // OpenMP [2.14.1.1, Data-sharing Attribute Rules for Variables Referenced in
   // a Construct, C/C++].
index c0bc902c490f7dcacda1b5126df1c4b86888e09e..010d26e48e1df3159d8effa264253a14c8115241 100644 (file)
@@ -365,12 +365,9 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
     const ExplodedNode *N = WL1.pop_back_val();
 
     // Have we already visited this node?  If so, continue to the next one.
-    if (Pass1.count(N))
+    if (!Pass1.insert(N).second)
       continue;
 
-    // Otherwise, mark this node as visited.
-    Pass1.insert(N);
-
     // If this is a root enqueue it to the second worklist.
     if (N->Preds.empty()) {
       WL2.push_back(N);
@@ -378,9 +375,7 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
     }
 
     // Visit our predecessors and enqueue them.
-    for (ExplodedNode::pred_iterator I = N->Preds.begin(), E = N->Preds.end();
-         I != E; ++I)
-      WL1.push_back(*I);
+    WL1.append(N->Preds.begin(), N->Preds.end());
   }
 
   // We didn't hit a root? Return with a null pointer for the new graph.