llvm-project
46 строк · 1.5 Кб
1; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s
2;
3; void f(float *A) {
4; for (int i = 0; i < 1024; i++)
5; if (A[i] == A[i - 1])
6; A[i]++;
7; }
8;
9; CHECK: Valid Region for Scop: bb1 => bb14
10target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11
12define void @f(ptr %A) {
13bb:
14br label %bb1
15
16bb1: ; preds = %bb13, %bb
17%indvars.iv = phi i64 [ %indvars.iv.next, %bb13 ], [ 0, %bb ]
18%exitcond = icmp ne i64 %indvars.iv, 1024
19br i1 %exitcond, label %bb2, label %bb14
20
21bb2: ; preds = %bb1
22%tmp = getelementptr inbounds float, ptr %A, i64 %indvars.iv
23%tmp3 = load float, ptr %tmp, align 4
24%tmp4 = add nsw i64 %indvars.iv, -1
25%tmp5 = getelementptr inbounds float, ptr %A, i64 %tmp4
26%tmp6 = load float, ptr %tmp5, align 4
27%tmp7 = fcmp oeq float %tmp3, %tmp6
28br i1 %tmp7, label %bb8, label %bb12
29
30bb8: ; preds = %bb2
31%tmp9 = getelementptr inbounds float, ptr %A, i64 %indvars.iv
32%tmp10 = load float, ptr %tmp9, align 4
33%tmp11 = fadd float %tmp10, 1.000000e+00
34store float %tmp11, ptr %tmp9, align 4
35br label %bb12
36
37bb12: ; preds = %bb8, %bb2
38br label %bb13
39
40bb13: ; preds = %bb12
41%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
42br label %bb1
43
44bb14: ; preds = %bb1
45ret void
46}
47