1; RUN: llc -mcpu=cyclone -debug-only=loop-reduce < %s 2>&1 | FileCheck %s 2; REQUIRES: asserts 3 4; LSR used to fail here due to a bug in the ReqRegs test. 5; CHECK: The chosen solution requires 6; CHECK-NOT: No Satisfactory Solution 7 8target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128" 9target triple = "arm64-apple-ios" 10 11define void @do_integer_add(i64 %iterations, ptr nocapture readonly %cookie) { 12entry: 13 %0 = load i32, ptr %cookie, align 4 14 %add = add nsw i32 %0, 57 15 %cmp56 = icmp eq i64 %iterations, 0 16 br i1 %cmp56, label %while.end, label %for.cond.preheader.preheader 17 18for.cond.preheader.preheader: ; preds = %entry 19 br label %for.cond.preheader 20 21while.cond.loopexit: ; preds = %for.body 22 %add21.lcssa = phi i32 [ %add21, %for.body ] 23 %dec58 = add i64 %dec58.in, -1 24 %cmp = icmp eq i64 %dec58, 0 25 br i1 %cmp, label %while.end.loopexit, label %for.cond.preheader 26 27for.cond.preheader: ; preds = %for.cond.preheader.preheader, %while.cond.loopexit 28 %dec58.in = phi i64 [ %dec58, %while.cond.loopexit ], [ %iterations, %for.cond.preheader.preheader ] 29 %a.057 = phi i32 [ %add21.lcssa, %while.cond.loopexit ], [ %add, %for.cond.preheader.preheader ] 30 br label %for.body 31 32for.body: ; preds = %for.body, %for.cond.preheader 33 %a.154 = phi i32 [ %a.057, %for.cond.preheader ], [ %add21, %for.body ] 34 %i.053 = phi i32 [ 1, %for.cond.preheader ], [ %inc, %for.body ] 35 %inc = add nsw i32 %i.053, 1 36 %add2 = shl i32 %a.154, 1 37 %add3 = add nsw i32 %add2, %i.053 38 %add4 = shl i32 %add3, 1 39 %add5 = add nsw i32 %add4, %i.053 40 %add6 = shl i32 %add5, 1 41 %add7 = add nsw i32 %add6, %i.053 42 %add8 = shl i32 %add7, 1 43 %add9 = add nsw i32 %add8, %i.053 44 %add10 = shl i32 %add9, 1 45 %add11 = add nsw i32 %add10, %i.053 46 %add12 = shl i32 %add11, 1 47 %add13 = add nsw i32 %add12, %i.053 48 %add14 = shl i32 %add13, 1 49 %add15 = add nsw i32 %add14, %i.053 50 %add16 = shl i32 %add15, 1 51 %add17 = add nsw i32 %add16, %i.053 52 %add18 = shl i32 %add17, 1 53 %add19 = add nsw i32 %add18, %i.053 54 %add20 = shl i32 %add19, 1 55 %add21 = add nsw i32 %add20, %i.053 56 %exitcond = icmp eq i32 %inc, 1001 57 br i1 %exitcond, label %while.cond.loopexit, label %for.body 58 59while.end.loopexit: ; preds = %while.cond.loopexit 60 %add21.lcssa.lcssa = phi i32 [ %add21.lcssa, %while.cond.loopexit ] 61 br label %while.end 62 63while.end: ; preds = %while.end.loopexit, %entry 64 %a.0.lcssa = phi i32 [ %add, %entry ], [ %add21.lcssa.lcssa, %while.end.loopexit ] 65 tail call void @use_int(i32 %a.0.lcssa) 66 ret void 67} 68 69declare void @use_int(i32) 70