brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.3 KiB · 8e05bf1 Raw
169 lines · plain
1; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan-compute %s -o - -filetype=obj | spirv-val %}2 3; int foo() { return true; }4;5; int process() {6;   int val = 0;7;   int i = 0;8;9;   do {10;     ++i;11;     if (i > 5) {12;       break;13;       break;       // No SPIR-V should be emitted for this statement.14;       val = i;     // No SPIR-V should be emitted for this statement.15;       while(true); // No SPIR-V should be emitted for this statement.16;     }17;18;     val = i;19;     {20;       {21;         break;22;       }23;     }24;     val = val * 2; // No SPIR-V should be emitted for this statement.25;26;   } while (i < 10);27;28;   ////////////////////////////////////////////////////////////////////////////////29;   // Nested do-while loops with break statements                                //30;   // Each break statement should branch to the corresponding loop's break block //31;   ////////////////////////////////////////////////////////////////////////////////32;33;   do {34;     ++i;35;36;     do {37;       ++val;38;       break;39;     } while (i < 10);40;41;     --i;42;43;     {44;       break;45;     }46;47;   } while(val < 10);48;49;   return val;50; }51;52; [numthreads(1, 1, 1)]53; void main() {54;   process();55; }56 57target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-G1"58target triple = "spirv-unknown-vulkan1.3-compute"59 60; Function Attrs: convergent noinline nounwind optnone61define spir_func noundef i32 @_Z3foov() #0 {62entry:63  %0 = call token @llvm.experimental.convergence.entry()64  ret i32 165}66 67; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)68declare token @llvm.experimental.convergence.entry() #169 70; Function Attrs: convergent noinline nounwind optnone71define spir_func noundef i32 @_Z7processv() #0 {72entry:73  %0 = call token @llvm.experimental.convergence.entry()74  %val = alloca i32, align 475  %i = alloca i32, align 476  store i32 0, ptr %val, align 477  store i32 0, ptr %i, align 478  br label %do.body79 80do.body:                                          ; preds = %do.cond, %entry81  %1 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]82  %2 = load i32, ptr %i, align 483  %inc = add nsw i32 %2, 184  store i32 %inc, ptr %i, align 485  %3 = load i32, ptr %i, align 486  %cmp = icmp sgt i32 %3, 587  br i1 %cmp, label %if.then, label %if.end88 89if.then:                                          ; preds = %do.body90  br label %do.end91 92if.end:                                           ; preds = %do.body93  %4 = load i32, ptr %i, align 494  store i32 %4, ptr %val, align 495  br label %do.end96 97do.cond:                                          ; No predecessors!98  %5 = load i32, ptr %i, align 499  %cmp1 = icmp slt i32 %5, 10100  br i1 %cmp1, label %do.body, label %do.end101 102do.end:                                           ; preds = %do.cond, %if.end, %if.then103  br label %do.body2104 105do.body2:                                         ; preds = %do.cond9, %do.end106  %6 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]107  %7 = load i32, ptr %i, align 4108  %inc3 = add nsw i32 %7, 1109  store i32 %inc3, ptr %i, align 4110  br label %do.body4111 112do.body4:                                         ; preds = %do.cond6, %do.body2113  %8 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %6) ]114  %9 = load i32, ptr %val, align 4115  %inc5 = add nsw i32 %9, 1116  store i32 %inc5, ptr %val, align 4117  br label %do.end8118 119do.cond6:                                         ; No predecessors!120  %10 = load i32, ptr %i, align 4121  %cmp7 = icmp slt i32 %10, 10122  br i1 %cmp7, label %do.body4, label %do.end8123 124do.end8:                                          ; preds = %do.cond6, %do.body4125  %11 = load i32, ptr %i, align 4126  %dec = add nsw i32 %11, -1127  store i32 %dec, ptr %i, align 4128  br label %do.end11129 130do.cond9:                                         ; No predecessors!131  %12 = load i32, ptr %val, align 4132  %cmp10 = icmp slt i32 %12, 10133  br i1 %cmp10, label %do.body2, label %do.end11134 135do.end11:                                         ; preds = %do.cond9, %do.end8136  %13 = load i32, ptr %val, align 4137  ret i32 %13138}139 140; Function Attrs: convergent nocallback nofree nosync nounwind willreturn memory(none)141declare token @llvm.experimental.convergence.loop() #1142 143; Function Attrs: convergent noinline norecurse nounwind optnone144define internal spir_func void @main() #2 {145entry:146  %0 = call token @llvm.experimental.convergence.entry()147  %call1 = call spir_func noundef i32 @_Z7processv() #4 [ "convergencectrl"(token %0) ]148  ret void149}150 151; Function Attrs: convergent norecurse152define void @main.1() #3 {153entry:154  call void @main()155  ret void156}157 158attributes #0 = { convergent noinline nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }159attributes #1 = { convergent nocallback nofree nosync nounwind willreturn memory(none) }160attributes #2 = { convergent noinline norecurse nounwind optnone "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }161attributes #3 = { convergent norecurse "frame-pointer"="all" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }162attributes #4 = { convergent }163 164!llvm.module.flags = !{!0, !1, !2}165 166!0 = !{i32 1, !"wchar_size", i32 4}167!1 = !{i32 4, !"dx.disable_optimizations", i32 1}168!2 = !{i32 7, !"frame-pointer", i32 2}169