[llvm] [SPIRV] Do not use OpTypeRuntimeArray in Kernel env. (PR #149522)

Marcos Maronas via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 31 11:30:13 PDT 2025


================
@@ -63,20 +57,17 @@ define spir_func void @bar(ptr noundef byval(%tprange) align 8 %_arg_UserRange)
 ; CL: OpFunction
 ; CL: %[[#TestVar:]] = OpVariable
 ; CL-NEXT: OpLifetimeStart %[[#TestVar]], 1
-; CL-NEXT: OpCopyMemorySized
 ; CL-NEXT: OpInBoundsPtrAccessChain
 ; CL-NEXT: OpLifetimeStop %[[#TestVar]], 1
 
 ; VK:      OpFunction
 ; VK:      %[[#Test:]] = OpVariable
-; VK-NEXT: OpCopyMemorySized
 ; VK-NEXT: OpInBoundsAccessChain
 ; VK-NEXT: OpReturn
 define spir_func void @test(ptr noundef align 8 %_arg) {
   %var = alloca i8, align 8
   call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %var)
-  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %var, ptr align 8 %_arg, i64 1, i1 false)
-  %KernelFunc = getelementptr inbounds i8, ptr %var, i64 0
+  %KernelFunc = getelementptr inbounds i8, ptr %var, i64 1
----------------
maarquitos14 wrote:

I had to change index from 0 to 1, because otherwise `simplifyGEPInst` was optimizing it out. Let me know if that works.

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


More information about the llvm-commits mailing list