Debian Codegraph @

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

raw
1 ; RUN: opt -S -passes=spirv-legalize-zero-size-arrays -mtriple=spirv64-unknown-unknown < %s | FileCheck %s
2
3 ; Test that insertvalue of zero-size array is removed.
4
5 ; Can't run spirv-val as function signatures are not handled.
6 ; RUNx: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
7
8 %struct.with_zero = type { i32, [0 x i32], i64 }
9
10 define void @test_insertvalue_zero_array(ptr %ptr, %struct.with_zero %s) {
11 ; CHECK-LABEL: @test_insertvalue_zero_array(
12 ; CHECK-NEXT: [[AGG:%.*]] = insertvalue %struct.with_zero %s, i32 42, 0
13 ; CHECK-NEXT: store %struct.with_zero [[AGG]], ptr %ptr
14 ; CHECK-NEXT: ret void
15 %agg = insertvalue %struct.with_zero %s, i32 42, 0
16 %result = insertvalue %struct.with_zero %agg, [0 x i32] zeroinitializer, 1
17 store %struct.with_zero %result, ptr %ptr
18 ret void
19 }