1 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
3 ;; NOTE: This does not check for structured control-flow operations.
5 ; CHECK-DAG: OpName [[FOO:%.+]] "foo"
6 ; CHECK-DAG: OpName [[BAR:%.+]] "bar"
8 ; CHECK-DAG: [[I32:%.+]] = OpTypeInt 32
9 ; CHECK-DAG: [[BOOL:%.+]] = OpTypeBool
14 define i32 @test_if(i32 %a, i32 %b) {
16 %cond = icmp eq i32 %a, %b
17 br i1 %cond, label %true_label, label %false_label
28 %v = phi i32 [%v1, %true_label], [%v2, %false_label]
33 ; CHECK: [[A:%.+]] = OpFunctionParameter [[I32]]
34 ; CHECK: [[B:%.+]] = OpFunctionParameter [[I32]]
36 ; CHECK: [[ENTRY:%.+]] = OpLabel
37 ; CHECK: [[COND:%.+]] = OpIEqual [[BOOL]] [[A]] [[B]]
38 ; CHECK: OpBranchConditional [[COND]] [[TRUE_LABEL:%.+]] [[FALSE_LABEL:%.+]]
40 ; CHECK: [[TRUE_LABEL]] = OpLabel
41 ; CHECK: [[V1:%.+]] = OpFunctionCall [[I32]] [[FOO]]
42 ; CHECK: OpBranch [[MERGE_LABEL:%.+]]
44 ; CHECK: [[FALSE_LABEL]] = OpLabel
45 ; CHECK: [[V2:%.+]] = OpFunctionCall [[I32]] [[BAR]]
46 ; CHECK: OpBranch [[MERGE_LABEL]]
48 ; CHECK: [[MERGE_LABEL]] = OpLabel
49 ; CHECK-NEXT: [[V:%.+]] = OpPhi [[I32]] [[V1]] [[TRUE_LABEL]] [[V2]] [[FALSE_LABEL]]
50 ; CHECK: OpReturnValue [[V]]
51 ; CHECK-NEXT: OpFunctionEnd