1*cee313d2SEric Christopher; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2*cee313d2SEric Christopher; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s
3*cee313d2SEric Christopher
4*cee313d2SEric Christopherdefine void @test1() {
5*cee313d2SEric Christopher; CHECK-LABEL: @test1(
6*cee313d2SEric Christopher; CHECK-NEXT:  entry:
7*cee313d2SEric Christopher; CHECK-NEXT:    br label [[LOOP:%.*]]
8*cee313d2SEric Christopher; CHECK:       Flow:
9*cee313d2SEric Christopher; CHECK-NEXT:    br label [[FLOW1:%.*]]
10*cee313d2SEric Christopher; CHECK:       loop:
11*cee313d2SEric Christopher; CHECK-NEXT:    [[CTR:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[CTR_NEXT:%.*]], [[FLOW1]] ]
12*cee313d2SEric Christopher; CHECK-NEXT:    [[CTR_NEXT]] = add i32 [[CTR]], 1
13*cee313d2SEric Christopher; CHECK-NEXT:    br i1 undef, label [[LOOP_A:%.*]], label [[FLOW1]]
14*cee313d2SEric Christopher; CHECK:       loop.a:
15*cee313d2SEric Christopher; CHECK-NEXT:    br i1 undef, label [[LOOP_B:%.*]], label [[FLOW:%.*]]
16*cee313d2SEric Christopher; CHECK:       loop.b:
17*cee313d2SEric Christopher; CHECK-NEXT:    br label [[FLOW]]
18*cee313d2SEric Christopher; CHECK:       Flow1:
19*cee313d2SEric Christopher; CHECK-NEXT:    [[TMP0:%.*]] = phi i1 [ false, [[FLOW]] ], [ true, [[LOOP]] ]
20*cee313d2SEric Christopher; CHECK-NEXT:    br i1 [[TMP0]], label [[EXIT:%.*]], label [[LOOP]]
21*cee313d2SEric Christopher; CHECK:       exit:
22*cee313d2SEric Christopher; CHECK-NEXT:    ret void
23*cee313d2SEric Christopher;
24*cee313d2SEric Christopherentry:
25*cee313d2SEric Christopher  br label %loop
26*cee313d2SEric Christopher
27*cee313d2SEric Christopherloop:
28*cee313d2SEric Christopher  %ctr = phi i32 [ 0, %entry ], [ %ctr.next, %loop.a ], [ %ctr.next, %loop.b ]
29*cee313d2SEric Christopher  %ctr.next = add i32 %ctr, 1
30*cee313d2SEric Christopher  br i1 undef, label %exit, label %loop.a
31*cee313d2SEric Christopher
32*cee313d2SEric Christopherloop.a:
33*cee313d2SEric Christopher  br i1 undef, label %loop, label %loop.b
34*cee313d2SEric Christopher
35*cee313d2SEric Christopherloop.b:
36*cee313d2SEric Christopher  br label %loop
37*cee313d2SEric Christopher
38*cee313d2SEric Christopherexit:
39*cee313d2SEric Christopher  ret void
40*cee313d2SEric Christopher}
41