r340873 - [HIP] Fix output file extension
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 28 14:09:09 PDT 2018
Author: yaxunl
Date: Tue Aug 28 14:09:09 2018
New Revision: 340873
URL: http://llvm.org/viewvc/llvm-project?rev=340873&view=rev
Log:
[HIP] Fix output file extension
OffloadBundlingJobAction constructor accepts a list of JobAction as inputs.
The host JobAction is the last one. The file type of OffloadBundlingJobAction
should be determined by the host JobAction (the last one) instead of the first
one.
Since HIP emits LLVM bitcode for device compilation, device JobAction has
different file type as host Job Action. This bug causes incorrect output file
extension for HIP.
This patch fixes it by using the last input JobAction (host JobAction) to determine
file type of OffloadBundlingJobAction.
Differential Revision: https://reviews.llvm.org/D51336
Added:
cfe/trunk/test/Driver/hip-output-file-name.hip
Modified:
cfe/trunk/lib/Driver/Action.cpp
Modified: cfe/trunk/lib/Driver/Action.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=340873&r1=340872&r2=340873&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Action.cpp (original)
+++ cfe/trunk/lib/Driver/Action.cpp Tue Aug 28 14:09:09 2018
@@ -382,7 +382,7 @@ VerifyPCHJobAction::VerifyPCHJobAction(A
void OffloadBundlingJobAction::anchor() {}
OffloadBundlingJobAction::OffloadBundlingJobAction(ActionList &Inputs)
- : JobAction(OffloadBundlingJobClass, Inputs, Inputs.front()->getType()) {}
+ : JobAction(OffloadBundlingJobClass, Inputs, Inputs.back()->getType()) {}
void OffloadUnbundlingJobAction::anchor() {}
Added: cfe/trunk/test/Driver/hip-output-file-name.hip
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/hip-output-file-name.hip?rev=340873&view=auto
==============================================================================
--- cfe/trunk/test/Driver/hip-output-file-name.hip (added)
+++ cfe/trunk/test/Driver/hip-output-file-name.hip Tue Aug 28 14:09:09 2018
@@ -0,0 +1,9 @@
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: amdgpu-registered-target
+
+// RUN: %clang -### -c -target x86_64-linux-gnu \
+// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 %s \
+// RUN: 2>&1 | FileCheck %s
+
+// CHECK: {{.*}}clang-offload-bundler{{.*}}"-outputs=hip-output-file-name.o"
More information about the cfe-commits
mailing list