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