llvm-project
43 строки · 1.2 Кб
1; RUN: opt %loadNPMPolly -passes=polly-codegen -S \
2; RUN: < %s | FileCheck %s
3;
4; void pos(float *A, long n) {
5; for (long i = 0; i < 100; i++)
6; A[n % 42] += 1;
7; }
8;
9; CHECK: polly.stmt.bb2:
10; CHECK-NEXT: %p_tmp = srem i64 %n, 42
11; CHECK-NEXT: store i64 %p_tmp, ptr %tmp.s2a
12;
13; CHECK: polly.stmt.bb3:
14; CHECK: %tmp.s2a.reload = load i64, ptr %tmp.s2a
15; CHECK: %p_tmp3 = getelementptr inbounds float, ptr %A, i64 %tmp.s2a.reload
16
17define void @pos(ptr %A, i64 %n) {
18bb:
19br label %bb1
20
21bb1: ; preds = %bb6, %bb
22%i.0 = phi i64 [ 0, %bb ], [ %tmp7, %bb6 ]
23%exitcond = icmp ne i64 %i.0, 100
24br i1 %exitcond, label %bb2, label %bb8
25
26bb2: ; preds = %bb1
27%tmp = srem i64 %n, 42
28br label %bb3
29
30bb3:
31%tmp3 = getelementptr inbounds float, ptr %A, i64 %tmp
32%tmp4 = load float, ptr %tmp3, align 4
33%tmp5 = fadd float %tmp4, 1.000000e+00
34store float %tmp5, ptr %tmp3, align 4
35br label %bb6
36
37bb6: ; preds = %bb2
38%tmp7 = add nsw i64 %i.0, 1
39br label %bb1
40
41bb8: ; preds = %bb1
42ret void
43}
44