[llvm] [HLSL][SPIRV] Legalize reinterpretation ptrcasts for byte-addressable buffers (PR #212999)

Tim Corringham via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 05:05:39 PDT 2026


================
@@ -0,0 +1,17 @@
+; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - | FileCheck %s
+; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}
+
+; CHECK: OpAccessChain
+; CHECK: OpStore
+
+ at .str = private unnamed_addr constant [4 x i8] c"Buf\00", align 1
+
+define void @main() local_unnamed_addr #0 {
+entry:
+  %handle = tail call target("spirv.VulkanBuffer", [0 x i8], 12, 0) @llvm.spv.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr nonnull @.str)
----------------
tcorringham wrote:

The i8  is a by-product of the codegen for byte addressable buffers - it works apart from the spirv legalizer not currently supporting that case. I expect things could be done differently but this seems like the least invasive solution.


https://github.com/llvm/llvm-project/pull/212999


More information about the llvm-commits mailing list