[OpenMP][NFC] Simplify identifying the device bitcode library

Now that the old device runtime has been deleted there is only a single
target that differs by the triple and the architecture. Simplify the
scheme for identifying the library but directly using the triple.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D119638
This commit is contained in:
Joseph Huber 2022-02-11 16:44:17 -05:00
parent 5ffb1047cd
commit a0e8077d28
4 changed files with 6 additions and 17 deletions

View File

@ -289,10 +289,7 @@ void AMDGPUOpenMPToolChain::addClangTargetOptions(
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(

View File

@ -8212,15 +8212,8 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
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())

View File

@ -2011,8 +2011,9 @@ void tools::addOpenMPDeviceRTL(const Driver &D,
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";
StringRef ArchPrefix = Triple.isAMDGCN() ? "amdgpu" : "nvptx";
std::string LibOmpTargetName =
("libomptarget-" + ArchPrefix + "-" + BitcodeSuffix + ".bc").str();
// First check whether user specifies bc library
if (const Arg *A = DriverArgs.getLastArg(LibomptargetBCPathOpt)) {

View File

@ -748,9 +748,7 @@ void CudaToolChain::addClangTargetOptions(
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,