3 ;; __global struct Node* pNext;
6 ;; __kernel void verify_linked_lists(__global Node* pNodes)
8 ;; __global Node *pNode = pNodes;
10 ;; for(int j=0; j < 10; j++) {
11 ;; pNode = pNode->pNext;
15 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
18 %struct.Node = type { %struct.Node.0 addrspace(1)* }
19 %struct.Node.0 = type opaque
21 define spir_kernel void @verify_linked_lists(%struct.Node addrspace(1)* %pNodes) {
25 for.cond: ; preds = %for.inc, %entry
26 %pNode.0 = phi %struct.Node addrspace(1)* [ %pNodes, %entry ], [ %1, %for.inc ]
27 %j.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
28 ; CHECK-SPIRV: %[[#]] = OpPhi %[[#]] %[[#]] %[[#]] %[[#BitcastResultId:]] %[[#]]
29 ; CHECK-SPIRV-NEXT: OpPhi
31 %cmp = icmp slt i32 %j.0, 10
32 br i1 %cmp, label %for.body, label %for.end
34 for.body: ; preds = %for.cond
35 %pNext = getelementptr inbounds %struct.Node, %struct.Node addrspace(1)* %pNode.0, i32 0, i32 0
37 %0 = load %struct.Node.0 addrspace(1)*, %struct.Node.0 addrspace(1)* addrspace(1)* %pNext, align 4
38 %1 = bitcast %struct.Node.0 addrspace(1)* %0 to %struct.Node addrspace(1)*
39 ; CHECK-SPIRV: %[[#LoadResultId:]] = OpLoad %[[#]]
40 ; CHECK-SPIRV: %[[#BitcastResultId]] = OpBitcast %[[#]] %[[#LoadResultId]]
44 for.inc: ; preds = %for.body
45 %inc = add nsw i32 %j.0, 1
48 for.end: ; preds = %for.cond