aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <sunfish@google.com>2014-02-18 16:41:21 -0800
committerDan Gohman <sunfish@google.com>2014-02-25 11:58:52 -0800
commite6f7d1edbe66e4ee676413de57a96222add7a3fd (patch)
treee769746477c5c7c921eae8c9e1d4ee4e5294d1c7
parent9232a22863aa8c2204079d19e4b24381b8fcbb88 (diff)
Minor code simplifications.
-rw-r--r--src/relooper/Relooper.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/relooper/Relooper.cpp b/src/relooper/Relooper.cpp
index 14c203e0..c11de099 100644
--- a/src/relooper/Relooper.cpp
+++ b/src/relooper/Relooper.cpp
@@ -17,8 +17,8 @@
typedef std::string ministring;
#endif
-template <class T, class U> bool contains(const T& container, const U& contained) {
- return container.find(contained) != container.end();
+template <class T, class U> static bool contains(const T& container, const U& contained) {
+ return container.count(contained);
}
#if DEBUG
@@ -650,7 +650,7 @@ void Relooper::Calculate(Block *Entry) {
Block *Curr = *iter;
for (BlockBranchMap::iterator iter = Curr->BranchesOut.begin(); iter != Curr->BranchesOut.end(); iter++) {
Block *Target = iter->first;
- if (Hoisted.find(Target) == Hoisted.end() && NextEntries.find(Target) == NextEntries.end()) {
+ if (!contains(Hoisted, Target) && !contains(NextEntries, Target))
// abort this hoisting
abort = true;
break;