[PATCH] D22290: [PATCH 2/2] [Driver] Compute effective target triples once per job (NFCI)

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 17:41:21 PDT 2016


> On 2016-Jul-12, at 16:53, Vedant Kumar <vsk at apple.com> wrote:
> 
> vsk created this revision.
> vsk added a reviewer: dexonsmith.
> vsk added a subscriber: cfe-commits.
> Herald added subscribers: srhines, danalbert, tberghammer, aemerson.
> 
> Compute an effective target triple exactly once in ConstructJob(), and
> then simply pass around const references to it. This eliminates wasteful
> re-computation of effective triples (e.g in getARMFloatABI()).
> 
> http://reviews.llvm.org/D22290
> 
> Files:
>  include/clang/Driver/SanitizerArgs.h
>  include/clang/Driver/Tool.h
>  include/clang/Driver/ToolChain.h
>  lib/Driver/Driver.cpp
>  lib/Driver/SanitizerArgs.cpp
>  lib/Driver/ToolChain.cpp
>  lib/Driver/ToolChains.cpp
>  lib/Driver/ToolChains.h
>  lib/Driver/Tools.cpp
>  lib/Driver/Tools.h
> 
> <D22290.63757.patch>

> Index: lib/Driver/Driver.cpp
> ===================================================================
> --- lib/Driver/Driver.cpp
> +++ lib/Driver/Driver.cpp
> @@ -2112,7 +2112,21 @@
>                                               AtTopLevel, MultipleArchs),
>                         BaseInput);
>  
> +  llvm::Triple EffectiveTriple;
> +  const ArgList &Args = C.getArgsForToolChain(TC, BoundArch);
> +  if (InputInfos.size() != 1) {
> +    EffectiveTriple = llvm::Triple(
> +        T->getToolChain().ComputeEffectiveClangTriple(Args));
> +  } else {
> +    // Pass along the input type if it can be unambiguously determined.
> +    EffectiveTriple =
> +        llvm::Triple(T->getToolChain().ComputeEffectiveClangTriple(
> +            Args, InputInfos[0].getType()));
> +  }
> +
>    if (CCCPrintBindings && !CCGenDiagnostics) {
> +    // FIXME: We should be able to use the effective triple here, but doing so
> +    // breaks some multi-arch tests.

This is interesting.  Why does it break the tests?

>      llvm::errs() << "# \"" << T->getToolChain().getTripleString() << '"'
>                   << " - \"" << T->getName() << "\", inputs: [";
>      for (unsigned i = 0, e = InputInfos.size(); i != e; ++i) {
> @@ -2122,7 +2136,7 @@
>      }
>      llvm::errs() << "], output: " << Result.getAsString() << "\n";
>    } else {
> -    T->ConstructJob(C, *JA, Result, InputInfos,
> +    T->ConstructJob(C, *JA, Result, InputInfos, EffectiveTriple,
>                      C.getArgsForToolChain(TC, BoundArch), LinkingOutput);

Why doesn't this have the same problem as above?  I.e., what happens for
multi-arch cases?

>    }
>    return Result;
> 



More information about the cfe-commits mailing list