diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -1639,6 +1639,14 @@ return getArch() == Other.getArch() && getSubArch() == Other.getSubArch() && getVendor() == Other.getVendor() && getOS() == Other.getOS(); + if (getVendor() == Triple::NVIDIA) { + // libdevice bitcode uses nvptx64-nvidia-gpulibs triple and is used + // by all NVPTX variants. + return getArch() == Other.getArch() && getSubArch() == Other.getSubArch() && + getVendor() == Other.getVendor() && + (getOS() == Other.getOS() || getOSName() == "gpulibs" || + Other.getOSName() == "gpulibs"); + } return *this == Other; }