1 ; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s
3 ; This caused an lnt crash at some point, just verify it will run through and
4 ; produce the PHI node in the exit we are looking for.
6 ; CHECK-LABEL: polly.merge_new_and_old:
7 ; CHECK-NEXT: %n2ptr.2.ph.merge = phi ptr [ %n2ptr.2.ph.final_reload, %polly.exiting ], [ %n2ptr.2.ph, %if.end.45.region_exiting ]
9 ; CHECK-LABEL: if.end.45:
10 ; CHECK-NEXT: %n2ptr.2 = phi ptr [ %add.ptr25, %entry ], [ %add.ptr25, %while.cond.preheader ], [ %n2ptr.2.ph.merge, %polly.merge_new_and_old ]
12 %struct.bc_struct.0.2.4.6.8.15.24.27.29.32.38.46.48.92.93.94.95.97.99.100.102.105.107.111.118.119.121 = type { i32, i32, i32, i32, [1024 x i8] }
14 ; Function Attrs: nounwind uwtable
15 declare ptr @new_num() #0
17 ; Function Attrs: nounwind uwtable
18 define void @_do_add(ptr %n2) #0 {
20 %call = tail call ptr @new_num()
21 %0 = load i32, ptr undef, align 4
22 %add.ptr22 = getelementptr inbounds %struct.bc_struct.0.2.4.6.8.15.24.27.29.32.38.46.48.92.93.94.95.97.99.100.102.105.107.111.118.119.121, ptr %n2, i64 0, i32 4, i64 0
23 %add.ptr25 = getelementptr inbounds i8, ptr %add.ptr22, i64 -1
24 %add.ptr29 = getelementptr inbounds %struct.bc_struct.0.2.4.6.8.15.24.27.29.32.38.46.48.92.93.94.95.97.99.100.102.105.107.111.118.119.121, ptr %call, i64 0, i32 4, i64 0
25 %add.ptr32 = getelementptr inbounds i8, ptr %add.ptr29, i64 -1
26 br i1 undef, label %if.end.45, label %if.then
28 if.then: ; preds = %entry
29 br i1 undef, label %while.cond.preheader, label %while.cond.38.preheader
31 while.cond.38.preheader: ; preds = %if.then
32 %cmp39.39 = icmp sgt i32 %0, 0
33 br i1 %cmp39.39, label %while.body.40.lr.ph, label %if.end.45
35 while.body.40.lr.ph: ; preds = %while.cond.38.preheader
36 br label %while.body.40
38 while.cond.preheader: ; preds = %if.then
39 br i1 undef, label %while.body.lr.ph, label %if.end.45
41 while.body.lr.ph: ; preds = %while.cond.preheader
44 while.body: ; preds = %while.body, %while.body.lr.ph
47 while.body.40: ; preds = %while.body.40, %while.body.40.lr.ph
48 %sumptr.141 = phi ptr [ %add.ptr32, %while.body.40.lr.ph ], [ %incdec.ptr42, %while.body.40 ]
49 %n2ptr.040 = phi ptr [ %add.ptr25, %while.body.40.lr.ph ], [ %incdec.ptr41, %while.body.40 ]
50 %incdec.ptr41 = getelementptr inbounds i8, ptr %n2ptr.040, i64 -1
51 %1 = load i8, ptr %n2ptr.040, align 1
52 %incdec.ptr42 = getelementptr inbounds i8, ptr %sumptr.141, i64 -1
53 store i8 %1, ptr %sumptr.141, align 1
54 br i1 false, label %while.body.40, label %while.cond.38.if.end.45.loopexit9_crit_edge
56 while.cond.38.if.end.45.loopexit9_crit_edge: ; preds = %while.body.40
59 if.end.45: ; preds = %while.cond.38.if.end.45.loopexit9_crit_edge, %while.cond.preheader, %while.cond.38.preheader, %entry
60 %n2ptr.2 = phi ptr [ %add.ptr25, %entry ], [ %add.ptr25, %while.cond.preheader ], [ undef, %while.cond.38.if.end.45.loopexit9_crit_edge ], [ %add.ptr25, %while.cond.38.preheader ]