Skip to content

Commit 43e4753

Browse files
committed
Switch to using -disable-llvm-optzns. Clarify the temporary nature.
1 parent 4f39e80 commit 43e4753

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -861,9 +861,16 @@ void AMDGPUToolChain::addClangTargetOptions(
861861
// For SPIR-V we want to retain the pristine output of Clang CodeGen, since
862862
// optimizations might lose structure / information that is necessary for
863863
// generating optimal concrete AMDGPU code.
864+
// TODO: using the below option is a temporary placeholder until Clang
865+
// provides the required functionality, which essentially boils down to
866+
// -O0 being refactored / reworked to not imply optnone / remove TBAA.
867+
// Once that is added, we should pivot to that functionality, being
868+
// mindful to not corrupt the user provided and subsequently embedded
869+
// command-line (i.e. if the user asks for -O3 this is what the
870+
// finalisation should use).
864871
if (getTriple().isSPIRV() &&
865-
!DriverArgs.hasArg(options::OPT_disable_llvm_passes))
866-
CC1Args.push_back("-disable-llvm-passes");
872+
!DriverArgs.hasArg(options::OPT_disable_llvm_optzns))
873+
CC1Args.push_back("-disable-llvm-optzns");
867874

868875
if (DeviceOffloadingKind == Action::OFK_None)
869876
addOpenCLBuiltinsLib(getDriver(), DriverArgs, CC1Args);

clang/test/Driver/spirv-amd-toolchain.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
// RUN: %clang -### --target=spirv64-amd-amdhsa %s -nogpulib -nogpuinc 2>&1 \
1616
// RUN: | FileCheck %s --check-prefix=INVOCATION
17-
// INVOCATION: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-disable-llvm-passes" {{.*}} "-o" "[[OUTPUT:.+]]" "-x" "c"
17+
// INVOCATION: "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}}"-disable-llvm-optzns" {{.*}} "-o" "[[OUTPUT:.+]]" "-x" "c"
1818
// INVOCATION: "{{.*}}llvm-link" "-o" "a.out" "[[OUTPUT]]"
1919
// INVOCATION: "{{.*}}llvm-spirv" "--spirv-max-version=1.6" "--spirv-ext=+all" "--spirv-allow-unknown-intrinsics" "--spirv-lower-const-expr" "--spirv-preserve-auxdata" "--spirv-debug-info-version=nonsemantic-shader-200" "a.out" "-o" "a.out"

0 commit comments

Comments
 (0)