[Clang] Fix using LTO with the new driver in RDC-mode
authorJoseph Huber <jhuber6@vols.utk.edu>
Wed, 5 Oct 2022 19:35:48 +0000 (14:35 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Thu, 6 Oct 2022 14:36:09 +0000 (09:36 -0500)
commitac135f9ee574e7451088926c667d93d51a3d6940
tree79679d2eee76d9b64904bad0eeecfd8f1a5ab397
parentf47d5dce61cf2704dc15761cea8da4eaf1a7941a
[Clang] Fix using LTO with the new driver in RDC-mode

The new driver supports LTO for RDC-mode compilations. However, this was
not correctly handled for non-LTO compilations. HIP can handle this as
it is fed to `lld` which will perform the LTO itself. CUDA however would
require every work which is wholly useless in non-RDC mode so it should
report an error.

Reviewed By: yaxunl

Differential Revision: https://reviews.llvm.org/D135305
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/cuda-bindings.cu
clang/test/Driver/cuda-phases.cu
clang/test/Driver/hip-binding.hip
clang/test/Driver/hip-phases.hip