[PATCH] D21866: [ADT] Add a new data structure for managing a priority worklist where re-insertion of entries into the worklist moves them to the end.

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 16:13:58 PDT 2016


MatzeB added a subscriber: MatzeB.
MatzeB added a comment.

I'm wondering if it is worth creating a whole new templated type here, do you expect more than one user?


================
Comment at: include/llvm/ADT/PriorityWorklist.h:110-114
@@ +109,7 @@
+    assert(!empty() && "Cannot remove an element when empty!");
+    assert((bool)(back()) && "Cannot have a null element at the back!");
+    M.erase(back());
+    do {
+      V.pop_back();
+    } while (!V.empty() && !V.back());
+  }
----------------
Should this rather be V.back() == T()? Or alternatively you could document that T needs to be implicitely convertible to bool with everything but the NULL value being false...

(Similar in the assert and another instance later).


http://reviews.llvm.org/D21866





More information about the llvm-commits mailing list