1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s 2 3; Make sure that m0 is not reinitialized in the loop. 4 5; GCN-LABEL: {{^}}copy_local_to_global_loop_m0_init: 6; GCN: s_cbranch_scc1 BB0_3 7 8; Initialize in preheader 9; GCN: s_mov_b32 m0, -1 10 11; GCN: BB0_2: 12; GCN: ds_read_b32 13; GCN: buffer_store_dword 14 15; GCN: s_cbranch_vccz BB0_2 16 17; GCN: BB0_3: 18; GCN-NEXT: s_endpgm 19define void @copy_local_to_global_loop_m0_init(i32 addrspace(1)* noalias nocapture %out, i32 addrspace(3)* noalias nocapture readonly %in, i32 %n) #0 { 20bb: 21 %tmp = icmp sgt i32 %n, 0 22 br i1 %tmp, label %.lr.ph.preheader, label %._crit_edge 23 24.lr.ph.preheader: ; preds = %bb 25 br label %.lr.ph 26 27._crit_edge.loopexit: ; preds = %.lr.ph 28 br label %._crit_edge 29 30._crit_edge: ; preds = %._crit_edge.loopexit, %bb 31 ret void 32 33.lr.ph: ; preds = %.lr.ph, %.lr.ph.preheader 34 %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph.preheader ] 35 %i.01 = phi i32 [ %tmp4, %.lr.ph ], [ 0, %.lr.ph.preheader ] 36 %tmp1 = getelementptr inbounds i32, i32 addrspace(3)* %in, i32 %i.01 37 %tmp2 = load i32, i32 addrspace(3)* %tmp1, align 4 38 %tmp3 = getelementptr inbounds i32, i32 addrspace(1)* %out, i64 %indvars.iv 39 store i32 %tmp2, i32 addrspace(1)* %tmp3, align 4 40 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 41 %tmp4 = add nuw nsw i32 %i.01, 1 42 %lftr.wideiv = trunc i64 %indvars.iv.next to i32 43 %exitcond = icmp eq i32 %lftr.wideiv, %n 44 br i1 %exitcond, label %._crit_edge.loopexit, label %.lr.ph 45} 46 47attributes #0 = { nounwind } 48