llvm-project
41 строка · 1.1 Кб
1; RUN: opt %loadNPMPolly -passes=polly-codegen \
2; RUN: -S < %s | FileCheck %s
3;
4; This will just check that we generate valid code here.
5;
6; CHECK: polly.start:
7;
8; void f(int *A, int *B) {
9; for (int i = 0; i < 1024; i++)
10; A[i % 3] = B[i / 42];
11; }
12;
13target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
14
15define void @f(ptr %A, ptr %B, i32 %N) {
16bb:
17br label %bb1
18
19bb1: ; preds = %bb9, %bb
20%i.0 = phi i32 [ 0, %bb ], [ %tmp10, %bb9 ]
21%exitcond = icmp ne i32 %i.0, %N
22br i1 %exitcond, label %bb2, label %bb11
23
24bb2: ; preds = %bb1
25%tmp = sdiv i32 %i.0, 42
26%tmp3 = sext i32 %tmp to i64
27%tmp4 = getelementptr inbounds i32, ptr %B, i64 %tmp3
28%tmp5 = load i32, ptr %tmp4, align 4
29%tmp6 = srem i32 %i.0, 3
30%tmp7 = sext i32 %tmp6 to i64
31%tmp8 = getelementptr inbounds i32, ptr %A, i64 %tmp7
32store i32 %tmp5, ptr %tmp8, align 4
33br label %bb9
34
35bb9: ; preds = %bb2
36%tmp10 = add nuw nsw i32 %i.0, 1
37br label %bb1
38
39bb11: ; preds = %bb1
40ret void
41}
42