brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.3 KiB · 314cf38 Raw
124 lines · plain
1; RUN: opt -S -passes=loop-unroll --debug-only=loop-unroll < %s 2>&1 | FileCheck %s -check-prefix=LOOP-UNROLL2; RUN: opt -S -passes='require<opt-remark-emit>,loop(loop-unroll-full)' --debug-only=loop-unroll < %s 2>&1 | FileCheck %s -check-prefix=LOOP-UNROLL-FULL3 4; REQUIRES: asserts5 6%struct.HIP_vector_type = type {  %union.anon }7%union.anon = type { <2 x float> }8 9 10; LOOP-UNROLL-LABEL: Loop Unroll: F[pragma_unroll] Loop %for.body11; LOOP-UNROLL-NEXT: Loop Size = 912; LOOP-UNROLL-NEXT: runtime unrolling with count: 813; LOOP-UNROLL-NEXT: Exiting block %for.body: TripCount=0, TripMultiple=1, BreakoutTrip=114; LOOP-UNROLL-NEXT: Trying runtime unrolling on Loop:15; LOOP-UNROLL-NEXT: Loop at depth 1 containing: %for.body<header><latch><exiting>16; LOOP-UNROLL-NEXT: Using epilog remainder.17; LOOP-UNROLL-NEXT: UNROLLING loop %for.body by 8 with run-time trip count!18 19; LOOP-UNROLL-FULL-LABEL: Loop Unroll: F[pragma_unroll] Loop %for.body20; LOOP-UNROLL-FULL-NEXT: Loop Size = 921; LOOP-UNROLL-FULL-NEXT:  runtime unrolling with count: 822; LOOP-UNROLL-FULL-NEXT: Not attempting partial/runtime unroll in FullLoopUnroll23define void @pragma_unroll(ptr %queue, i32 %num_elements) {24entry:25  %cmp5 = icmp sgt i32 %num_elements, 026  br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup27 28for.body.preheader:                               ; preds = %entry29  br label %for.body30 31for.cond.cleanup.loopexit:                        ; preds = %for.body32  br label %for.cond.cleanup33 34for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry35  ret void36 37for.body:                                         ; preds = %for.body.preheader, %for.body38  %i.06 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]39  %add = add nuw nsw i32 %i.06, 140  %idxprom = zext i32 %add to i6441  %arrayidx = getelementptr inbounds %struct.HIP_vector_type, ptr %queue, i64 %idxprom42  %idxprom1 = zext i32 %i.06 to i6443  %arrayidx2 = getelementptr inbounds %struct.HIP_vector_type, ptr %queue, i64 %idxprom144  %0 = load i64, ptr %arrayidx, align 845  store i64 %0, ptr %arrayidx2, align 846  %exitcond = icmp ne i32 %add, %num_elements47  br i1 %exitcond, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !148}49 50; LOOP-UNROLL-LABEL: Loop Unroll: F[pragma_unroll_count1] Loop %for.body51; LOOP-UNROLL-NEXT: Loop Size = 952; LOOP-UNROLL-NEXT: Exiting block %for.body: TripCount=0, TripMultiple=1, BreakoutTrip=153; LOOP-UNROLL-NEXT: Trying runtime unrolling on Loop:54; LOOP-UNROLL-NEXT: Loop at depth 1 containing: %for.body<header><latch><exiting>55; LOOP-UNROLL-NEXT: Using epilog remainder.56; LOOP-UNROLL-NEXT: UNROLLING loop %for.body by 5 with run-time trip count!57 58; LOOP-UNROLL-FULL-LABEL: Loop Unroll: F[pragma_unroll_count1] Loop %for.body59; LOOP-UNROLL-FULL-NEXT: Loop Size = 960; LOOP-UNROLL-FULL-NEXT: Not attempting partial/runtime unroll in FullLoopUnroll61define void @pragma_unroll_count1(ptr %queue, i32 %num_elements) {62entry:63  %cmp5 = icmp sgt i32 %num_elements, 064  br i1 %cmp5, label %for.body.preheader, label %for.cond.cleanup65 66for.body.preheader:                               ; preds = %entry67  br label %for.body68 69for.cond.cleanup.loopexit:                        ; preds = %for.body70  br label %for.cond.cleanup71 72for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry73  ret void74 75for.body:                                         ; preds = %for.body.preheader, %for.body76  %i.06 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]77  %add = add nuw nsw i32 %i.06, 178  %idxprom = zext i32 %add to i6479  %arrayidx = getelementptr inbounds %struct.HIP_vector_type, ptr %queue, i64 %idxprom80  %idxprom1 = zext i32 %i.06 to i6481  %arrayidx2 = getelementptr inbounds %struct.HIP_vector_type, ptr %queue, i64 %idxprom182  %0 = load i64, ptr %arrayidx, align 883  store i64 %0, ptr %arrayidx2, align 884  %exitcond = icmp ne i32 %add, %num_elements85  br i1 %exitcond, label %for.body, label %for.cond.cleanup.loopexit, !llvm.loop !386}87 88; LOOP-UNROLL-LABEL: Loop Unroll: F[pragma_unroll_count2] Loop %for.body89; LOOP-UNROLL-NEXT: Loop Size = 490; LOOP-UNROLL-NEXT: Exiting block %for.body: TripCount=0, TripMultiple=1, BreakoutTrip=191; LOOP-UNROLL-NEXT: Trying runtime unrolling on Loop:92; LOOP-UNROLL-NEXT: Loop at depth 1 containing: %for.body<header><exiting>,%for.cond<latch>93; LOOP-UNROLL-NEXT: Using epilog remainder.94; LOOP-UNROLL-NEXT: Loop latch not terminated by a conditional branch.95; LOOP-UNROLL-NEXT: UNROLLING loop %for.body by 5!96 97; LOOP-UNROLL-FULL-LABEL: Loop Unroll: F[pragma_unroll_count2] Loop %for.body98; LOOP-UNROLL-FULL-NEXT: Loop Size = 499; LOOP-UNROLL-FULL-NEXT: Not attempting partial/runtime unroll in FullLoopUnroll100define void @pragma_unroll_count2(i64 %n) {101entry:102  br label %for.body103 104for.body:                                         ; preds = %for.cond, %entry105  %i = phi i64 [ 0, %entry ], [ %inc, %for.cond ]106  %cmp = icmp ult i64 %i, %n107  br i1 %cmp, label %for.cond, label %for.cond.cleanup108 109for.cond:                                         ; preds = %for.body110  %inc = add i64 %i, 8111  br label %for.body, !llvm.loop !3112 113for.cond.cleanup:                                 ; preds = %for.body114  ret void115}116 117; LOOP-UNROLL: llvm.loop.unroll.disable118; LOOP-UNROLL-FULL: llvm.loop.unroll.enable119!0 = !{!"llvm.loop.unroll.enable"}120!1 = distinct !{!1, !0}121 122!2 = !{!"llvm.loop.unroll.count", i32 5}123!3 = distinct !{!3, !2}124