1 ; RUN: opt %loadNPMPolly -S -passes=polly-codegen < %s | FileCheck %s
3 ; Verify we initialize the scalar locations reserved for the incoming phi
7 ; CHECK-NEXT: store float %ebig.0, ptr %ebig.0.s2a
8 ; CHECK-NEXT: br label %polly.stmt.if.end.entry
12 ; int max(float *restrict xbig, int eres, int bres, float *restrict indx) {
15 ; for (i = 0; i < 4 + eres; i++) {
19 ; if (xbig[i] > ebig) {
21 ; iebig = (int)(indx[i] + bres);
27 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
29 @M = common global float 0.000000e+00, align 4
31 define i32 @max(ptr noalias %xbig, i32 %eres, i32 %bres, ptr noalias %indx) {
35 for.cond: ; preds = %for.inc, %entry
36 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
37 %iebig.0 = phi i32 [ undef, %entry ], [ %iebig.1, %for.inc ]
38 %ebig.0 = phi float [ undef, %entry ], [ %ebig.1, %for.inc ]
39 %add = add nsw i32 %eres, 4
40 %tmp = sext i32 %add to i64
41 %cmp = icmp slt i64 %indvars.iv, %tmp
42 br i1 %cmp, label %for.body, label %for.end.loopexit
44 for.body: ; preds = %for.cond
45 %call = call i32 @g() #2
46 %tobool = icmp eq i32 %call, 0
47 br i1 %tobool, label %if.end, label %if.then
49 if.then: ; preds = %for.body
50 %iebig.0.lcssa1 = phi i32 [ %iebig.0, %for.body ]
53 if.end: ; preds = %for.body
54 %arrayidx = getelementptr inbounds float, ptr %xbig, i64 %indvars.iv
55 %tmp3 = load float, ptr %arrayidx, align 4
56 %cmp1 = fcmp ogt float %tmp3, %ebig.0
57 br i1 %cmp1, label %if.then.2, label %if.end.9
59 if.then.2: ; preds = %if.end
60 %arrayidx4 = getelementptr inbounds float, ptr %xbig, i64 %indvars.iv
61 %tmp4 = load float, ptr %arrayidx4, align 4
62 %arrayidx6 = getelementptr inbounds float, ptr %indx, i64 %indvars.iv
63 %tmp5 = load float, ptr %arrayidx6, align 4
64 %conv = sitofp i32 %bres to float
65 %add7 = fadd float %tmp5, %conv
66 %conv8 = fptosi float %add7 to i32
69 if.end.9: ; preds = %if.then.2, %if.end
70 %iebig.1 = phi i32 [ %conv8, %if.then.2 ], [ %iebig.0, %if.end ]
71 %ebig.1 = phi float [ %tmp4, %if.then.2 ], [ %ebig.0, %if.end ]
74 for.inc: ; preds = %if.end.9
75 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
78 for.end.loopexit: ; preds = %for.cond
79 %iebig.0.lcssa = phi i32 [ %iebig.0, %for.cond ]
82 for.end: ; preds = %for.end.loopexit, %if.then
83 %iebig.02 = phi i32 [ %iebig.0.lcssa, %for.end.loopexit ], [ %iebig.0.lcssa1, %if.then ]