1 ; RUN: opt -S -structurizecfg %s -o - | FileCheck %s
3 ; void loop(int *out, int cond_a, int cond_b) {
6 ; for (i = 0; i < cond_a; i++) {
11 ; out[i + cond_a] = i;
15 define void @loop(ptr addrspace(1) %out, i32 %cond_a, i32 %cond_b) nounwind uwtable {
19 for.cond: ; preds = %for.inc, %entry
20 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
21 %cmp = icmp ult i32 %i.0, %cond_a
22 br i1 %cmp, label %for.body, label %for.end
25 for.body: ; preds = %for.cond
26 %arrayidx = getelementptr inbounds i32, ptr addrspace(1) %out, i32 %i.0
27 store i32 %i.0, ptr addrspace(1) %arrayidx, align 4
28 %cmp1 = icmp ugt i32 %i.0, %cond_b
29 ; CHECK: br i1 %{{[0-9a-zA-Z_.]+}}, label %for.inc, label %[[FLOW1:[0-9a-zA-Z_]+]]
30 br i1 %cmp1, label %for.end, label %for.inc
32 ; CHECK: [[FLOW:[0-9a-zA-Z]+]]:
33 ; CHECK: br i1 %{{[0-9a-zA-Z_.]+}}, label %for.end, label %for.cond
36 ; CHECK: br label %[[FLOW1]]
38 for.inc: ; preds = %for.body
39 %0 = add i32 %cond_a, %i.0
40 %arrayidx3 = getelementptr inbounds i32, ptr addrspace(1) %out, i32 %0
41 store i32 %i.0, ptr addrspace(1) %arrayidx3, align 4
42 %inc = add i32 %i.0, 1
46 ; CHECK: br label %[[FLOW]]
48 for.end: ; preds = %for.cond, %for.body