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 @@ -696,13 +696,12 @@ if (DriverArgs.hasArg(options::OPT_nogpulib)) return; - std::string LibDeviceFile = CudaInstallation.getLibDeviceFile(GpuArch); + if (DeviceOffloadingKind == Action::OFK_OpenMP && + DriverArgs.hasArg(options::OPT_S)) + return; + std::string LibDeviceFile = CudaInstallation.getLibDeviceFile(GpuArch); if (LibDeviceFile.empty()) { - if (DeviceOffloadingKind == Action::OFK_OpenMP && - DriverArgs.hasArg(options::OPT_S)) - return; - getDriver().Diag(diag::err_drv_no_cuda_libdevice) << GpuArch; return; }