aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/Driver.cpp
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2022-10-05 14:35:48 -0500
committerJoseph Huber <jhuber6@vols.utk.edu>2022-10-06 09:36:09 -0500
commitac135f9ee574e7451088926c667d93d51a3d6940 (patch)
tree79679d2eee76d9b64904bad0eeecfd8f1a5ab397 /clang/lib/Driver/Driver.cpp
parentf47d5dce61cf2704dc15761cea8da4eaf1a7941a (diff)
downloadllvm-ac135f9ee574e7451088926c667d93d51a3d6940.zip
llvm-ac135f9ee574e7451088926c667d93d51a3d6940.tar.gz
llvm-ac135f9ee574e7451088926c667d93d51a3d6940.tar.bz2
[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
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r--clang/lib/Driver/Driver.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index be62ce5..21dc180 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4375,7 +4375,9 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
// Compiling HIP in non-RDC mode requires linking each action individually.
for (Action *&A : DeviceActions) {
- if (A->getType() != types::TY_Object || Kind != Action::OFK_HIP ||
+ if ((A->getType() != types::TY_Object &&
+ A->getType() != types::TY_LTO_BC) ||
+ Kind != Action::OFK_HIP ||
Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false))
continue;
ActionList LinkerInput = {A};