1*9880d681SAndroid Build Coastguard Worker; REQUIRES: asserts 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=thumb-eabi -mcpu=swift -pre-RA-sched=source -join-globalcopies -enable-misched -verify-misched -debug-only=misched -arm-atomic-cfg-tidy=0 %s -o - 2>&1 | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker; 4*9880d681SAndroid Build Coastguard Worker; Loop counter copies should be eliminated. 5*9880d681SAndroid Build Coastguard Worker; There is also a MUL here, but we don't care where it is scheduled. 6*9880d681SAndroid Build Coastguard Worker; CHECK: postinc 7*9880d681SAndroid Build Coastguard Worker; CHECK: *** Final schedule for BB#2 *** 8*9880d681SAndroid Build Coastguard Worker; CHECK: t2LDRs 9*9880d681SAndroid Build Coastguard Worker; CHECK: t2ADDrr 10*9880d681SAndroid Build Coastguard Worker; CHECK: t2CMPrr 11*9880d681SAndroid Build Coastguard Worker; CHECK: COPY 12*9880d681SAndroid Build Coastguard Workerdefine i32 @postinc(i32 %a, i32* nocapture %d, i32 %s) nounwind { 13*9880d681SAndroid Build Coastguard Workerentry: 14*9880d681SAndroid Build Coastguard Worker %cmp4 = icmp eq i32 %a, 0 15*9880d681SAndroid Build Coastguard Worker br i1 %cmp4, label %for.end, label %for.body 16*9880d681SAndroid Build Coastguard Worker 17*9880d681SAndroid Build Coastguard Workerfor.body: ; preds = %entry, %for.body 18*9880d681SAndroid Build Coastguard Worker %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ] 19*9880d681SAndroid Build Coastguard Worker %s.05 = phi i32 [ %mul, %for.body ], [ 0, %entry ] 20*9880d681SAndroid Build Coastguard Worker %indvars.iv.next = add i32 %indvars.iv, %s 21*9880d681SAndroid Build Coastguard Worker %arrayidx = getelementptr inbounds i32, i32* %d, i32 %indvars.iv 22*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %arrayidx, align 4 23*9880d681SAndroid Build Coastguard Worker %mul = mul nsw i32 %0, %s.05 24*9880d681SAndroid Build Coastguard Worker %exitcond = icmp eq i32 %indvars.iv.next, %a 25*9880d681SAndroid Build Coastguard Worker br i1 %exitcond, label %for.end, label %for.body 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Workerfor.end: ; preds = %for.body, %entry 28*9880d681SAndroid Build Coastguard Worker %s.0.lcssa = phi i32 [ 0, %entry ], [ %mul, %for.body ] 29*9880d681SAndroid Build Coastguard Worker ret i32 %s.0.lcssa 30*9880d681SAndroid Build Coastguard Worker} 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker 33*9880d681SAndroid Build Coastguard Worker; This case was a crasher in constrainLocalCopy. 34*9880d681SAndroid Build Coastguard Worker; The problem was the t2LDR_PRE defining both the global and local lrg. 35*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: *** Final schedule for BB#5 *** 36*9880d681SAndroid Build Coastguard Worker; CHECK: %[[R4:vreg[0-9]+]]<def>, %[[R1:vreg[0-9]+]]<def,tied2> = t2LDR_PRE %[[R1]]<tied1> 37*9880d681SAndroid Build Coastguard Worker; CHECK: %vreg{{[0-9]+}}<def> = COPY %[[R1]] 38*9880d681SAndroid Build Coastguard Worker; CHECK: %vreg{{[0-9]+}}<def> = COPY %[[R4]] 39*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: MACHINEINSTRS 40*9880d681SAndroid Build Coastguard Worker%struct.rtx_def = type { [4 x i8], [1 x %union.rtunion_def] } 41*9880d681SAndroid Build Coastguard Worker%union.rtunion_def = type { i64 } 42*9880d681SAndroid Build Coastguard Worker 43*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp 44*9880d681SAndroid Build Coastguard Workerdeclare hidden fastcc void @df_ref_record(i32* nocapture, %struct.rtx_def*, %struct.rtx_def**, %struct.rtx_def*, i32, i32) #0 45*9880d681SAndroid Build Coastguard Worker 46*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind ssp 47*9880d681SAndroid Build Coastguard Workerdefine hidden fastcc void @df_def_record_1(i32* nocapture %df, %struct.rtx_def* %x, %struct.rtx_def* %insn) #0 { 48*9880d681SAndroid Build Coastguard Workerentry: 49*9880d681SAndroid Build Coastguard Worker br label %while.cond 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Workerwhile.cond: ; preds = %if.end28, %entry 52*9880d681SAndroid Build Coastguard Worker %loc.0 = phi %struct.rtx_def** [ %rtx31, %if.end28 ], [ undef, %entry ] 53*9880d681SAndroid Build Coastguard Worker %dst.0 = phi %struct.rtx_def* [ %0, %if.end28 ], [ undef, %entry ] 54*9880d681SAndroid Build Coastguard Worker switch i32 undef, label %if.end47 [ 55*9880d681SAndroid Build Coastguard Worker i32 61, label %if.then46 56*9880d681SAndroid Build Coastguard Worker i32 64, label %if.then24 57*9880d681SAndroid Build Coastguard Worker i32 132, label %if.end28 58*9880d681SAndroid Build Coastguard Worker i32 133, label %if.end28 59*9880d681SAndroid Build Coastguard Worker ] 60*9880d681SAndroid Build Coastguard Worker 61*9880d681SAndroid Build Coastguard Workerif.then24: ; preds = %while.cond 62*9880d681SAndroid Build Coastguard Worker br label %if.end28 63*9880d681SAndroid Build Coastguard Worker 64*9880d681SAndroid Build Coastguard Workerif.end28: ; preds = %if.then24, %while.cond, %while.cond 65*9880d681SAndroid Build Coastguard Worker %dst.1 = phi %struct.rtx_def* [ undef, %if.then24 ], [ %dst.0, %while.cond ], [ %dst.0, %while.cond ] 66*9880d681SAndroid Build Coastguard Worker %arrayidx30 = getelementptr inbounds %struct.rtx_def, %struct.rtx_def* %dst.1, i32 0, i32 1, i32 0 67*9880d681SAndroid Build Coastguard Worker %rtx31 = bitcast %union.rtunion_def* %arrayidx30 to %struct.rtx_def** 68*9880d681SAndroid Build Coastguard Worker %0 = load %struct.rtx_def*, %struct.rtx_def** %rtx31, align 4 69*9880d681SAndroid Build Coastguard Worker br label %while.cond 70*9880d681SAndroid Build Coastguard Worker 71*9880d681SAndroid Build Coastguard Workerif.then46: ; preds = %while.cond 72*9880d681SAndroid Build Coastguard Worker tail call fastcc void @df_ref_record(i32* %df, %struct.rtx_def* %dst.0, %struct.rtx_def** %loc.0, %struct.rtx_def* %insn, i32 0, i32 undef) 73*9880d681SAndroid Build Coastguard Worker unreachable 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Workerif.end47: ; preds = %while.cond 76*9880d681SAndroid Build Coastguard Worker ret void 77*9880d681SAndroid Build Coastguard Worker} 78*9880d681SAndroid Build Coastguard Worker 79*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind ssp } 80