Skip to content

Commit

Permalink
[test] pre-submission for the following SimpleLoopUnswitch update
Browse files Browse the repository at this point in the history
  • Loading branch information
drcut committed Sep 4, 2022
1 parent 1f734b0 commit 07341e3
Showing 1 changed file with 77 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py

; RUN: opt < %s -passes='require<profile-summary>,function(loop-mssa(simple-loop-unswitch<nontrivial>))' -S | FileCheck %s

declare i32 @a()
declare i32 @b()

; Check loops will be applied non-trivial loop unswitch in a non-cold function,
; even loop headers are cold

define void @f1(i32 %i, i1 %cond, i1 %hot_cond, i1 %cold_cond, i1* %ptr) !prof !0 {
; CHECK-LABEL: @f1(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[ENTRY_COLD_LOOP:%.*]]
; CHECK: entry_cold_loop:
; CHECK-NEXT: br i1 [[COLD_COND:%.*]], label [[COLD_LOOP_BEGIN_PREHEADER:%.*]], label [[COLD_LOOP_EXIT:%.*]], !prof [[PROF15:![0-9]+]]
; CHECK: cold_loop_begin.preheader:
; CHECK-NEXT: br label [[COLD_LOOP_BEGIN:%.*]]
; CHECK: cold_loop_begin:
; CHECK-NEXT: br i1 [[COND:%.*]], label [[COLD_LOOP_A:%.*]], label [[COLD_LOOP_B:%.*]]
; CHECK: cold_loop_a:
; CHECK-NEXT: [[TMP0:%.*]] = call i32 @a()
; CHECK-NEXT: br label [[COLD_LOOP_LATCH:%.*]]
; CHECK: cold_loop_b:
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @b()
; CHECK-NEXT: br label [[COLD_LOOP_LATCH]]
; CHECK: cold_loop_latch:
; CHECK-NEXT: [[V2:%.*]] = load i1, i1* [[PTR:%.*]], align 1
; CHECK-NEXT: br i1 [[V2]], label [[COLD_LOOP_BEGIN]], label [[COLD_LOOP_EXIT_LOOPEXIT:%.*]]
; CHECK: cold_loop_exit.loopexit:
; CHECK-NEXT: br label [[COLD_LOOP_EXIT]]
; CHECK: cold_loop_exit:
; CHECK-NEXT: ret void
;
entry:
br label %entry_cold_loop

entry_cold_loop:
br i1 %cold_cond, label %cold_loop_begin, label %cold_loop_exit, !prof !16

cold_loop_begin:
br i1 %cond, label %cold_loop_a, label %cold_loop_b

cold_loop_a:
call i32 @a()
br label %cold_loop_latch

cold_loop_b:
call i32 @b()
br label %cold_loop_latch

cold_loop_latch:
%v2 = load i1, i1* %ptr
br i1 %v2, label %cold_loop_begin, label %cold_loop_exit

cold_loop_exit:
ret void
}

!llvm.module.flags = !{!1}
!0 = !{!"function_entry_count", i64 400}
!1 = !{i32 1, !"ProfileSummary", !2}
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
!3 = !{!"ProfileFormat", !"InstrProf"}
!4 = !{!"TotalCount", i64 10000}
!5 = !{!"MaxCount", i64 10}
!6 = !{!"MaxInternalCount", i64 1}
!7 = !{!"MaxFunctionCount", i64 1000}
!8 = !{!"NumCounts", i64 3}
!9 = !{!"NumFunctions", i64 3}
!10 = !{!"DetailedSummary", !11}
!11 = !{!12, !13, !14}
!12 = !{i32 10000, i64 100, i32 1}
!13 = !{i32 999000, i64 100, i32 1}
!14 = !{i32 999999, i64 1, i32 2}
!15 = !{!"branch_weights", i32 100, i32 0}
!16 = !{!"branch_weights", i32 0, i32 100}

0 comments on commit 07341e3

Please sign in to comment.