diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -1129,8 +1129,20 @@ A->getOption().matches(options::OPT_Xopenmp_target); if (A->getOption().matches(options::OPT_Xopenmp_target_EQ)) { + llvm::Triple TT(A->getValue(0)); + // We want to expand the shortened versions of the triples passed in to + // the values used for the bitcode libraries for convenience. + if (TT.getVendor() == llvm::Triple::UnknownVendor || + TT.getOS() == llvm::Triple::UnknownOS) { + if (TT.getArch() == llvm::Triple::nvptx) + TT = llvm::Triple("nvptx-nvidia-cuda"); + else if (TT.getArch() == llvm::Triple::nvptx64) + TT = llvm::Triple("nvptx64-nvidia-cuda"); + else if (TT.getArch() == llvm::Triple::amdgcn) + TT = llvm::Triple("amdgcn-amd-amdhsa"); + } // Passing device args: -Xopenmp-target= -opt=val. - if (A->getValue(0) == getTripleString()) + if (TT.getTriple() == getTripleString()) Index = Args.getBaseArgs().MakeIndex(A->getValue(1)); else continue;