diff --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp --- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp @@ -289,10 +289,7 @@ if (getDriver().isUsingLTO(/* IsOffload */ true)) return; - std::string BitcodeSuffix = "amdgpu-" + GPUArch; - - addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, BitcodeSuffix, - getTriple()); + addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, GPUArch, getTriple()); } llvm::opt::DerivedArgList *AMDGPUOpenMPToolChain::TranslateArgs( diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -8212,15 +8212,8 @@ const ArgList &TCArgs = C.getArgsForToolChain(TC, "", Action::OFK_OpenMP); StringRef Arch = TCArgs.getLastArgValue(options::OPT_march_EQ); - std::string BitcodeSuffix; - if (TC->getTriple().isNVPTX()) - BitcodeSuffix += "nvptx-"; - else if (TC->getTriple().isAMDGPU()) - BitcodeSuffix += "amdgpu-"; - BitcodeSuffix += Arch; - ArgStringList BitcodeLibrary; - addOpenMPDeviceRTL(TCDriver, TCArgs, BitcodeLibrary, BitcodeSuffix, + addOpenMPDeviceRTL(TCDriver, TCArgs, BitcodeLibrary, Arch, TC->getTriple()); if (!BitcodeLibrary.empty()) diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -2011,8 +2011,9 @@ Triple.isAMDGCN() ? options::OPT_libomptarget_amdgpu_bc_path_EQ : options::OPT_libomptarget_nvptx_bc_path_EQ; - StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgcn" : "nvptx"; - std::string LibOmpTargetName = "libomptarget-" + BitcodeSuffix.str() + ".bc"; + std::string ArchPrefix = Triple.isAMDGCN() ? "amdgpu" : "nvptx"; + std::string LibOmpTargetName = + "libomptarget-" + ArchPrefix + "-" + BitcodeSuffix.str() + ".bc"; // First check whether user specifies bc library if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) { diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -748,9 +748,7 @@ if (getDriver().isUsingLTO(/* IsOffload */ true)) return; - std::string BitcodeSuffix = "nvptx-" + GpuArch.str(); - - addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, BitcodeSuffix, + addOpenMPDeviceRTL(getDriver(), DriverArgs, CC1Args, GpuArch.str(), getTriple()); AddStaticDeviceLibsPostLinking(getDriver(), DriverArgs, CC1Args, "nvptx", GpuArch, /*isBitCodeSDL=*/true,