brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · e951215 Raw
91 lines · plain
1; REQUIRES: asserts2; RUN: opt < %s -S -debug-only=loop-unroll -passes=loop-unroll -unroll-runtime 2>&1 | FileCheck %s3; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,loop-unroll)' 2>&1 | FileCheck %s4; RUN: opt < %s -S -debug-only=loop-unroll -passes='require<profile-summary>,function(require<opt-remark-emit>,loop-unroll<no-profile-peeling>)' 2>&1 | FileCheck %s --check-prefixes=CHECK-NO-PEEL5 6; Make sure we use the profile information correctly to peel-off 3 iterations7; from the loop, and update the branch weights for the peeled loop properly.8; All side exits to deopt does not change weigths.9 10; CHECK: Loop Unroll: F[basic]11; CHECK: PEELING loop %for.body with iteration count 4!12; CHECK-NO-PEEL-NOT: PEELING loop %for.body13; CHECK-LABEL: @basic14; CHECK: br i1 %c, label %{{.*}}, label %side_exit, !prof !1515; CHECK: br i1 %{{.*}}, label %[[NEXT0:.*]], label %for.cond.for.end_crit_edge, !prof !1616; CHECK: [[NEXT0]]:17; CHECK: br i1 %c, label %{{.*}}, label %side_exit, !prof !1518; CHECK: br i1 %{{.*}}, label %[[NEXT1:.*]], label %for.cond.for.end_crit_edge, !prof !1619; CHECK: [[NEXT1]]:20; CHECK: br i1 %c, label %{{.*}}, label %side_exit, !prof !1521; CHECK: br i1 %{{.*}}, label %[[NEXT2:.*]], label %for.cond.for.end_crit_edge, !prof !1622; CHECK: [[NEXT2]]:23; CHECK: br i1 %c, label %{{.*}}, label %side_exit.loopexit, !prof !1524; CHECK: br i1 %{{.*}}, label %for.body, label %{{.*}}, !prof !16, !llvm.loop !1725 26define i32 @basic(ptr %p, i32 %k, i1 %c) #0 !prof !15 {27entry:28  %cmp3 = icmp slt i32 0, %k29  br i1 %cmp3, label %for.body.lr.ph, label %for.end30 31for.body.lr.ph:                                   ; preds = %entry32  br label %for.body33 34for.body:                                         ; preds = %for.body.lr.ph, %for.body35  %i.05 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %continue ]36  %p.addr.04 = phi ptr [ %p, %for.body.lr.ph ], [ %incdec.ptr, %continue ]37  %incdec.ptr = getelementptr inbounds i32, ptr %p.addr.04, i32 138  store i32 %i.05, ptr %p.addr.04, align 439  %inc = add nsw i32 %i.05, 140  %cmp = icmp slt i32 %inc, %k41  br i1 %c, label %continue, label %side_exit, !prof !1742 43continue:44  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !prof !1645 46for.cond.for.end_crit_edge:                       ; preds = %for.body47  br label %for.end48 49for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry50  %res = phi i32 [ 0, %entry ], [ %inc, %for.cond.for.end_crit_edge ]51  ret i32 %res52 53side_exit:54  %rval = call i32(...) @llvm.experimental.deoptimize.i32() [ "deopt"(i32 %inc) ]55  ret i32 %rval56}57 58declare i32 @llvm.experimental.deoptimize.i32(...)59 60attributes #0 = { nounwind }61attributes #1 = { nounwind optsize }62 63!llvm.module.flags = !{!1}64 65!1 = !{i32 1, !"ProfileSummary", !2}66!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}67!3 = !{!"ProfileFormat", !"InstrProf"}68!4 = !{!"TotalCount", i64 10}69!5 = !{!"MaxCount", i64 3}70!6 = !{!"MaxInternalCount", i64 1}71!7 = !{!"MaxFunctionCount", i64 3}72!8 = !{!"NumCounts", i64 2}73!9 = !{!"NumFunctions", i64 2}74!10 = !{!"DetailedSummary", !11}75!11 = !{!12, !13, !14}76!12 = !{i32 10000, i64 3, i32 2}77!13 = !{i32 999000, i64 1, i32 10}78!14 = !{i32 999999, i64 1, i32 10}79!15 = !{!"function_entry_count", i64 1}80!16 = !{!"branch_weights", i32 3001, i32 1001}81!17 = !{!"branch_weights", i32 1, i32 0}82 83; This is a weights of deopt side-exit.84;CHECK: !15 = !{!"branch_weights", i32 1, i32 0}85; This is a weights of latch and its copies.86;CHECK: !16 = !{!"branch_weights", i32 3001, i32 1001}87;CHECK: !17 = distinct !{!17, !18, !19, {{.*}}}88;CHECK: !18 = !{!"llvm.loop.peeled.count", i32 4}89;CHECK: !19 = !{!"llvm.loop.estimated_trip_count", i32 0}90 91