// outer loop. LICM pass can help to promote the runtime check out if the
// checked value is loop invariant.
MPM.add(createLICMPass());
-
- // Get rid of LCSSA nodes.
- MPM.add(createInstructionSimplifierPass());
- }
+ }
// After vectorization and unrolling, assume intrinsics may tell us more
// about pointer alignments.
if (MergeFunctions)
MPM.add(createMergeFunctionsPass());
+ MPM.add(createLoopSinkPass());
+ // Get rid of LCSSA nodes.
+ MPM.add(createInstructionSimplifierPass());
addExtensionsToPM(EP_OptimizerLast, MPM);
}
; CHECK: load i32, i32* @g
; CHECK: .b3:
; CHECK-NOT: load i32, i32* @g
-define i32 @t1(i32, i32) #0 {
+define i32 @t1(i32, i32) #0 !prof !0 {
%3 = icmp eq i32 %1, 0
br i1 %3, label %.exit, label %.preheader
; CHECK: .b6:
; CHECK: load i32, i32* @g
; CHECK: .b7:
-define i32 @t2(i32, i32) #0 {
+define i32 @t2(i32, i32) #0 !prof !0 {
%3 = icmp eq i32 %1, 0
br i1 %3, label %.exit, label %.preheader
; CHECK: load i32, i32* @g
; CHECK: .b1:
; CHECK-NOT: load i32, i32* @g
-define i32 @t3(i32, i32) #0 {
+define i32 @t3(i32, i32) #0 !prof !0 {
%3 = icmp eq i32 %1, 0
br i1 %3, label %.exit, label %.preheader
; CHECK: .b1:
; CHECK: load i32, i32* @g
; CHECK: .exit:
-define i32 @t4(i32, i32) #0 {
+define i32 @t4(i32, i32) #0 !prof !0 {
.preheader:
%invariant = load i32, i32* @g
br label %.b1
; CHECK: load i32, i32* @g
; CHECK: .b1:
; CHECK-NOT: load i32, i32* @g
-define i32 @t5(i32, i32*) #0 {
+define i32 @t5(i32, i32*) #0 !prof !0 {
%3 = icmp eq i32 %0, 0
br i1 %3, label %.exit, label %.preheader
declare i32 @foo()
+!0 = !{!"function_entry_count", i64 1}
!1 = !{!"branch_weights", i32 1, i32 2000}
!2 = !{!"branch_weights", i32 2000, i32 1}
!3 = !{!"branch_weights", i32 100, i32 1}
@g = global i32 0, align 4
-define i32 @foo(i32, i32) #0 {
+define i32 @foo(i32, i32) #0 !prof !2 {
%3 = icmp eq i32 %1, 0
br i1 %3, label %._crit_edge, label %.lr.ph.preheader
}
!1 = !{!"branch_weights", i32 1, i32 2000}
+!2 = !{!"function_entry_count", i64 1}