[PATCH] D130766: [SPIR-V] Disable opaque pointers in relese 15
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 29 05:49:17 PDT 2022
Anastasia created this revision.
Anastasia added reviewers: svenvh, iliya-diyachkov.
Herald added a subscriber: ebevhan.
Herald added a project: All.
Anastasia requested review of this revision.
Herald added a subscriber: MaskRay.
As discussed on RFC mapping into SPIR-V requires pointer being preserved in some cases: https://discourse.llvm.org/t/rfc-better-support-for-typed-pointers-in-an-opaque-pointer-world/63339/23?u=anastasiastulova
As the work is still unfinished the best approach is to continue using pointer types.
Note that this change is only planned to be committed in release 15 branch.
This fixing PR56660.
https://reviews.llvm.org/D130766
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/spirv-toolchain.cl
Index: clang/test/Driver/spirv-toolchain.cl
===================================================================
--- clang/test/Driver/spirv-toolchain.cl
+++ clang/test/Driver/spirv-toolchain.cl
@@ -6,6 +6,7 @@
// RUN: %clang -### --target=spirv64 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
// SPV64: "-cc1" "-triple" "spirv64"
+// SPV64-SAME: "-no-opaque-pointers"
// SPV64-SAME: "-o" [[BC:".*bc"]]
// SPV64: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
@@ -16,6 +17,7 @@
// RUN: %clang -### --target=spirv32 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
// SPV32: "-cc1" "-triple" "spirv32"
+// SPV32-SAME: "-no-opaque-pointers"
// SPV32-SAME: "-o" [[BC:".*bc"]]
// SPV32: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4630,8 +4630,13 @@
TC.addClangWarningOptions(CmdArgs);
// FIXME: Subclass ToolChain for SPIR and move this to addClangWarningOptions.
- if (Triple.isSPIR() || Triple.isSPIRV())
+ if (Triple.isSPIR() || Triple.isSPIRV()) {
CmdArgs.push_back("-Wspir-compat");
+ // SPIR-V support still needs pointer types in some cases as recovering
+ // type from pointer uses is not always possible e.g. for extern functions
+ // (see PR56660).
+ CmdArgs.push_back("-no-opaque-pointers");
+ }
// Select the appropriate action.
RewriteKind rewriteKind = RK_None;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130766.448600.patch
Type: text/x-patch
Size: 1523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220729/53490240/attachment.bin>
More information about the cfe-commits
mailing list