<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 5, 2013 at 10:48 AM, Peter Collingbourne <span dir="ltr"><<a href="mailto:peter@pcc.me.uk" target="_blank">peter@pcc.me.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: pcc<br>
Date: Mon Aug  5 12:48:04 2013<br>
New Revision: 187732<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=187732&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=187732&view=rev</a><br>
Log:<br>
Introduce an optimisation for special case lists with large numbers of literal entries.<br>
<br>
Our internal regex implementation does not cope with large numbers<br>
of anchors very efficiently.  Given a ~3600-entry special case list,<br>
regex compilation can take on the order of seconds.  This patch solves<br>
the problem for the special case of patterns matching literal global<br>
names (i.e. patterns with no regex metacharacters).  Rather than<br>
forming regexes from literal global name patterns, add them to<br>
a StringSet which is checked before matching against the regex.<br>
This reduces regex compilation time by an order of roughly thousands<br>
when reading the aforementioned special case list, according to a<br>
completely unscientific study.<br>
<br>
No test cases.  I figure that any new tests for this code should<br>
check that regex metacharacters are properly recognised.  However,<br>
I could not find any documentation which documents the fact that the<br>
syntax of global names in special case lists is based on regexes.<br></blockquote><div><br></div><div>The header comment in `include/llvm/Transforms/Utils/SpecialCaseList.h` says:</div><div><br></div><div>```</div><div>// Note that the wild card is in fact an llvm::Regex, but * is automatically<br>
</div><div>// replaced with .*<br></div><div>```</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

The extent to which regex syntax is supported in special case lists<br>
should probably be decided on/documented before writing tests.<br></blockquote><div><br></div><div><<a href="http://llvm-reviews.chandlerc.com/D1268">http://llvm-reviews.chandlerc.com/D1268</a>> is working towards getting things documented. Since I presume this feature is already being used in the wild, we probably need to maintain the current format.</div>
<div><br></div><div>-- Sean Silva</div></div></div></div>