1; RUN: opt -basic-aa -tbaa -loop-unroll-and-jam -allow-unroll-and-jam -unroll-and-jam-count=4 -unroll-remainder < %s -S | FileCheck %s 2; 3; Check that followup attributes are set in the new loops. 4; 5target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" 6 7define void @followup(i32 %I, i32 %J, i32* noalias nocapture %A, i32* noalias nocapture readonly %B) { 8entry: 9 %cmp = icmp ne i32 %J, 0 10 %cmp122 = icmp ne i32 %I, 0 11 %or.cond = and i1 %cmp, %cmp122 12 br i1 %or.cond, label %for.outer.preheader, label %for.end 13 14for.outer.preheader: 15 br label %for.outer 16 17for.outer: 18 %i.us = phi i32 [ %add8.us, %for.latch ], [ 0, %for.outer.preheader ] 19 br label %for.inner 20 21for.inner: 22 %j.us = phi i32 [ 0, %for.outer ], [ %inc.us, %for.inner ] 23 %sum1.us = phi i32 [ 0, %for.outer ], [ %add.us, %for.inner ] 24 %arrayidx.us = getelementptr inbounds i32, i32* %B, i32 %j.us 25 %0 = load i32, i32* %arrayidx.us, align 4 26 %add.us = add i32 %0, %sum1.us 27 %inc.us = add nuw i32 %j.us, 1 28 %exitcond = icmp eq i32 %inc.us, %J 29 br i1 %exitcond, label %for.latch, label %for.inner 30 31for.latch: 32 %add.us.lcssa = phi i32 [ %add.us, %for.inner ] 33 %arrayidx6.us = getelementptr inbounds i32, i32* %A, i32 %i.us 34 store i32 %add.us.lcssa, i32* %arrayidx6.us, align 4 35 %add8.us = add nuw i32 %i.us, 1 36 %exitcond25 = icmp eq i32 %add8.us, %I 37 br i1 %exitcond25, label %for.end.loopexit, label %for.outer, !llvm.loop !0 38 39for.end.loopexit: 40 br label %for.end 41 42for.end: 43 ret void 44} 45 46!0 = !{!0, !1, !2, !3, !4, !6} 47!1 = !{!"llvm.loop.unroll_and_jam.enable"} 48!2 = !{!"llvm.loop.unroll_and_jam.followup_outer", !{!"FollowupOuter"}} 49!3 = !{!"llvm.loop.unroll_and_jam.followup_inner", !{!"FollowupInner"}} 50!4 = !{!"llvm.loop.unroll_and_jam.followup_all", !{!"FollowupAll"}} 51!6 = !{!"llvm.loop.unroll_and_jam.followup_remainder_inner", !{!"FollowupRemainderInner"}} 52 53 54; CHECK: br i1 %exitcond.3, label %for.latch, label %for.inner, !llvm.loop ![[LOOP_INNER:[0-9]+]] 55; CHECK: br i1 %niter.ncmp.3, label %for.end.loopexit.unr-lcssa.loopexit, label %for.outer, !llvm.loop ![[LOOP_OUTER:[0-9]+]] 56; CHECK: br i1 %exitcond.epil, label %for.latch.epil, label %for.inner.epil, !llvm.loop ![[LOOP_REMAINDER_INNER:[0-9]+]] 57; CHECK: br i1 %exitcond.epil.1, label %for.latch.epil.1, label %for.inner.epil.1, !llvm.loop ![[LOOP_REMAINDER_INNER]] 58; CHECK: br i1 %exitcond.epil.2, label %for.latch.epil.2, label %for.inner.epil.2, !llvm.loop ![[LOOP_REMAINDER_INNER]] 59 60; CHECK: ![[LOOP_INNER]] = distinct !{![[LOOP_INNER]], ![[FOLLOWUP_ALL:[0-9]+]], ![[FOLLOWUP_INNER:[0-9]+]]} 61; CHECK: ![[FOLLOWUP_ALL]] = !{!"FollowupAll"} 62; CHECK: ![[FOLLOWUP_INNER]] = !{!"FollowupInner"} 63; CHECK: ![[LOOP_OUTER]] = distinct !{![[LOOP_OUTER]], ![[FOLLOWUP_ALL]], ![[FOLLOWUP_OUTER:[0-9]+]]} 64; CHECK: ![[FOLLOWUP_OUTER]] = !{!"FollowupOuter"} 65; CHECK: ![[LOOP_REMAINDER_INNER]] = distinct !{![[LOOP_REMAINDER_INNER]], ![[FOLLOWUP_ALL]], ![[FOLLOWUP_REMAINDER_INNER:[0-9]+]]} 66; CHECK: ![[FOLLOWUP_REMAINDER_INNER]] = !{!"FollowupRemainderInner"} 67