1 ; RUN: opt < %s -S -loop-unroll -unroll-allow-partial | FileCheck %s 2 ; Loop size = 3, when the function has the optsize attribute, the 3 ; OptSizeUnrollThreshold, i.e. 50, is used, hence the loop should be unrolled 4 ; by 16 times because 3 * 16 < 50. 5 define void @unroll_opt_for_size() nounwind optsize { 6 entry: 7 br label %loop 8 9 loop: 10 %iv = phi i32 [ 0, %entry ], [ %inc, %loop ] 11 %inc = add i32 %iv, 1 12 %exitcnd = icmp uge i32 %inc, 1024 13 br i1 %exitcnd, label %exit, label %loop 14 15 exit: 16 ret void 17 } 18 19 ; CHECK: add 20 ; CHECK-NEXT: add 21 ; CHECK-NEXT: add 22 ; CHECK-NEXT: add 23 ; CHECK-NEXT: add 24 ; CHECK-NEXT: add 25 ; CHECK-NEXT: add 26 ; CHECK-NEXT: add 27 ; CHECK-NEXT: add 28 ; CHECK-NEXT: add 29 ; CHECK-NEXT: add 30 ; CHECK-NEXT: add 31 ; CHECK-NEXT: add 32 ; CHECK-NEXT: add 33 ; CHECK-NEXT: add 34 ; CHECK-NEXT: add 35 ; CHECK-NEXT: icmp 36