1 ; RUN: opt < %s -passes='function(break-crit-edges,loop-simplify),loop-extract' -S | FileCheck %s
3 ; This function is just a minimal wrapper around a loop and should not be extracted.
7 ; CHECK-NEXT: br label %loop
9 ; CHECK-NEXT: %index = phi i32 [ 0, %entry ], [ %next, %loop.loop_crit_edge ]
10 ; CHECK-NEXT: call void @foo()
11 ; CHECK-NEXT: %next = add nsw i32 %index, -1
12 ; CHECK-NEXT: %repeat = icmp sgt i32 %index, 1
13 ; CHECK-NEXT: br i1 %repeat, label %loop.loop_crit_edge, label %exit
14 ; CHECK: loop.loop_crit_edge:
15 ; CHECK-NEXT: br label %loop
17 ; CHECK-NEXT: ret void
22 loop: ; preds = %loop, %entry
23 %index = phi i32 [ 0, %entry ], [ %next, %loop ]
25 %next = add nsw i32 %index, -1
26 %repeat = icmp sgt i32 %index, 1
27 br i1 %repeat, label %loop, label %exit