
This PR: * adds support for G_SPLAT_VECTOR generic opcode that may be legally generated instead of G_BUILD_VECTOR by previous passes of the translator (see https://github.com/llvm/llvm-project/pull/80378 for the source of breaking changes); * improves deduction of types for opaque pointers. This PR also fixes the following issues: * if a function has ptr argument(s), two functions that have different SPIR-V type definitions may get identical LLVM function types and break agreements of global register and duplicate checker; * checks for pointer types do not account for TypedPointerType. Update of tests: * A test case is added to cover the issue with function ptr parameters. * The first case, that is support for G_SPLAT_VECTOR generic opcode, is covered by existing test cases. * Multiple additional checks by `spirv-val` is added to cover more possibilities of generation of invalid code.
24 lines
1005 B
LLVM
24 lines
1005 B
LLVM
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
|
|
; TODO: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
|
|
|
|
; CHECK-SPIRV: OpName %[[#PTR_ID:]] "ptr"
|
|
; CHECK-SPIRV: OpName %[[#PTR2_ID:]] "ptr2"
|
|
; CHECK-SPIRV-DAG: OpDecorate %[[#PTR_ID]] MaxByteOffset 12
|
|
; CHECK-SPIRV-DAG: OpDecorate %[[#PTR2_ID]] MaxByteOffset 123
|
|
; CHECK-SPIRV: %[[#CHAR_T:]] = OpTypeInt 8 0
|
|
; CHECK-SPIRV: %[[#CHAR_PTR_T:]] = OpTypePointer Workgroup %[[#CHAR_T]]
|
|
; CHECK-SPIRV: %[[#PTR_ID]] = OpFunctionParameter %[[#CHAR_PTR_T]]
|
|
; CHECK-SPIRV: %[[#PTR2_ID]] = OpFunctionParameter %[[#CHAR_PTR_T]]
|
|
|
|
define spir_kernel void @worker(i8 addrspace(3)* dereferenceable(12) %ptr) {
|
|
entry:
|
|
%ptr.addr = alloca i8 addrspace(3)*, align 4
|
|
store i8 addrspace(3)* %ptr, i8 addrspace(3)** %ptr.addr, align 4
|
|
ret void
|
|
}
|
|
|
|
define spir_func void @not_a_kernel(i8 addrspace(3)* dereferenceable(123) %ptr2) {
|
|
entry:
|
|
ret void
|
|
}
|