Files
clang-p2996/llvm/test/CodeGen/SPIRV/pointers/global-zeroinitializer.ll
Vyacheslav Levytskyy 0d9172ecac [SPIR-V] Improve pattern matching and tracking of constant integers (#96615)
This PR fixes the issue
https://github.com/llvm/llvm-project/issues/96614 by improve pattern
matching and tracking of constant integers. The attached test is
successful if it doesn't crash and generate valid SPIR-V code for both
32 and 64 bits targets.
2024-06-26 19:38:51 +02:00

25 lines
1.1 KiB
LLVM

; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
; CHECK: OpName %[[#Var:]] "var"
; CHECK-DAG: %[[#Char:]] = OpTypeInt 8 0
; CHECK-DAG: %[[#Vec2Char:]] = OpTypeVector %[[#Char]] 2
; CHECK-DAG: %[[#PtrVec2Char:]] = OpTypePointer CrossWorkgroup %[[#Vec2Char]]
; CHECK-DAG: %[[#ConstNull:]] = OpConstantNull %[[#Vec2Char]]
; CHECK: %[[#]] = OpVariable %[[#PtrVec2Char]] CrossWorkgroup %[[#ConstNull]]
; As an option: %[[#C0:]] = OpConstant %[[#Char]] 0
; %[[#VecZero:]] = OpConstantComposite %[[#Vec2Char]] %[[#C0]] %[[#C0]]
; %[[#]] = OpVariable %[[#PtrVec2Char]] CrossWorkgroup %[[#VecZero]]
; CHECK: OpFunction
@var = addrspace(1) global <2 x i8> zeroinitializer
define spir_kernel void @foo() {
entry:
%addr = load <2 x i8>, ptr addrspace(1) @var, align 2
ret void
}