Skip to content

Commit

Permalink
[SYCL][thinLTO] Don't pass -emit-only-kernels-as-entry-points to sycl…
Browse files Browse the repository at this point in the history
…-post-link in early splitting

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
  • Loading branch information
sarnex committed Aug 7, 2024
1 parent 2422e85 commit 285c86c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10788,7 +10788,10 @@ static void getTripleBasedSYCLPostLinkOpts(const ToolChain &TC,
!isSYCLNativeCPU(TC)) &&
// When supporting dynamic linking, non-kernels in a device image can be
// called.
!supportDynamicLinking(TCArgs) && !Triple.isNVPTX() && !Triple.isAMDGPU())
!supportDynamicLinking(TCArgs) && !Triple.isNVPTX() &&
!Triple.isAMDGPU()
// With thinLTO, final entry point handing is done in clang-linker-wrapper
&& (!IsUsingLTO || LTOMode != LTOK_Thin))
addArgs(PostLinkArgs, TCArgs, {"-emit-only-kernels-as-entry-points"});

if (!Triple.isAMDGCN())
Expand Down
5 changes: 3 additions & 2 deletions clang/test/Driver/sycl-lto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
// CHECK_SPLIT_ERROR: '-fsycl-device-code-split=off' is not supported when '-foffload-lto=thin' is set with '-fsycl'

// Verify there's no error and we see the expected cc1 flags and tool invocations with the new offload driver.
// RUN: %clangxx -fsycl --offload-new-driver -foffload-lto=thin %s -### 2>&1 | FileCheck -check-prefix=CHECK_SUPPORTED %s
// RUN: %clangxx -fsycl --offload-new-driver -foffload-lto=thin %s -### 2>&1 | \
// RUN: FileCheck -check-prefix=CHECK_SUPPORTED -implicit-check-not=-emit-only-kernels-as-entry-points %s
// CHECK_SUPPORTED: clang{{.*}} "-cc1" "-triple" "spir64-unknown-unknown" {{.*}} "-flto=thin" "-flto-unit"
// CHECK_SUPPORTED: sycl-post-link{{.*}}
// CHECK_SUPPORTED: sycl-post-link
// CHECK_SUPPORTED-NOT: -properties
// CHECK_SUPPORTED-NEXT: file-table-tform{{.*}}
// CHECK_SUPPORTED-NEXT: llvm-foreach{{.*}} "--" {{.*}}clang{{.*}} "-fsycl-is-device"{{.*}} "-flto=thin" "-flto-unit"
Expand Down

0 comments on commit 285c86c

Please sign in to comment.