Skip to content

Commit 998827f

Browse files
committed
[Driver][SPIR-V] Use consistent tools to convert between text and binary form
Signed-off-by: Sarnie, Nick <[email protected]>
1 parent edf9439 commit 998827f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/lib/Driver/ToolChains/SPIRV.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ void SPIRV::constructTranslateCommand(Compilation &C, const Tool &T,
2828

2929
if (Input.getType() == types::TY_PP_Asm)
3030
CmdArgs.push_back("-to-binary");
31+
32+
// The text output from spirv-dis is not in the format expected
33+
// by llvm-spirv, so use the text output from llvm-spirv.
3134
if (Output.getType() == types::TY_PP_Asm)
32-
CmdArgs.push_back("--spirv-tools-dis");
35+
CmdArgs.push_back("-to-text");
3336

3437
CmdArgs.append({"-o", Output.getFilename()});
3538

clang/test/Driver/spirv-toolchain.cl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
// SPT64: "-cc1" "-triple" "spirv64"
3030
// SPT64-SAME: "-o" [[BC:".*bc"]]
31-
// SPT64: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" {{".*s"}}
31+
// SPT64: {{llvm-spirv.*"}} [[BC]] "-to-text" "-o" {{".*s"}}
3232

3333
// RUN: %clang -### --target=spirv32 -x cl -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
3434
// RUN: %clang -### --target=spirv32 -x ir -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
@@ -37,7 +37,7 @@
3737

3838
// SPT32: "-cc1" "-triple" "spirv32"
3939
// SPT32-SAME: "-o" [[BC:".*bc"]]
40-
// SPT32: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" {{".*s"}}
40+
// SPT32: {{llvm-spirv.*"}} [[BC]] "-to-text" "-o" {{".*s"}}
4141

4242
//-----------------------------------------------------------------------------
4343
// Check assembly input -> object output
@@ -55,7 +55,7 @@
5555
// TMP: "-cc1" "-triple" "spirv64"
5656
// TMP-SAME: "-o" [[BC:".*bc"]]
5757
// TMP-SAME: [[I]]
58-
// TMP: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" [[S:".*s"]]
58+
// TMP: {{llvm-spirv.*"}} [[BC]] "-to-text" "-o" [[S:".*s"]]
5959
// TMP: {{llvm-spirv.*"}} [[S]] "-to-binary" "-o" {{".*o"}}
6060

6161
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)