mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 15:39:00 +00:00
2ab07ac8fe
Currently we're unrolling loops more in minsize than in optsize, which means -Oz will have a larger code size than -Os. That doesn't make any sense. This resolves the FIXME about this in LoopUnrollPass and extends the optsize test to make sure we use the smaller threshold for minsize as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@257402 91177308-0d34-0410-b5e6-96231b3b80d8
54 lines
1.2 KiB
LLVM
54 lines
1.2 KiB
LLVM
; RUN: opt < %s -S -loop-unroll -unroll-allow-partial | FileCheck %s
|
|
; RUN: sed -e 's/optsize/minsize/' %s | opt -S -loop-unroll -unroll-allow-partial | FileCheck %s
|
|
|
|
; Loop size = 3, when the function has the optsize attribute, the
|
|
; OptSizeUnrollThreshold, i.e. 50, is used, hence the loop should be unrolled
|
|
; by 32 times because (1 * 32) + 2 < 50 (whereas (1 * 64 + 2) is not).
|
|
define void @unroll_opt_for_size() nounwind optsize {
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%iv = phi i32 [ 0, %entry ], [ %inc, %loop ]
|
|
%inc = add i32 %iv, 1
|
|
%exitcnd = icmp uge i32 %inc, 1024
|
|
br i1 %exitcnd, label %exit, label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|
|
|
|
; CHECK: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: add
|
|
; CHECK-NEXT: icmp
|