Skip to content

Commit e6f7d1e

Browse files
author
Dan Gohman
committed
Minor code simplifications.
1 parent 9232a22 commit e6f7d1e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/relooper/Relooper.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
typedef std::string ministring;
1818
#endif
1919

20-
template <class T, class U> bool contains(const T& container, const U& contained) {
21-
return container.find(contained) != container.end();
20+
template <class T, class U> static bool contains(const T& container, const U& contained) {
21+
return container.count(contained);
2222
}
2323

2424
#if DEBUG
@@ -650,7 +650,7 @@ void Relooper::Calculate(Block *Entry) {
650650
Block *Curr = *iter;
651651
for (BlockBranchMap::iterator iter = Curr->BranchesOut.begin(); iter != Curr->BranchesOut.end(); iter++) {
652652
Block *Target = iter->first;
653-
if (Hoisted.find(Target) == Hoisted.end() && NextEntries.find(Target) == NextEntries.end()) {
653+
if (!contains(Hoisted, Target) && !contains(NextEntries, Target))
654654
// abort this hoisting
655655
abort = true;
656656
break;

0 commit comments

Comments
 (0)