llvm-project
87 строк · 3.0 Кб
1; RUN: opt %loadNPMPolly -S -passes=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, ptr %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(ptr noalias %xbig, i32 %eres, i32 %bres, ptr noalias %indx) {
32entry:
33br 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
42br 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
47br i1 %tobool, label %if.end, label %if.then
48
49if.then: ; preds = %for.body
50%iebig.0.lcssa1 = phi i32 [ %iebig.0, %for.body ]
51br label %for.end
52
53if.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
57br i1 %cmp1, label %if.then.2, label %if.end.9
58
59if.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
67br 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 ]
72br label %for.inc
73
74for.inc: ; preds = %if.end.9
75%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
76br label %for.cond
77
78for.end.loopexit: ; preds = %for.cond
79%iebig.0.lcssa = phi i32 [ %iebig.0, %for.cond ]
80br 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 ]
84ret i32 %iebig.02
85}
86
87declare i32 @g() #1
88