[PATCH] [LinkModules] Intelligently merge triples that differ only in the minimum version number if the vendor is apple

Duncan P. N. Exon Smith dexonsmith at apple.com
Thu Feb 12 15:42:13 PST 2015


> On 2015-Feb-12, at 14:23, Akira Hatanaka <ahatanak at gmail.com> wrote:
> 
> Address review comments.
> 
> In summary, this patch makes the following changes:
> 
> - Change ModuleLinker to stop issuing a warning when the Triple objects compare equal even when the triple strings differ.
> - On Apple platforms, choose the triple that has the larger version number.
> 
> 
> http://reviews.llvm.org/D7591
> 
> Files:
>  include/llvm/ADT/Triple.h
>  lib/Linker/LinkModules.cpp
>  lib/Support/Triple.cpp
>  test/Linker/Inputs/apple-version/1.ll
>  test/Linker/Inputs/apple-version/2.ll
>  test/Linker/Inputs/apple-version/3.ll
>  test/Linker/Inputs/apple-version/4.ll
>  test/Linker/Inputs/targettriple-a.ll
>  test/Linker/Inputs/targettriple-b.ll
>  test/Linker/Inputs/targettriple-c.ll
>  test/Linker/apple-version.ll
>  test/Linker/targettriple.ll
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> <D7591.19858.patch>
> Index: lib/Support/Triple.cpp
> ===================================================================
> --- lib/Support/Triple.cpp
> +++ lib/Support/Triple.cpp
> @@ -494,6 +494,12 @@
>      ObjectFormat = getDefaultFormat(*this);
>  }
>  
> +bool Triple::operator==(const Triple &Other) const {
> +  return Arch == Other.Arch && SubArch == Other.SubArch &&
> +         Vendor == Other.Vendor && OS == Other.OS &&
> +         Environment == Other.Environment && ObjectFormat == Other.ObjectFormat;
> +}
> +

I feel like this logic should just be inline in the header.  It's
easier to verify by eye if it's close to where the fields are
declared.

Otherwise, LGTM.

>  std::string Triple::normalize(StringRef Str) {
>    bool IsMinGW32 = false;
>    bool IsCygwin = false;
> 





More information about the llvm-commits mailing list