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

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 04:49:16 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)
----------------
farzonl wrote:

While Spirv and other shader languages might support 8bit types HLSL does not. They are not currently representable via HLSL. Since this test is using HLSL in the attributes are we sure we are doing the right fix?

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


More information about the llvm-commits mailing list