brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.8 KiB · 8fa8c2c Raw
183 lines · plain
1; RUN: llc -mtriple=spirv-unknown-vulkan-compute -O0 %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}3 4;5; int process() {6;   int c = 0;7;   int val = 0;8;9;   // Both then and else10;   if (c) {11;     val = val + 1;12;   } else {13;     val = val + 2;14;   }15;16;   // No else17;   if (c)18;     val = 1;19;20;   // Empty then21;   if (c) {22;   } else {23;     val = 2;24;   }25;26;   // Null body27;   if (c)28;     ;29;30;   if (int d = val) {31;     c = true;32;   }33;34;   return val;35; }36;37; [numthreads(1, 1, 1)]38; void main() {39;   process();40; }41 42; CHECK: %[[#func_10:]] = OpFunction %[[#uint:]] DontInline %[[#]]43; CHECK:    %[[#bb34:]] = OpLabel44; CHECK:                  OpSelectionMerge %[[#bb35:]] None45; CHECK:                  OpBranchConditional %[[#]] %[[#bb36:]] %[[#bb37:]]46; CHECK:    %[[#bb36:]] = OpLabel47; CHECK:                  OpBranch %[[#bb35:]]48; CHECK:    %[[#bb37:]] = OpLabel49; CHECK:                  OpBranch %[[#bb35:]]50; CHECK:    %[[#bb35:]] = OpLabel51; CHECK:                  OpSelectionMerge %[[#bb38:]] None52; CHECK:                  OpBranchConditional %[[#]] %[[#bb39:]] %[[#bb38:]]53; CHECK:    %[[#bb39:]] = OpLabel54; CHECK:                  OpBranch %[[#bb38:]]55; CHECK:    %[[#bb38:]] = OpLabel56; CHECK:                  OpSelectionMerge %[[#bb40:]] None57; CHECK:                  OpBranchConditional %[[#]] %[[#bb40:]] %[[#bb41:]]58; CHECK:    %[[#bb41:]] = OpLabel59; CHECK:                  OpBranch %[[#bb40:]]60; CHECK:    %[[#bb40:]] = OpLabel61; CHECK:                  OpBranch %[[#bb42:]]62; CHECK:    %[[#bb42:]] = OpLabel63; CHECK:                  OpSelectionMerge %[[#bb43:]] None64; CHECK:                  OpBranchConditional %[[#]] %[[#bb44:]] %[[#bb43:]]65; CHECK:    %[[#bb44:]] = OpLabel66; CHECK:                  OpBranch %[[#bb43:]]67; CHECK:    %[[#bb43:]] = OpLabel68; CHECK:                  OpReturnValue %[[#]]69; CHECK:                  OpFunctionEnd70; CHECK: %[[#func_30:]] = OpFunction %[[#void:]] DontInline %[[#]]71; CHECK:    %[[#bb45:]] = OpLabel72; CHECK:                  OpReturn73; CHECK:                  OpFunctionEnd74; CHECK: %[[#func_32:]] = OpFunction %[[#void:]] None %[[#]]75; CHECK:    %[[#bb46:]] = OpLabel76; CHECK:                  OpReturn77; CHECK:                  OpFunctionEnd78 79target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"80target triple = "spirv-unknown-vulkan1.3-compute"81 82; Function Attrs: convergent noinline norecurse nounwind optnone83define spir_func noundef i32 @_Z7processv() #0 {84entry:85  %0 = call token @llvm.experimental.convergence.entry()86  %c = alloca i32, align 487  %val = alloca i32, align 488  %d = alloca i32, align 489  store i32 0, ptr %c, align 490  store i32 0, ptr %val, align 491  %1 = load i32, ptr %c, align 492  %tobool = icmp ne i32 %1, 093  br i1 %tobool, label %if.then, label %if.else94 95if.then:                                          ; preds = %entry96  %2 = load i32, ptr %val, align 497  %add = add nsw i32 %2, 198  store i32 %add, ptr %val, align 499  br label %if.end100 101if.else:                                          ; preds = %entry102  %3 = load i32, ptr %val, align 4103  %add1 = add nsw i32 %3, 2104  store i32 %add1, ptr %val, align 4105  br label %if.end106 107if.end:                                           ; preds = %if.else, %if.then108  %4 = load i32, ptr %c, align 4109  %tobool2 = icmp ne i32 %4, 0110  br i1 %tobool2, label %if.then3, label %if.end4111 112if.then3:                                         ; preds = %if.end113  store i32 1, ptr %val, align 4114  br label %if.end4115 116if.end4:                                          ; preds = %if.then3, %if.end117  %5 = load i32, ptr %c, align 4118  %tobool5 = icmp ne i32 %5, 0119  br i1 %tobool5, label %if.then6, label %if.else7120 121if.then6:                                         ; preds = %if.end4122  br label %if.end8123 124if.else7:                                         ; preds = %if.end4125  store i32 2, ptr %val, align 4126  br label %if.end8127 128if.end8:                                          ; preds = %if.else7, %if.then6129  %6 = load i32, ptr %c, align 4130  %tobool9 = icmp ne i32 %6, 0131  br i1 %tobool9, label %if.then10, label %if.end11132 133if.then10:                                        ; preds = %if.end8134  br label %if.end11135 136if.end11:                                         ; preds = %if.then10, %if.end8137  %7 = load i32, ptr %val, align 4138  store i32 %7, ptr %d, align 4139  %8 = load i32, ptr %d, align 4140  %tobool12 = icmp ne i32 %8, 0141  br i1 %tobool12, label %if.then13, label %if.end14142 143if.then13:                                        ; preds = %if.end11144  store i32 1, ptr %c, align 4145  br label %if.end14146 147if.end14:                                         ; preds = %if.then13, %if.end11148  %9 = load i32, ptr %val, align 4149  ret i32 %9150}151 152; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)153declare token @llvm.experimental.convergence.entry() #1154 155; Function Attrs: convergent noinline norecurse nounwind optnone156define internal spir_func void @main() #0 {157entry:158  %0 = call token @llvm.experimental.convergence.entry()159  %call1 = call spir_func noundef i32 @_Z7processv() #3 [ "convergencectrl"(token %0) ]160  ret void161}162 163; Function Attrs: convergent norecurse164define void @main.1() #2 {165entry:166  call void @main()167  ret void168}169 170attributes #0 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }171attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }172attributes #2 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }173attributes #3 = { convergent }174 175!llvm.module.flags = !{!0, !1, !2}176 177 178!0 = !{i32 1, !"wchar_size", i32 4}179!1 = !{i32 4, !"dx.disable_optimizations", i32 1}180!2 = !{i32 7, !"frame-pointer", i32 2}181 182 183