1 ; RUN: llc < %s | FileCheck %s
2 ; RUN: %if ptxas %{ llc < %s | %ptxas-verify %}
4 target triple = "nvptx64-nvidia-cuda"
6 declare void @llvm.nvvm.barrier0()
8 ; Load a value, then syncthreads. Branch, and use the loaded value only on one
9 ; side of the branch. The load shouldn't be sunk beneath the call, because
10 ; syncthreads is modeled as maystore.
11 define i32 @f(i32 %x, ptr %ptr, i1 %cond) {
14 %ptr_val = load i32, ptr %ptr
16 call void @llvm.nvvm.barrier0()
17 br i1 %cond, label %L1, label %L2
19 %ptr_val2 = add i32 %ptr_val, 100
22 %v4 = phi i32 [ %x, %Start ], [ %ptr_val2, %L1 ]
23 %v5 = add i32 %v4, 1000