<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Aug 30, 2015 at 2:54 AM, Chandler Carruth via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: chandlerc<br>
Date: Sun Aug 30 04:54:34 2015<br>
New Revision: 246378<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=246378&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=246378&view=rev</a><br>
Log:<br>
Stop calling the flat out insane ARM target parsing code unless the<br>
architecture string is something quite weird. Similarly delay calling<br>
the BPF parsing code, although that is more reasonable.<br>
<br>
To understand why I was motivated to make this change, it cuts the time<br>
for running the ADT TripleTest unittests by a factor of two in<br>
non-optimized builds (the developer default) and reduces my 'check-llvm'<br>
time by a full 15 seconds.</blockquote><div><br>Thanks a bunch!<br><br>(& yeah, there are a few outstandingly slow tests in LLVM's test suite - maybe these ones, but I've never looked closely enough, just always see one or two test names sit there for quite a while towards the end of the test suite run as the long tail)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> The implementation of parseARMArch is *that*<br>
slow. I tried to fix it in the prior series of commits, but frankly,<br>
I have no idea how to finish fixing it. The entire premise of the<br>
function (to allow 'v7a-unknown-linux' or some such to parse as an<br>
'arm-unknown-linux' triple) seems completely insane to me, but I'll let<br>
the ARM folks sort that out. At least it is now out of the critical path<br>
of every developer working on LLVM. It also will likely make some other<br>
folks' code significantly faster as I've heard reports of 2% of time<br>
spent in triple parsing even in optimized builds!<br>
<br>
I'm not done making this code faster, but I am done trying to improve<br>
the ARM target parsing code.<br>
<br>
Modified:<br>
llvm/trunk/lib/Support/Triple.cpp<br>
<br>
Modified: llvm/trunk/lib/Support/Triple.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=246378&r1=246377&r2=246378&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Triple.cpp?rev=246378&r1=246377&r2=246378&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Support/Triple.cpp (original)<br>
+++ llvm/trunk/lib/Support/Triple.cpp Sun Aug 30 04:54:34 2015<br>
@@ -325,10 +325,7 @@ static Triple::ArchType parseARMArch(Str<br>
}<br>
<br>
static Triple::ArchType parseArch(StringRef ArchName) {<br>
- Triple::ArchType ARMArch(parseARMArch(ArchName));<br>
- Triple::ArchType BPFArch(parseBPFArch(ArchName));<br>
-<br>
- return StringSwitch<Triple::ArchType>(ArchName)<br>
+ auto AT = StringSwitch<Triple::ArchType>(ArchName)<br>
.Cases("i386", "i486", "i586", "i686", Triple::x86)<br>
// FIXME: Do we need to support these?<br>
.Cases("i786", "i886", "i986", Triple::x86)<br>
@@ -338,9 +335,13 @@ static Triple::ArchType parseArch(String<br>
.Case("powerpc64le", Triple::ppc64le)<br>
.Case("xscale", Triple::arm)<br>
.Case("xscaleeb", Triple::armeb)<br>
- .StartsWith("arm", ARMArch)<br>
- .StartsWith("thumb", ARMArch)<br>
- .StartsWith("aarch64", ARMArch)<br>
+ .Case("aarch64", Triple::aarch64)<br>
+ .Case("aarch64_be", Triple::aarch64_be)<br>
+ .Case("arm64", Triple::aarch64)<br>
+ .Case("arm", Triple::arm)<br>
+ .Case("armeb", Triple::armeb)<br>
+ .Case("thumb", Triple::thumb)<br>
+ .Case("thumbeb", Triple::thumbeb)<br>
.Case("msp430", Triple::msp430)<br>
.Cases("mips", "mipseb", "mipsallegrex", Triple::mips)<br>
.Cases("mipsel", "mipsallegrexel", Triple::mipsel)<br>
@@ -348,7 +349,6 @@ static Triple::ArchType parseArch(String<br>
.Case("mips64el", Triple::mips64el)<br>
.Case("r600", Triple::r600)<br>
.Case("amdgcn", Triple::amdgcn)<br>
- .StartsWith("bpf", BPFArch)<br>
.Case("hexagon", Triple::hexagon)<br>
.Case("s390x", Triple::systemz)<br>
.Case("sparc", Triple::sparc)<br>
@@ -371,6 +371,18 @@ static Triple::ArchType parseArch(String<br>
.Case("wasm32", Triple::wasm32)<br>
.Case("wasm64", Triple::wasm64)<br>
.Default(Triple::UnknownArch);<br>
+<br>
+ // Some architectures require special parsing logic just to compute the<br>
+ // ArchType result.<br>
+ if (AT == Triple::UnknownArch) {<br>
+ if (ArchName.startswith("arm") || ArchName.startswith("thumb") ||<br>
+ ArchName.startswith("aarch64"))<br>
+ return parseARMArch(ArchName);<br>
+ if (ArchName.startswith("bpf"))<br>
+ return parseBPFArch(ArchName);<br>
+ }<br>
+<br>
+ return AT;<br>
}<br>
<br>
static Triple::VendorType parseVendor(StringRef VendorName) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>