mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-05 02:16:46 +00:00
68081f41fa
Summary: canUnrollCompletely takes `unsigned` values for `UnrolledCost` and `RolledDynamicCost` but is passed in `uint64_t`s that are silently truncated. Because of this, when `UnrolledSize` is a large integer that has a small remainder with UINT32_MAX, LLVM tries to completely unroll loops with high trip counts. Reviewers: mzolotukhin, chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10293 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239218 91177308-0d34-0410-b5e6-96231b3b80d8
59 lines
1.3 KiB
LLVM
59 lines
1.3 KiB
LLVM
; RUN: opt -S -loop-unroll < %s | FileCheck %s
|
|
|
|
; LLVM should not try to fully unroll this loop.
|
|
|
|
declare void @f()
|
|
declare void @g()
|
|
declare void @h()
|
|
|
|
define void @trivial_loop() {
|
|
; CHECK-LABEL: @trivial_loop(
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
|
|
%idx.inc = add i32 %idx, 1
|
|
call void @f()
|
|
call void @g()
|
|
call void @h()
|
|
call void @f()
|
|
call void @g()
|
|
call void @h()
|
|
call void @f()
|
|
call void @g()
|
|
call void @h()
|
|
call void @f()
|
|
call void @g()
|
|
call void @h()
|
|
call void @f()
|
|
call void @g()
|
|
call void @h()
|
|
%be = icmp slt i32 %idx, 268435456
|
|
br i1 %be, label %loop, label %exit
|
|
|
|
; CHECK: loop:
|
|
; CHECK-NEXT: %idx = phi i32 [ 0, %entry ], [ %idx.inc, %loop ]
|
|
; CHECK-NEXT: %idx.inc = add i32 %idx, 1
|
|
; CHECK-NEXT: call void @f()
|
|
; CHECK-NEXT: call void @g()
|
|
; CHECK-NEXT: call void @h()
|
|
; CHECK-NEXT: call void @f()
|
|
; CHECK-NEXT: call void @g()
|
|
; CHECK-NEXT: call void @h()
|
|
; CHECK-NEXT: call void @f()
|
|
; CHECK-NEXT: call void @g()
|
|
; CHECK-NEXT: call void @h()
|
|
; CHECK-NEXT: call void @f()
|
|
; CHECK-NEXT: call void @g()
|
|
; CHECK-NEXT: call void @h()
|
|
; CHECK-NEXT: call void @f()
|
|
; CHECK-NEXT: call void @g()
|
|
; CHECK-NEXT: call void @h()
|
|
; CHECK-NEXT: %be = icmp slt i32 %idx, 268435456
|
|
; CHECK-NEXT: br i1 %be, label %loop, label %exit
|
|
|
|
exit:
|
|
ret void
|
|
}
|