diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2017-05-18 03:52:29 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-05-18 03:52:29 +0000 |
commit | b10bff1183b8fcfe1a6625e353f9ebdef904ae7c (patch) | |
tree | 850d76db4879300cc179e9903eff7454f06da4a6 /llvm/lib/Support/Triple.cpp | |
parent | fd3e39846d28bdc5e0e5c7918e245203c470b547 (diff) | |
download | bcm5719-llvm-b10bff1183b8fcfe1a6625e353f9ebdef904ae7c.tar.gz bcm5719-llvm-b10bff1183b8fcfe1a6625e353f9ebdef904ae7c.zip |
[ThinLTO] Do not assert when adding a module with a different but
compatible target triple
Currently, an assertion fails in ThinLTOCodeGenerator::addModule when
the target triple of the module being added doesn't match that of the
one stored in TMBuilder. This patch relaxes the constraint and makes
changes to allow target triples that only differ in their version
numbers on Apple platforms, similarly to what r228999 did.
rdar://problem/30133904
Differential Revision: https://reviews.llvm.org/D33291
llvm-svn: 303326
Diffstat (limited to 'llvm/lib/Support/Triple.cpp')
-rw-r--r-- | llvm/lib/Support/Triple.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index eb8108908ac..b0e3d6898ca 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -1472,6 +1472,24 @@ bool Triple::isLittleEndian() const { } } +bool Triple::isCompatibleWith(const Triple &Other) const { + // If vendor is apple, ignore the version number. + if (getVendor() == Triple::Apple) + return getArch() == Other.getArch() && getSubArch() == Other.getSubArch() && + getVendor() == Other.getVendor() && getOS() == Other.getOS(); + + return *this == Other; +} + +std::string Triple::merge(const Triple &Other) const { + // If vendor is apple, pick the triple with the larger version number. + if (getVendor() == Triple::Apple) + if (Other.isOSVersionLT(*this)) + return str(); + + return Other.str(); +} + StringRef Triple::getARMCPUForArch(StringRef MArch) const { if (MArch.empty()) MArch = getArchName(); |