1 ; RUN: opt -S -loop-rotate < %s -verify-loop-info | FileCheck %s
3 ; Verify that LoopRotate preserves LoopSimplify form even in very peculiar loop
4 ; structures. We manually validate the CFG with FileCheck because currently we
5 ; can't cause a failure when LoopSimplify fails to be preserved.
7 define void @PR18643() {
8 ; CHECK-LABEL: @PR18643(
10 br label %outer.header
11 ; CHECK: br label %outer.header
14 ; CHECK: outer.header:
15 br i1 undef, label %inner.header, label %outer.body
16 ; CHECK-NEXT: br i1 {{[^,]*}}, label %[[INNER_PREROTATE_PREHEADER:[^,]*]], label %outer.body
18 ; CHECK: [[INNER_PREROTATE_PREHEADER]]:
19 ; CHECK-NEXT: br i1 {{[^,]*}}, label %[[INNER_PREROTATE_PREHEADER_SPLIT_RETURN:[^,]*]], label %[[INNER_ROTATED_PREHEADER:[^,]*]]
21 ; CHECK: [[INNER_ROTATED_PREHEADER]]:
22 ; CHECK-NEXT: br label %inner.body
26 ; CHECK: inner.header:
27 br i1 undef, label %return, label %inner.body
28 ; CHECK-NEXT: br i1 {{[^,]*}}, label %[[INNER_SPLIT_RETURN:[^,]*]], label %inner.body
33 br i1 undef, label %outer.latch, label %inner.latch
34 ; CHECK-NEXT: br i1 {{[^,]*}}, label %[[INNER_SPLIT_OUTER_LATCH:[^,]*]], label %inner.header
38 br label %inner.header
43 ; CHECK-NEXT: br label %outer.latch
45 ; L2 -> L1 exit edge needs a simplified exit block.
46 ; CHECK: [[INNER_SPLIT_OUTER_LATCH]]:
47 ; CHECK-NEXT: br label %outer.latch
51 br label %outer.header
52 ; CHECK-NEXT: br label %outer.header
54 ; L1 -> L0 exit edge need sa simplified exit block.
55 ; CHECK: [[INNER_PREROTATE_PREHEADER_SPLIT_RETURN]]:
56 ; CHECK-NEXT: br label %return
58 ; L2 -> L0 exit edge needs a simplified exit block.
59 ; CHECK: [[INNER_SPLIT_RETURN]]:
60 ; CHECK-NEXT: br label %return