[llvm] [SPIR-V] Fix wrong element inferred for long vectors when using ByteAdressBuffer (PR #222220)
Farzon Lotfi via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 14 07:47:38 PDT 2026
================
@@ -126,4 +129,21 @@ entry:
ret void
}
+; Verify long-vector transcendental type inference keeps the float element type.
+define void @test_long_vector_cosh() local_unnamed_addr #0 {
+; CHECK: OpFunction
+entry:
+ %2 = getelementptr [16 x float], ptr addrspace(1) @f16_1, i32 0, i32 0
+ %3 = load <16 x float>, ptr addrspace(1) %2, align 4
+
+ ; CHECK: %{{[0-9]+}} = OpExtInst %42 %1 cosh %{{[0-9]+}}
+ %4 = call <16 x float> @llvm.cosh.v16f32(<16 x float> %3)
+
+ ; CHECK: OpStore {{.*}} %{{[0-9]+}}
+ %5 = getelementptr [16 x float], ptr addrspace(1) @f16_2, i32 0, i32 0
+ store <16 x float> %4, ptr addrspace(1) %5, align 4
+ ret void
+}
----------------
farzonl wrote:
This was the original. However I was trying to replace`spv.resource.getpointer` with regular geps so these tests were specific to the regression. I'll backtrack. https://hlsl.godbolt.org/z/dnnE4GEPe
```llvm
define void @main() local_unnamed_addr #1 {
%1 = tail call token @llvm.experimental.convergence.entry()
%2 = tail call target("spirv.VulkanBuffer", [0 x i8], 12, 0) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0i8_12_0t(i32 0, i32 0, i32 1, i32 0, ptr nonnull @.str), !dbg !207
%3 = tail call target("spirv.VulkanBuffer", [0 x i8], 12, 1) @llvm.spv.resource.handlefrombinding.tspirv.VulkanBuffer_a0i8_12_1t(i32 0, i32 1, i32 1, i32 0, ptr nonnull @.str.2), !dbg !229
%4 = call ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i8_12_0t.i32(target("spirv.VulkanBuffer", [0 x i8], 12, 0) %2, i32 0) [ "convergencectrl"(token %1) ], !dbg !248
%5 = load <16 x float>, ptr addrspace(11) %4, align 4, !dbg !248
%6 = tail call reassoc nnan ninf nsz arcp afn <16 x float> @llvm.cosh.v16f32(<16 x float> %5), !dbg !252
%7 = call ptr addrspace(11) @llvm.spv.resource.getpointer.p11.tspirv.VulkanBuffer_a0i8_12_1t.i32(target("spirv.VulkanBuffer", [0 x i8], 12, 1) %3, i32 0) [ "convergencectrl"(token %1) ], !dbg !261
store <16 x float> %6, ptr addrspace(11) %7, align 4, !dbg !261
ret void
```
https://github.com/llvm/llvm-project/pull/222220
More information about the llvm-commits
mailing list