[llvm] r230798 - Reduce double set lookups.
Benjamin Kramer
benny.kra at GOOGLEMAIL.com
Fri Feb 27 13:43:15 PST 2015
Author: d0k
Date: Fri Feb 27 15:43:14 2015
New Revision: 230798
URL: http://llvm.org/viewvc/llvm-project?rev=230798&view=rev
Log:
Reduce double set lookups.
Modified:
llvm/trunk/include/llvm/ADT/DepthFirstIterator.h
llvm/trunk/lib/Analysis/LazyValueInfo.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
Modified: llvm/trunk/include/llvm/ADT/DepthFirstIterator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DepthFirstIterator.h?rev=230798&r1=230797&r2=230798&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DepthFirstIterator.h (original)
+++ llvm/trunk/include/llvm/ADT/DepthFirstIterator.h Fri Feb 27 15:43:14 2015
@@ -113,9 +113,8 @@ private:
while (It != GT::child_end(Node)) {
NodeType *Next = *It++;
// Has our next sibling been visited?
- if (Next && !this->Visited.count(Next)) {
+ if (Next && this->Visited.insert(Next).second) {
// No, do it now.
- this->Visited.insert(Next);
VisitStack.push_back(std::make_pair(PointerIntTy(Next, 0),
GT::child_begin(Next)));
return;
Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=230798&r1=230797&r2=230798&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Fri Feb 27 15:43:14 2015
@@ -346,11 +346,10 @@ namespace {
/// Push BV onto BlockValueStack unless it's already in there.
/// Returns true on success.
bool pushBlockValue(const std::pair<BasicBlock *, Value *> &BV) {
- if (BlockValueSet.count(BV))
+ if (!BlockValueSet.insert(BV).second)
return false; // It's already in the stack.
BlockValueStack.push(BV);
- BlockValueSet.insert(BV);
return true;
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=230798&r1=230797&r2=230798&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Fri Feb 27 15:43:14 2015
@@ -622,8 +622,7 @@ public:
void removeValue(const Value *V) {
// This is to support hack in lowerCallFromStatepoint
// Should be removed when hack is resolved
- if (NodeMap.count(V))
- NodeMap.erase(V);
+ NodeMap.erase(V);
}
void setUnusedArgValue(const Value *V, SDValue NewN) {
More information about the llvm-commits
mailing list