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