1; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
2;
3; CHECK-LABEL: for.cond:
4; CHECK:         %num.0 = phi i32 [ %add, %for.body15 ], [ 0, %for.cond.pre_entry_bb ]
5; CHECK:         br i1 false, label %for.body15, label %for.end22
6
7; CHECK-LABEL: polly.merge_new_and_old:
8; CHECK:         %num.0.merge = phi i32 [ %num.0.final_reload, %polly.exiting ], [ %num.0, %for.end22 ]
9; CHECK:         br label %for.end44
10
11target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
12
13define void @func(i32* %p) {
14entry:
15  %counters = alloca [64 x i32], align 16
16  %lenCounters = alloca [17 x i32], align 16
17  br label %for.cond
18
19for.cond:                                       ; preds = %for.body15, %for.cond
20  %num.0 = phi i32 [ 0, %entry ], [ %add, %for.body15 ]
21  br i1 false, label %for.body15, label %for.end22
22
23for.body15:                                       ; preds = %for.cond
24  %arrayidx17 = getelementptr inbounds [64 x i32], [64 x i32]* %counters, i64 0, i64 0
25  %0 = load i32, i32* %arrayidx17, align 4
26  %add = add i32 %num.0, %0
27  br label %for.cond
28
29for.end22:                                        ; preds = %for.cond
30  br label %for.end44
31
32for.end44:                                        ; preds = %for.end22
33  br i1 undef, label %if.then50, label %if.end67
34
35if.then50:                                        ; preds = %for.end44
36  br label %cleanup
37
38if.end67:                                         ; preds = %for.end44
39  br label %do.body
40
41do.body:                                          ; preds = %cond.end109, %if.end67
42  %e.0 = phi i32 [ 0, %if.end67 ], [ %inc128, %cond.end109 ]
43  br label %cond.end109
44
45cond.end109:                                      ; preds = %do.body
46  %idxprom122 = zext i32 %e.0 to i64
47  %arrayidx123 = getelementptr inbounds i32, i32* %p, i64 %idxprom122
48  %inc128 = add i32 %e.0, 1
49  %sub129 = sub i32 %num.0, %inc128
50  %cmp130 = icmp ugt i32 %sub129, 1
51  br i1 %cmp130, label %do.body, label %do.end
52
53do.end:                                           ; preds = %cond.end109
54  %1 = load i32, i32* %arrayidx123, align 4
55  %arrayidx142 = getelementptr inbounds [17 x i32], [17 x i32]* %lenCounters, i64 0, i64 1
56  store i32 2, i32* %arrayidx142, align 4
57  br label %for.cond201
58
59for.cond201:                                      ; preds = %for.body204, %do.end
60  br i1 undef, label %for.body204, label %for.end214
61
62for.body204:                                      ; preds = %for.cond201
63  br label %for.cond201
64
65for.end214:                                       ; preds = %for.cond201
66  br label %cleanup
67
68cleanup:                                          ; preds = %for.end214, %if.then50
69  ret void
70}
71