[llvm] r246378 - Stop calling the flat out insane ARM target parsing code unless the

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 30 19:48:12 PDT 2015


Does it fix pr23676?

Thanks!

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


More information about the llvm-commits mailing list