diff options
| author | Yaxun Liu <Yaxun.Liu@amd.com> | 2019-10-09 18:46:43 +0000 |
|---|---|---|
| committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2019-10-09 18:46:43 +0000 |
| commit | e6a0ab18d19b69e35743015853844d7305891e4e (patch) | |
| tree | 434d84f1dfcb3ee76aae8008d39c57797d343bf6 /lib/Driver/Driver.cpp | |
| parent | b8ee3f498b42c135ff329f62c36cdd6bb774221d (diff) | |
| download | clang-e6a0ab18d19b69e35743015853844d7305891e4e.tar.gz | |
[HIP] Fix -save-temps
Currently clang does not save some of the intermediate file generated during device compilation for HIP when -save-temps is specified.
This patch fixes that.
Differential Revision: https://reviews.llvm.org/D68665
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374198 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
| -rw-r--r-- | lib/Driver/Driver.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index df3e82b85e..a095274298 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -4419,11 +4419,22 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const JobAction &JA, MakeCLOutputFilename(C.getArgs(), "", BaseName, types::TY_Image); } else { SmallString<128> Output(getDefaultImageName()); + // HIP image for device compilation with -fno-gpu-rdc is per compilation + // unit. + bool IsHIPNoRDC = JA.getOffloadingDeviceKind() == Action::OFK_HIP && + !C.getArgs().hasFlag(options::OPT_fgpu_rdc, + options::OPT_fno_gpu_rdc, false); + if (IsHIPNoRDC) { + Output = BaseName; + llvm::sys::path::replace_extension(Output, ""); + } Output += OffloadingPrefix; if (MultipleArchs && !BoundArch.empty()) { Output += "-"; Output.append(BoundArch); } + if (IsHIPNoRDC) + Output += ".out"; NamedOutput = C.getArgs().MakeArgString(Output.c_str()); } } else if (JA.getType() == types::TY_PCH && IsCLMode()) { |
