1 ; The goal of the test is to check that internal intrinsic functions for PHI's
2 ; operand are inserted at the correct positions, and don't break rules of
3 ; instruction domination and PHI nodes grouping at top of basic block.
5 ; RUN: llc -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s
6 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
8 ; CHECK-DAG: OpName %[[#Foo:]] "foo"
9 ; CHECK-DAG: OpName %[[#Bar:]] "bar"
10 ; CHECK: %[[#Foo]] = OpFunction
15 ; CHECK: %[[#Bar]] = OpFunction
21 %struct = type { i64, i64 }
23 define spir_kernel void @foo(i64 %arg_val, ptr addrspace(4) byval(%struct) %arg_ptr) {
25 %fl = icmp eq i64 %arg_val, 0
26 br i1 %fl, label %ok, label %err
32 %r1 = phi i64 [ undef, %err ], [ %arg_val, %entry ]
33 %r2 = phi i64 [ undef, %err ], [ %arg_val, %entry ]
34 %r3 = phi ptr addrspace(4) [ undef, %err ], [ %arg_ptr, %entry ]
35 %r4 = phi ptr addrspace(4) [ undef, %err ], [ %arg_ptr, %entry ]
42 define spir_kernel void @bar(i64 %arg_val, i64 %arg_val_def, ptr addrspace(4) byval(%struct) %arg_ptr, ptr addrspace(4) %arg_ptr_def) {
44 %fl = icmp eq i64 %arg_val, 0
45 br i1 %fl, label %ok, label %err
51 %r1 = phi i64 [ %arg_val_def, %err ], [ %arg_val, %entry ]
52 %r2 = phi i64 [ %arg_val_def, %err ], [ %arg_val, %entry ]
53 %r3 = phi ptr addrspace(4) [ %arg_ptr_def, %err ], [ %arg_ptr, %entry ]
54 %r4 = phi ptr addrspace(4) [ %arg_ptr_def, %err ], [ %arg_ptr, %entry ]