Simplify more DenseMap.find users.
authorBenjamin Kramer <benny.kra@googlemail.com>
Wed, 4 Jan 2012 21:41:24 +0000 (21:41 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Wed, 4 Jan 2012 21:41:24 +0000 (21:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147550 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/LoopInfo.h
include/llvm/CodeGen/SlotIndexes.h

index 871735224d3bc738045b2dd6cdaf2b629b38126d..f807d48d4e40474999b138f0a545ecedaddb551f 100644 (file)
@@ -655,9 +655,7 @@ public:
   /// block is in no loop (for example the entry node), null is returned.
   ///
   LoopT *getLoopFor(const BlockT *BB) const {
-    typename DenseMap<BlockT *, LoopT *>::const_iterator I=
-      BBMap.find(const_cast<BlockT*>(BB));
-    return I != BBMap.end() ? I->second : 0;
+    return BBMap.lookup(const_cast<BlockT*>(BB));
   }
 
   /// operator[] - same as getLoopFor...
@@ -696,9 +694,7 @@ public:
   /// the loop hierarchy tree.
   void changeLoopFor(BlockT *BB, LoopT *L) {
     if (!L) {
-      typename DenseMap<BlockT *, LoopT *>::iterator I = BBMap.find(BB);
-      if (I != BBMap.end())
-        BBMap.erase(I);
+      BBMap.erase(BB);
       return;
     }
     BBMap[BB] = L;
@@ -755,7 +751,7 @@ public:
   }
 
   LoopT *ConsiderForLoop(BlockT *BB, DominatorTreeBase<BlockT> &DT) {
-    if (BBMap.find(BB) != BBMap.end()) return 0;// Haven't processed this node?
+    if (BBMap.count(BB)) return 0; // Haven't processed this node?
 
     std::vector<BlockT *> TodoStack;
 
index cb2baa637ca82de1619d4390fdbd0ffc6a24f93c..19bcb92f01ee8aea7336890f484f8ea59e147a7f 100644 (file)
@@ -488,7 +488,7 @@ namespace llvm {
     /// Returns true if the given machine instr is mapped to an index,
     /// otherwise returns false.
     bool hasIndex(const MachineInstr *instr) const {
-      return (mi2iMap.find(instr) != mi2iMap.end());
+      return mi2iMap.count(instr);
     }
 
     /// Returns the base index for the given instruction.