diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-01-04 20:20:08 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-01-04 20:20:08 +0000 |
commit | 34b5f0437b9bf67bcbeb166a1c092dbbe3786157 (patch) | |
tree | 9346d8c9941fe49a8b066ffaa74f3190ac71dad9 | |
parent | 8a86887ba3dcf59ddfd1d26bd2af1ac9c6bed76a (diff) | |
download | external_llvm-34b5f0437b9bf67bcbeb166a1c092dbbe3786157.tar.gz external_llvm-34b5f0437b9bf67bcbeb166a1c092dbbe3786157.tar.bz2 external_llvm-34b5f0437b9bf67bcbeb166a1c092dbbe3786157.zip |
Simplify code. No functionality change.
Using DenseMap iterators isn't free as they have to check for empty
buckets. Dominator queries are common so this gives a minor speedup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147544 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 15db2d1418..310239823c 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -321,8 +321,7 @@ public: /// block. This is the same as using operator[] on this class. /// inline DomTreeNodeBase<NodeT> *getNode(NodeT *BB) const { - typename DomTreeNodeMapType::const_iterator I = DomTreeNodes.find(BB); - return I != DomTreeNodes.end() ? I->second : 0; + return DomTreeNodes.lookup(BB); } /// getRootNode - This returns the entry node for the CFG of the function. If @@ -623,9 +622,8 @@ protected: } DomTreeNodeBase<NodeT> *getNodeForBlock(NodeT *BB) { - typename DomTreeNodeMapType::iterator I = this->DomTreeNodes.find(BB); - if (I != this->DomTreeNodes.end() && I->second) - return I->second; + if (DomTreeNodeBase<NodeT> *Node = getNode(BB)) + return Node; // Haven't calculated this node yet? Get or calculate the node for the // immediate dominator. @@ -641,8 +639,7 @@ protected: } inline NodeT *getIDom(NodeT *BB) const { - typename DenseMap<NodeT*, NodeT*>::const_iterator I = IDoms.find(BB); - return I != IDoms.end() ? I->second : 0; + return IDoms.lookup(BB); } inline void addRoot(NodeT* BB) { |