brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · ec62a10 Raw
45 lines · plain
1; RUN: opt < %s -S -passes=loop-unroll -unroll-threshold=50 | FileCheck %s2 3; Make sure this loop is completely unrolled...4; CHECK-LABEL: @test15; CHECK: for.body:6; CHECK-NOT: for.end:7 8define i32 @test1(ptr nocapture %a) nounwind uwtable readonly {9entry:10  br label %for.body11 12for.body:                                         ; preds = %for.body, %entry13  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]14  %sum.01 = phi i32 [ 0, %entry ], [ %add, %for.body ]15  %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv16  %0 = load i32, ptr %arrayidx, align 417 18  ; This loop will be completely unrolled, even with these extra instructions,19  ; but only because they're ephemeral (and, thus, free).20  %1 = add nsw i32 %0, 221  %2 = add nsw i32 %1, 422  %3 = add nsw i32 %2, 423  %4 = add nsw i32 %3, 424  %5 = add nsw i32 %4, 425  %6 = add nsw i32 %5, 426  %7 = add nsw i32 %6, 427  %8 = add nsw i32 %7, 428  %9 = add nsw i32 %8, 429  %10 = add nsw i32 %9, 430  %ca = icmp sgt i32 %10, -731  call void @llvm.assume(i1 %ca)32 33  %add = add nsw i32 %0, %sum.0134  %indvars.iv.next = add i64 %indvars.iv, 135  %lftr.wideiv = trunc i64 %indvars.iv.next to i3236  %exitcond = icmp eq i32 %lftr.wideiv, 537  br i1 %exitcond, label %for.end, label %for.body38 39for.end:                                          ; preds = %for.body40  ret i32 %add41}42 43declare void @llvm.assume(i1) nounwind44 45