[llvm] d0081aa - [NFC][SPIRV] Make the zero-length-array.ll test explicit about what is generated (#166910)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 10 00:38:20 PST 2025


Author: Juan Manuel Martinez CaamaƱo
Date: 2025-11-10T08:38:15Z
New Revision: d0081aa92923cf5ee1d2ec4c6191a492c5a8cf25

URL: https://github.com/llvm/llvm-project/commit/d0081aa92923cf5ee1d2ec4c6191a492c5a8cf25
DIFF: https://github.com/llvm/llvm-project/commit/d0081aa92923cf5ee1d2ec4c6191a492c5a8cf25.diff

LOG: [NFC][SPIRV] Make the zero-length-array.ll test explicit about what is generated (#166910)

This patch doesn't change anything. Just adds more explicit checks to
verify what is generated in this case when an alloca has a zero-sized
array.

I'd expect an `OpRuntimeArray`, but nothing is generated.

Added: 
    

Modified: 
    llvm/test/CodeGen/SPIRV/zero-length-array.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/SPIRV/zero-length-array.ll b/llvm/test/CodeGen/SPIRV/zero-length-array.ll
index 666176c87adb6..5fd94d25dfd87 100644
--- a/llvm/test/CodeGen/SPIRV/zero-length-array.ll
+++ b/llvm/test/CodeGen/SPIRV/zero-length-array.ll
@@ -1,10 +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: %[[#type:]] = OpTypeInt 32 0
-; CHECK: %[[#ext:]] = OpConstant %[[#type]] 0
+; Nothing is generated, but compilation doesn't crash.
+; CHECK: OpName %[[#FOO:]] "foo"
+; CHECK: OpName %[[#RTM:]] "reg2mem alloca point"
+; CHECK: %[[#INT:]] = OpTypeInt 32 0
+; CHECK: %[[#RTM]] = OpConstant %[[#INT]] 0
+; CHECK: %[[#FOO]] = OpFunction
+; CHECK-NEXT: = OpLabel
+; CHECK-NEXT: OpReturn
+; CHECK-NEXT: OpFunctionEnd
 
-define spir_func void @_Z3foov() {
+define spir_func void @foo() {
 entry:
   %i = alloca [0 x i32], align 4
   ret void


        


More information about the llvm-commits mailing list