Debian Codegraph @

llvm/test/CodeGen/SPIRV/legalize-zero-size-arrays-alloca-count.ll

raw
1 ; RUN: opt -S -passes=spirv-legalize-zero-size-arrays -mtriple=spirv64-unknown-unknown < %s | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown -spirv-ext=+SPV_INTEL_variable_length_array %s -o - -filetype=obj | spirv-val %}
3
4 ; Test that zero-size array alloca with dynamic count allocates element type with count.
5
6 define void @test_alloca_with_count(i32 %n) {
7 ; CHECK-LABEL: @test_alloca_with_count(
8 ; CHECK-NEXT: [[ARR:%.*]] = alloca ptr addrspace(4), align 4
9 ; CHECK-NEXT: ret void
10 %arr = alloca [0 x i32], i32 %n, align 4
11 ret void
12 }