73 lines · plain
1; RUN: opt -mcpu=cortex-m7 -mtriple=thumbv8.1m.main -passes=loop-unroll -S %s -o - | FileCheck %s --check-prefix=NLOB2; RUN: opt -mcpu=cortex-m55 -mtriple=thumbv8.1m.main -passes=loop-unroll -S %s -o - | FileCheck %s --check-prefix=LOB3 4; This test checks behaviour of loop unrolling on processors with low overhead branching available 5 6; NLOB-LABEL: for.body{{.*}}.prol:7; NLOB-COUNT-1: fmul fast float 8; NLOB-LABEL: for.body{{.*}}.prol.1:9; NLOB-COUNT-1: fmul fast float 10; NLOB-LABEL: for.body{{.*}}.prol.2:11; NLOB-COUNT-1: fmul fast float 12; NLOB-LABEL: for.body{{.*}}:13; NLOB-COUNT-4: fmul fast float 14; NLOB-NOT: fmul fast float 15 16; LOB-LABEL: for.body{{.*}}:17; LOB: fmul fast float 18; LOB-NOT: fmul fast float 19 20 21; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite)22define dso_local void @test(i32 noundef %n, ptr nocapture noundef %pA) local_unnamed_addr #0 {23entry:24 %cmp46 = icmp sgt i32 %n, 025 br i1 %cmp46, label %for.body, label %for.cond.cleanup26 27for.cond.loopexit: ; preds = %for.cond6.for.cond.cleanup8_crit_edge.us, %for.body28 %exitcond49.not = icmp eq i32 %add, %n29 br i1 %exitcond49.not, label %for.cond.cleanup, label %for.body, !llvm.loop !030 31for.cond.cleanup: ; preds = %for.cond.loopexit, %entry32 ret void33 34for.body: ; preds = %entry, %for.cond.loopexit35 %k.047 = phi i32 [ %add, %for.cond.loopexit ], [ 0, %entry ]36 %add = add nuw nsw i32 %k.047, 137 %cmp244 = icmp slt i32 %add, %n38 br i1 %cmp244, label %for.cond6.preheader.lr.ph, label %for.cond.loopexit39 40for.cond6.preheader.lr.ph: ; preds = %for.body41 %invariant.gep = getelementptr float, ptr %pA, i32 %k.04742 br label %for.cond6.preheader.us43 44for.cond6.preheader.us: ; preds = %for.cond6.for.cond.cleanup8_crit_edge.us, %for.cond6.preheader.lr.ph45 %w.045.us = phi i32 [ %add, %for.cond6.preheader.lr.ph ], [ %inc19.us, %for.cond6.for.cond.cleanup8_crit_edge.us ]46 %mul.us = mul nuw nsw i32 %w.045.us, %n47 %0 = getelementptr float, ptr %pA, i32 %mul.us48 %arrayidx.us = getelementptr float, ptr %0, i32 %k.04749 br label %for.body9.us50 51for.body9.us: ; preds = %for.cond6.preheader.us, %for.body9.us52 %x.043.us = phi i32 [ %add, %for.cond6.preheader.us ], [ %inc.us, %for.body9.us ]53 %1 = load float, ptr %arrayidx.us, align 454 %mul11.us = mul nuw nsw i32 %x.043.us, %n55 %gep.us = getelementptr float, ptr %invariant.gep, i32 %mul11.us56 %2 = load float, ptr %gep.us, align 457 %mul14.us = fmul fast float %2, %158 %arrayidx17.us = getelementptr float, ptr %0, i32 %x.043.us59 store float %mul14.us, ptr %arrayidx17.us, align 460 %inc.us = add nuw nsw i32 %x.043.us, 161 %exitcond.not = icmp eq i32 %inc.us, %n62 br i1 %exitcond.not, label %for.cond6.for.cond.cleanup8_crit_edge.us, label %for.body9.us63 64for.cond6.for.cond.cleanup8_crit_edge.us: ; preds = %for.body9.us65 %inc19.us = add nuw nsw i32 %w.045.us, 166 %exitcond48.not = icmp eq i32 %inc19.us, %n67 br i1 %exitcond48.not, label %for.cond.loopexit, label %for.cond6.preheader.us68}69 70!0 = distinct !{!0, !1, !2}71!1 = !{!"llvm.loop.mustprogress"}72!2 = !{!"llvm.loop.unroll.disable"}73