Skip to content

Commit 85fa8a6

Browse files
mdtoguchibader
authored andcommitted
[SYCL] Do not add generated integrated header to dependency info
During the -fsycl compilation, a generated integrated header is included to the host compilation. When dependency information is generated, we do not want this file to be included as part of that information as it is a temp file and is not available for subsequent compilations, causing makes to always build files due to the missing header Signed-off-by: Michael D Toguchi <[email protected]>
1 parent 5f1c8d4 commit 85fa8a6

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5356,6 +5356,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
53565356
if (!IsSYCLOffloadDevice && SYCLDeviceInput) {
53575357
CmdArgs.push_back("-include");
53585358
CmdArgs.push_back(SYCLDeviceInput->getFilename());
5359+
// When creating dependency information, filter out the generated
5360+
// header file.
5361+
CmdArgs.push_back("-dependency-filter");
5362+
CmdArgs.push_back(SYCLDeviceInput->getFilename());
53595363
}
53605364
if (IsSYCLOffloadDevice && JA.getType() == types::TY_SYCL_Header) {
53615365
// Generating a SYCL Header

clang/test/Driver/sycl-offload.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,16 @@
102102

103103
/// ###########################################################################
104104

105+
/// Check the compilation flow to verify that the integrated header is filtered
106+
// RUN: %clang -target x86_64-unknown-linux-gnu -fsycl -c %s -### 2>&1 \
107+
// RUN: | FileCheck %s -check-prefix=CHK-INT-HEADER
108+
// CHK-INT-HEADER: clang{{.*}} "-fsycl-is-device" {{.*}} "-o" "[[OUTPUT1:.+\.o]]"
109+
// CHK-INT-HEADER: clang{{.*}} "-triple" "spir64-unknown-linux-sycldevice" {{.*}} "-fsycl-int-header=[[INPUT1:.+\.h]]"
110+
// CHK-INT-HEADER: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-o" "[[OUTPUT2:.+\.o]]" {{.*}} "-include" "[[INPUT1]]" "-dependency-filter" "[[INPUT1]]"
111+
// CHK-INT-HEADER: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-linux-sycldevice,host-x86_64-unknown-linux-gnu" {{.*}} "-inputs=[[OUTPUT1]],[[OUTPUT2]]"
112+
113+
/// ###########################################################################
114+
105115
/// Check the phases also add a library to make sure it is treated as input by
106116
/// the device.
107117
// RUN: %clang -ccc-print-phases -target x86_64-unknown-linux-gnu -lsomelib -fsycl -fsycl-targets=spir64-unknown-linux-sycldevice %s 2>&1 \

0 commit comments

Comments
 (0)