[clang-sycl-linker] Fix flaky failure and add REQUIRES (Try #2)#134130
Merged
[clang-sycl-linker] Fix flaky failure and add REQUIRES (Try #2)#134130
Conversation
Signed-off-by: Arvind Sudarsanam <arvind.sudarsanam@intel.com>
Member
|
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Arvind Sudarsanam (asudarsa) ChangesThis should fix failures caused by #133967 Full diff: https://github.com/llvm/llvm-project/pull/134130.diff 4 Files Affected:
diff --git a/clang/test/Driver/clang-sycl-linker-test.cpp b/clang/test/Driver/clang-sycl-linker-test.cpp
index 2f860ae74e97d..c399689653784 100644
--- a/clang/test/Driver/clang-sycl-linker-test.cpp
+++ b/clang/test/Driver/clang-sycl-linker-test.cpp
@@ -1,5 +1,7 @@
// Tests the clang-sycl-linker tool.
//
+// REQUIRES: spirv-registered-target
+//
// Test the dry run of a simple case to link two input files.
// RUN: %clangxx -emit-llvm -c -target spirv64 %s -o %t_1.bc
// RUN: %clangxx -emit-llvm -c -target spirv64 %s -o %t_2.bc
diff --git a/clang/test/Driver/link-device-code.test b/clang/test/Driver/link-device-code.test
index a5f52fdb7d9ae..231f02b6560e0 100644
--- a/clang/test/Driver/link-device-code.test
+++ b/clang/test/Driver/link-device-code.test
@@ -1,3 +1,5 @@
+# REQUIRES: spirv-registered-target
+
# RUN: llvm-as %S/Inputs/SYCL/foo.ll -o %t.foo.bc
# RUN: llvm-as %S/Inputs/SYCL/bar.ll -o %t.bar.bc
# RUN: llvm-as %S/Inputs/SYCL/baz.ll -o %t.baz.bc
diff --git a/clang/test/Driver/sycl-link-spirv-target.cpp b/clang/test/Driver/sycl-link-spirv-target.cpp
index 586adae619165..24206e38ad0a7 100644
--- a/clang/test/Driver/sycl-link-spirv-target.cpp
+++ b/clang/test/Driver/sycl-link-spirv-target.cpp
@@ -1,6 +1,8 @@
// Tests the driver when linking LLVM IR bitcode files and targeting SPIR-V
// architecture.
//
+// REQUIRES: spirv-registered-target
+//
// Test that -Xlinker options are being passed to clang-sycl-linker.
// RUN: touch %t.bc
// RUN: %clangxx -### --target=spirv64 --sycl-link -Xlinker -triple=spirv64 -Xlinker --library-path=/tmp \
diff --git a/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp b/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp
index ab718c5a87c40..c640deddc9e74 100644
--- a/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp
+++ b/clang/tools/clang-sycl-linker/ClangSYCLLinker.cpp
@@ -288,6 +288,9 @@ static Expected<StringRef> runSPIRVCodeGen(StringRef File, const ArgList &Args,
if (!M)
return createStringError(Err.getMessage());
+ if (Error Err = M->materializeAll())
+ return std::move(Err);
+
Triple TargetTriple(Args.getLastArgValue(OPT_triple_EQ));
M->setTargetTriple(TargetTriple);
|
sarnex
approved these changes
Apr 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should fix failures caused by #133967
Attn: @sarnex
Thanks