51 lines · plain
1; RUN: opt -passes=loop-unroll-and-jam -allow-unroll-and-jam -unroll-and-jam-count=2 -S < %s | FileCheck %s2;3; Check that the disable_nonforced loop property is honored by4; loop unroll-and-jam.5;6target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"7 8; CHECK-LABEL: disable_nonforced9; CHECK: load10; CHECK-NOT: load11define void @disable_nonforced(i32 %I, i32 %J, ptr noalias nocapture %A, ptr noalias nocapture readonly %B) {12entry:13 %cmp = icmp ne i32 %J, 014 %cmp122 = icmp ne i32 %I, 015 %or.cond = and i1 %cmp, %cmp12216 br i1 %or.cond, label %for.outer.preheader, label %for.end17 18for.outer.preheader:19 br label %for.outer20 21for.outer:22 %i.us = phi i32 [ %add8.us, %for.latch ], [ 0, %for.outer.preheader ]23 br label %for.inner24 25for.inner:26 %j.us = phi i32 [ 0, %for.outer ], [ %inc.us, %for.inner ]27 %sum1.us = phi i32 [ 0, %for.outer ], [ %add.us, %for.inner ]28 %arrayidx.us = getelementptr inbounds i32, ptr %B, i32 %j.us29 %0 = load i32, ptr %arrayidx.us, align 430 %add.us = add i32 %0, %sum1.us31 %inc.us = add nuw i32 %j.us, 132 %exitcond = icmp eq i32 %inc.us, %J33 br i1 %exitcond, label %for.latch, label %for.inner34 35for.latch:36 %add.us.lcssa = phi i32 [ %add.us, %for.inner ]37 %arrayidx6.us = getelementptr inbounds i32, ptr %A, i32 %i.us38 store i32 %add.us.lcssa, ptr %arrayidx6.us, align 439 %add8.us = add nuw i32 %i.us, 140 %exitcond25 = icmp eq i32 %add8.us, %I41 br i1 %exitcond25, label %for.end.loopexit, label %for.outer, !llvm.loop !042 43for.end.loopexit:44 br label %for.end45 46for.end:47 ret void48}49 50!0 = distinct !{!0, !{!"llvm.loop.disable_nonforced"}}51