1; RUN: opt -passes=openmp-opt-cgscc -debug-only=openmp-opt -disable-output < %s 2>&1 | FileCheck %s 2; REQUIRES: asserts 3; ModuleID = 'single_threaded_exeuction.c' 4 5define void @kernel() { 6 call void @__kmpc_kernel_init(i32 512, i16 1) 7 call void @nvptx() 8 call void @amdgcn() 9 ret void 10} 11 12; CHECK-NOT: [openmp-opt] Basic block @nvptx entry is executed by a single thread. 13; CHECK: [openmp-opt] Basic block @nvptx if.then is executed by a single thread. 14; CHECK-NOT: [openmp-opt] Basic block @nvptx if.end is executed by a single thread. 15; Function Attrs: noinline nounwind uwtable 16define dso_local void @nvptx() { 17entry: 18 %call = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() 19 %cmp = icmp eq i32 %call, 0 20 br i1 %cmp, label %if.then, label %if.end 21 22if.then: 23 call void @bar() 24 br label %if.end 25 26if.end: 27 ret void 28} 29 30; CHECK-NOT: [openmp-opt] Basic block @amdgcn entry is executed by a single thread. 31; CHECK: [openmp-opt] Basic block @amdgcn if.then is executed by a single thread. 32; CHECK-NOT: [openmp-opt] Basic block @amdgcn if.end is executed by a single thread. 33; Function Attrs: noinline nounwind uwtable 34define dso_local void @amdgcn() { 35entry: 36 %call = call i32 @llvm.amdgcn.workitem.id.x() 37 %cmp = icmp eq i32 %call, 0 38 br i1 %cmp, label %if.then, label %if.end 39 40if.then: 41 call void @bar() 42 br label %if.end 43 44if.end: 45 ret void 46} 47 48; CHECK: [openmp-opt] Basic block @bar entry is executed by a single thread. 49; Function Attrs: noinline nounwind uwtable 50define internal void @bar() { 51entry: 52 ret void 53} 54 55declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() 56 57declare i32 @llvm.amdgcn.workitem.id.x() 58 59declare void @__kmpc_kernel_init(i32, i16) 60 61!llvm.dbg.cu = !{!0} 62!llvm.module.flags = !{!3, !4} 63!nvvm.annotations = !{!5} 64 65 66!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) 67!1 = !DIFile(filename: "single_threaded_execution.c", directory: "/tmp/single_threaded_execution.c") 68!2 = !{} 69!3 = !{i32 2, !"Debug Info Version", i32 3} 70!4 = !{i32 1, !"wchar_size", i32 4} 71!5 = !{void ()* @kernel, !"kernel", i32 1} 72