mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
774ae973b9
factory functions for the two modes the loop unroller is actually used in in-tree: simplified full-unrolling and the entire thing including partial unrolling. I've also wired these up to nice names so you can express both of these being in a pipeline easily. This is a precursor to actually enabling these parts of the O2 pipeline. Differential Revision: https://reviews.llvm.org/D28897 llvm-svn: 293136
60 lines
1.4 KiB
LLVM
60 lines
1.4 KiB
LLVM
; RUN: opt -S -loop-unroll < %s | FileCheck %s
|
|
; RUN: opt < %s -passes='require<opt-remark-emit>,loop(unroll-full)' -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
|
|
}
|