[PATCH] Introduce an optimisation for special case lists with large numbers of literal entries.

Alexey Samsonov samsonov at google.com
Fri Jul 19 02:45:59 PDT 2013



================
Comment at: lib/Transforms/Utils/SpecialCaseList.cpp:38
@@ +37,3 @@
+  StringSet<> Strings;
+  Regex *RegEx;
+
----------------
Consider:
a) using OwningPtr<Regex> instead of RegEx*. In this case you wouldn't need SpecialCaseList destructor and Entry ctor.
b) making this a class with private data. You need only: addString(), setRegex() and match() methods.

I would also appreciate a comment about the intent behind this.

================
Comment at: lib/Transforms/Utils/SpecialCaseList.cpp:99
@@ +98,3 @@
+    // metacharacters.
+    if (Regexp.find_first_of("()^$|*+?.[]\\{}") == std::string::npos) {
+      Entries[Prefix][Category].Strings.insert(Regexp);
----------------
Where does this magic list of characters come from? How can we know it's complete and modify it when needed? Looks like you need to extend Regex class for this.


http://llvm-reviews.chandlerc.com/D1150



More information about the llvm-commits mailing list