From 6334a59454ef934f08731d536c7352e97af31d3f Mon Sep 17 00:00:00 2001 From: Michael Liao Date: Tue, 8 Oct 2019 18:06:51 +0000 Subject: [PATCH] [driver][hip] Skip bundler if host action is nothing. Reviewers: sfantao, tra, yaxunl Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68652 llvm-svn: 374097 --- clang/lib/Driver/Driver.cpp | 3 ++- clang/test/Driver/hip-syntax-only.hip | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 clang/test/Driver/hip-syntax-only.hip diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 5b72b4aeecd2..df3e82b85e5c 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3108,7 +3108,8 @@ public: // the resulting list. Otherwise, just append the device actions. For // device only compilation, HostAction is a null pointer, therefore only do // this when HostAction is not a null pointer. - if (CanUseBundler && HostAction && !OffloadAL.empty()) { + if (CanUseBundler && HostAction && + HostAction->getType() != types::TY_Nothing && !OffloadAL.empty()) { // Add the host action to the list in order to create the bundling action. OffloadAL.push_back(HostAction); diff --git a/clang/test/Driver/hip-syntax-only.hip b/clang/test/Driver/hip-syntax-only.hip new file mode 100644 index 000000000000..051c3c68962e --- /dev/null +++ b/clang/test/Driver/hip-syntax-only.hip @@ -0,0 +1,11 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: amdgpu-registered-target + +// RUN: %clang -### -x hip -nogpulib -target x86_64 -fsyntax-only %s 2>&1 | FileCheck %s + +// Check that there are commands for both host- and device-side compilations. +// +// CHECK-DAG: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device" +// CHECK-DAG: clang{{.*}}" "-cc1" "-triple" "x86_64" +// CHECK-NOT: clang-offload-bundler"