1; RUN: opt %loadPolly -S -polly-codegen < %s | FileCheck %s 2; 3; Verify we initialize the scalar locations reserved for the incoming phi 4; values. 5; 6; CHECK: polly.start: 7; CHECK-NEXT: store float %ebig.0, float* %ebig.0.s2a 8; CHECK-NEXT: br label %polly.stmt.if.end.entry 9; 10; int g(void); 11; float M; 12; int max(float *restrict xbig, int eres, int bres, float *restrict indx) { 13; int i, iebig; 14; float ebig; 15; for (i = 0; i < 4 + eres; i++) { 16; if (g()) 17; break; 18; 19; if (xbig[i] > ebig) { 20; ebig = xbig[i]; 21; iebig = (int)(indx[i] + bres); 22; } 23; } 24; return (iebig); 25; } 26; 27target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 28 29@M = common global float 0.000000e+00, align 4 30 31define i32 @max(float* noalias %xbig, i32 %eres, i32 %bres, float* noalias %indx) { 32entry: 33 br label %for.cond 34 35for.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 43 44for.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 48 49if.then: ; preds = %for.body 50 %iebig.0.lcssa1 = phi i32 [ %iebig.0, %for.body ] 51 br label %for.end 52 53if.end: ; preds = %for.body 54 %arrayidx = getelementptr inbounds float, float* %xbig, i64 %indvars.iv 55 %tmp3 = load float, float* %arrayidx, align 4 56 %cmp1 = fcmp ogt float %tmp3, %ebig.0 57 br i1 %cmp1, label %if.then.2, label %if.end.9 58 59if.then.2: ; preds = %if.end 60 %arrayidx4 = getelementptr inbounds float, float* %xbig, i64 %indvars.iv 61 %tmp4 = load float, float* %arrayidx4, align 4 62 %arrayidx6 = getelementptr inbounds float, float* %indx, i64 %indvars.iv 63 %tmp5 = load float, float* %arrayidx6, align 4 64 %conv = sitofp i32 %bres to float 65 %add7 = fadd float %tmp5, %conv 66 %conv8 = fptosi float %add7 to i32 67 br label %if.end.9 68 69if.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 ] 72 br label %for.inc 73 74for.inc: ; preds = %if.end.9 75 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 76 br label %for.cond 77 78for.end.loopexit: ; preds = %for.cond 79 %iebig.0.lcssa = phi i32 [ %iebig.0, %for.cond ] 80 br label %for.end 81 82for.end: ; preds = %for.end.loopexit, %if.then 83 %iebig.02 = phi i32 [ %iebig.0.lcssa, %for.end.loopexit ], [ %iebig.0.lcssa1, %if.then ] 84 ret i32 %iebig.02 85} 86 87declare i32 @g() #1 88