Skip to content

Commit 7678a3e

Browse files
committed
[HIP][SPIRV] Use OPT_fembed_bitcode_EQ instead of the alias OPT_fembed_bitcode_marker
This helps avoid passing conflicting options if the user specified -fembed-bitcode= . OPT_fembed_bitcode_marker only matches -fembed-bitcode-marker. -fembed-bitcode=all/marker/none do not match. If the user specifies -fembed-bitcode=all/none, we should respect it, even if it may not make sense to us.
1 parent f1d1f13 commit 7678a3e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

clang/lib/Driver/ToolChains/HIPAMD.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void HIPAMDToolChain::addClangTargetOptions(
259259
// For SPIR-V we embed the command-line into the generated binary, in order
260260
// to retrieve it at JIT time and be able to do target specific compilation
261261
// with options that match the user-supplied ones.
262-
if (!DriverArgs.hasArg(options::OPT_fembed_bitcode_marker))
262+
if (!DriverArgs.hasArg(options::OPT_fembed_bitcode_EQ))
263263
CC1Args.push_back("-fembed-bitcode=marker");
264264
// For SPIR-V we want to retain the pristine output of Clang CodeGen, since
265265
// optimizations might lose structure / information that is necessary for

clang/test/Driver/hip-toolchain-no-rdc.hip

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
// RUN: %clang -### --target=x86_64-linux-gnu \
4747
// RUN: --offload-arch=amdgcnspirv --offload-arch=gfx900 -fembed-bitcode=all \
4848
// RUN: %s -nogpuinc -nogpulib \
49-
// RUN: 2>&1 | FileCheck -check-prefixes=AMDGCNSPIRV-EMBED %s
49+
// RUN: 2>&1 | FileCheck -check-prefixes="AMDGCNSPIRV-EMBED,AMDGCNSPIRV-NOMARKER" %s
5050

5151
// RUN: %clang -### --target=x86_64-linux-gnu \
5252
// RUN: --offload-arch=amdgcnspirv --offload-arch=gfx900 -fembed-bitcode=off \
5353
// RUN: %s -nogpuinc -nogpulib \
54-
// RUN: 2>&1 | FileCheck -check-prefixes=AMDGCNSPIRV %s
54+
// RUN: 2>&1 | FileCheck -check-prefixes=AMDGCNSPIRV-NOMARKER %s
5555

5656
//
5757
// Compile device code in a.cu to code object for gfx803.
@@ -228,5 +228,7 @@
228228
// AMDGCNSPIRV-SAME: "-input=[[AMDGCNSPV_CO]]" "-input=[[GFX900_CO]]"
229229

230230
// Only check that no confliction options are passed
231-
// AMDGCNSPIRV-EMBED: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-emit-llvm-bc" {{.*}}"-fembed-bitcode=marker" "-disable-llvm-passes" {{.*}} "-o" "[[AMDGCNSPV_MARKER_BC:.*bc]]"
232-
// AMDGCNSPIRV-EMBED: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-emit-llvm-bc" {{.*}}"-fembed-bitcode=all"{{.*}}"-fembed-bitcode=marker" {{.*}} "-o" "[[AMDGCNSPV_BC:.*bc]]" "-x" "ir" "[[AMDGCNSPV_MARKER_BC]]"
231+
// AMDGCNSPIRV-NOMARKER-NOT: "-fembed-bitcode=marker"
232+
// AMDGCNSPIRV-NOMARKER-NOT: "-fembed-bitcode-marker"
233+
// AMDGCNSPIRV-EMBED: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-emit-llvm-bc" {{.*}} "-disable-llvm-passes" {{.*}} "-o" "[[AMDGCNSPV_FIRST_BC:.*bc]]"
234+
// AMDGCNSPIRV-EMBED: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-emit-llvm-bc" {{.*}}"-fembed-bitcode=all"{{.*}} "-o" "[[AMDGCNSPV_BC:.*bc]]" "-x" "ir" "[[AMDGCNSPV_FIRST_BC]]"

0 commit comments

Comments
 (0)