summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-08-05 17:48:04 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-08-05 17:48:04 +0000
commitbace606657e0a08346298e9e3ebe2be629736c57 (patch)
tree3b14dbdc495f67a13e966c6504582474aca0501b /llvm/include
parentfe8cd7597142cc0533411b81dd82cd8ef48ed716 (diff)
downloadbcm5719-llvm-bace606657e0a08346298e9e3ebe2be629736c57.tar.gz
bcm5719-llvm-bace606657e0a08346298e9e3ebe2be629736c57.zip
Introduce an optimisation for special case lists with large numbers of literal entries.
Our internal regex implementation does not cope with large numbers of anchors very efficiently. Given a ~3600-entry special case list, regex compilation can take on the order of seconds. This patch solves the problem for the special case of patterns matching literal global names (i.e. patterns with no regex metacharacters). Rather than forming regexes from literal global name patterns, add them to a StringSet which is checked before matching against the regex. This reduces regex compilation time by an order of roughly thousands when reading the aforementioned special case list, according to a completely unscientific study. No test cases. I figure that any new tests for this code should check that regex metacharacters are properly recognised. However, I could not find any documentation which documents the fact that the syntax of global names in special case lists is based on regexes. The extent to which regex syntax is supported in special case lists should probably be decided on/documented before writing tests. Differential Revision: http://llvm-reviews.chandlerc.com/D1150 llvm-svn: 187732
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Transforms/Utils/SpecialCaseList.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h b/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h
index 9f74953c7f8..787ddb0c7c4 100644
--- a/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h
+++ b/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h
@@ -89,7 +89,8 @@ class SpecialCaseList {
bool findCategory(const Module &M, StringRef &Category) const;
private:
- StringMap<StringMap<Regex*> > Entries;
+ struct Entry;
+ StringMap<StringMap<Entry> > Entries;
void init(const MemoryBuffer *MB);
bool findCategory(const StringRef Section, const StringRef Query,
OpenPOWER on IntegriCloud