summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-01-04 21:41:24 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-01-04 21:41:24 +0000
commitbea8e6aef151e6a657293f9643dcee6f026b328f (patch)
treef9b40f4a10f6c252f29b1a8d22a06456890823cd
parent49e446d9ea7918cded09fef388d1a9d22708c8c1 (diff)
downloadbcm5719-llvm-bea8e6aef151e6a657293f9643dcee6f026b328f.tar.gz
bcm5719-llvm-bea8e6aef151e6a657293f9643dcee6f026b328f.zip
Simplify more DenseMap.find users.
llvm-svn: 147550
-rw-r--r--llvm/include/llvm/Analysis/LoopInfo.h10
-rw-r--r--llvm/include/llvm/CodeGen/SlotIndexes.h2
2 files changed, 4 insertions, 8 deletions
diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h
index 871735224d3..f807d48d4e4 100644
--- a/llvm/include/llvm/Analysis/LoopInfo.h
+++ b/llvm/include/llvm/Analysis/LoopInfo.h
@@ -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;
diff --git a/llvm/include/llvm/CodeGen/SlotIndexes.h b/llvm/include/llvm/CodeGen/SlotIndexes.h
index cb2baa637ca..19bcb92f01e 100644
--- a/llvm/include/llvm/CodeGen/SlotIndexes.h
+++ b/llvm/include/llvm/CodeGen/SlotIndexes.h
@@ -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.
OpenPOWER on IntegriCloud