80 lines · plain
1; REQUIRES: asserts2; RUN: llc -mtriple=thumb-eabi -mcpu=swift -pre-RA-sched=source -join-globalcopies -enable-misched -verify-misched -debug-only=machine-scheduler -arm-atomic-cfg-tidy=0 %s -o - 2>&1 | FileCheck %s3;4; Loop counter copies should be eliminated.5; There is also a MUL here, but we don't care where it is scheduled.6; CHECK: postinc7; CHECK: *** Final schedule for %bb.2 ***8; CHECK: t2LDRs9; CHECK: t2ADDrr10; CHECK: t2CMPrr11; CHECK: COPY12define i32 @postinc(i32 %a, ptr nocapture %d, i32 %s) nounwind {13entry:14 %cmp4 = icmp eq i32 %a, 015 br i1 %cmp4, label %for.end, label %for.body16 17for.body: ; preds = %entry, %for.body18 %indvars.iv = phi i32 [ %indvars.iv.next, %for.body ], [ 0, %entry ]19 %s.05 = phi i32 [ %mul, %for.body ], [ 0, %entry ]20 %indvars.iv.next = add i32 %indvars.iv, %s21 %arrayidx = getelementptr inbounds i32, ptr %d, i32 %indvars.iv22 %0 = load i32, ptr %arrayidx, align 423 %mul = mul nsw i32 %0, %s.0524 %exitcond = icmp eq i32 %indvars.iv.next, %a25 br i1 %exitcond, label %for.end, label %for.body26 27for.end: ; preds = %for.body, %entry28 %s.0.lcssa = phi i32 [ 0, %entry ], [ %mul, %for.body ]29 ret i32 %s.0.lcssa30}31 32 33; This case was a crasher in constrainLocalCopy.34; The problem was the t2LDR_PRE defining both the global and local lrg.35; CHECK-LABEL: *** Final schedule for %bb.5 ***36; CHECK: %[[R4:[0-9]+]]:gpr, %[[R1:[0-9]+]]:gpr = t2LDR_PRE %[[R1]]37; CHECK: %{{[0-9]+}}:gpr = COPY %[[R1]]38; CHECK: %{{[0-9]+}}:gpr = COPY %[[R4]]39; CHECK-LABEL: MACHINEINSTRS40%struct.rtx_def = type { [4 x i8], [1 x %union.rtunion_def] }41%union.rtunion_def = type { i64 }42 43; Function Attrs: nounwind ssp44declare hidden fastcc void @df_ref_record(ptr nocapture, ptr, ptr, ptr, i32, i32) #045 46; Function Attrs: nounwind ssp47define hidden fastcc void @df_def_record_1(ptr nocapture %df, ptr %x, ptr %insn) #0 {48entry:49 br label %while.cond50 51while.cond: ; preds = %if.end28, %entry52 %loc.0 = phi ptr [ %rtx31, %if.end28 ], [ undef, %entry ]53 %dst.0 = phi ptr [ %0, %if.end28 ], [ undef, %entry ]54 switch i32 undef, label %if.end47 [55 i32 61, label %if.then4656 i32 64, label %if.then2457 i32 132, label %if.end2858 i32 133, label %if.end2859 ]60 61if.then24: ; preds = %while.cond62 br label %if.end2863 64if.end28: ; preds = %if.then24, %while.cond, %while.cond65 %dst.1 = phi ptr [ undef, %if.then24 ], [ %dst.0, %while.cond ], [ %dst.0, %while.cond ]66 %arrayidx30 = getelementptr inbounds %struct.rtx_def, ptr %dst.1, i32 0, i32 1, i32 067 %rtx31 = bitcast ptr %arrayidx30 to ptr68 %0 = load ptr, ptr %rtx31, align 469 br label %while.cond70 71if.then46: ; preds = %while.cond72 tail call fastcc void @df_ref_record(ptr %df, ptr %dst.0, ptr %loc.0, ptr %insn, i32 0, i32 undef)73 unreachable74 75if.end47: ; preds = %while.cond76 ret void77}78 79attributes #0 = { nounwind ssp }80