1 ; RUN: opt < %s -O3 -S | FileCheck %s
3 ; Make sure the call to syncthreads is not duplicate here by the LLVM
4 ; optimizations, because it has the noduplicate attribute set.
6 ; CHECK: call void @llvm.nvvm.barrier0
7 ; CHECK-NOT: call void @llvm.nvvm.barrier0
9 ; Function Attrs: nounwind
10 define void @foo(ptr %output) #1 {
12 %output.addr = alloca ptr, align 8
13 store ptr %output, ptr %output.addr, align 8
14 %0 = load ptr, ptr %output.addr, align 8
15 %1 = load float, ptr %0, align 4
16 %conv = fpext float %1 to double
17 %cmp = fcmp olt double %conv, 1.000000e+01
18 br i1 %cmp, label %if.then, label %if.else
20 if.then: ; preds = %entry
21 %2 = load ptr, ptr %output.addr, align 8
22 %3 = load float, ptr %2, align 4
23 %conv1 = fpext float %3 to double
24 %add = fadd double %conv1, 1.000000e+00
25 %conv2 = fptrunc double %add to float
26 store float %conv2, ptr %2, align 4
29 if.else: ; preds = %entry
30 %4 = load ptr, ptr %output.addr, align 8
31 %5 = load float, ptr %4, align 4
32 %conv3 = fpext float %5 to double
33 %add4 = fadd double %conv3, 2.000000e+00
34 %conv5 = fptrunc double %add4 to float
35 store float %conv5, ptr %4, align 4
38 if.end: ; preds = %if.else, %if.then
39 call void @llvm.nvvm.barrier0()
40 %6 = load ptr, ptr %output.addr, align 8
41 %7 = load float, ptr %6, align 4
42 %conv7 = fpext float %7 to double
43 %cmp8 = fcmp olt double %conv7, 1.000000e+01
44 br i1 %cmp8, label %if.then9, label %if.else13
46 if.then9: ; preds = %if.end
47 %8 = load ptr, ptr %output.addr, align 8
48 %9 = load float, ptr %8, align 4
49 %conv10 = fpext float %9 to double
50 %add11 = fadd double %conv10, 3.000000e+00
51 %conv12 = fptrunc double %add11 to float
52 store float %conv12, ptr %8, align 4
55 if.else13: ; preds = %if.end
56 %10 = load ptr, ptr %output.addr, align 8
57 %11 = load float, ptr %10, align 4
58 %conv14 = fpext float %11 to double
59 %add15 = fadd double %conv14, 4.000000e+00
60 %conv16 = fptrunc double %add15 to float
61 store float %conv16, ptr %10, align 4
64 if.end17: ; preds = %if.else13, %if.then9
68 ; Function Attrs: noduplicate nounwind
69 declare void @llvm.nvvm.barrier0() #2
71 !0 = !{ptr @foo, !"kernel", i32 1}
72 !1 = !{null, !"align", i32 8}