1; RUN: opt -mtriple=amdgcn-unknown-amdhsa -mcpu=hawaii -loop-unroll -S < %s | FileCheck %s 2 3; CHECK-LABEL: @test_unroll_convergent_barrier( 4; CHECK: call void @llvm.amdgcn.s.barrier() 5; CHECK: call void @llvm.amdgcn.s.barrier() 6; CHECK: call void @llvm.amdgcn.s.barrier() 7; CHECK: call void @llvm.amdgcn.s.barrier() 8; CHECK-NOT: br 9define void @test_unroll_convergent_barrier(i32 addrspace(1)* noalias nocapture %out, i32 addrspace(1)* noalias nocapture %in) #0 { 10entry: 11 br label %for.body 12 13for.body: ; preds = %for.body, %entry 14 %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 15 %sum.02 = phi i32 [ %add, %for.body ], [ 0, %entry ] 16 %arrayidx.in = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 %indvars.iv 17 %arrayidx.out = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 %indvars.iv 18 %load = load i32, i32 addrspace(1)* %arrayidx.in 19 call void @llvm.amdgcn.s.barrier() #1 20 %add = add i32 %load, %sum.02 21 store i32 %add, i32 addrspace(1)* %arrayidx.out 22 %indvars.iv.next = add i32 %indvars.iv, 1 23 %exitcond = icmp eq i32 %indvars.iv.next, 4 24 br i1 %exitcond, label %for.end, label %for.body 25 26for.end: ; preds = %for.body, %entry 27 ret void 28} 29 30declare void @llvm.amdgcn.s.barrier() #1 31 32attributes #0 = { nounwind } 33attributes #1 = { nounwind convergent } 34