llvm-project
66 строк · 2.4 Кб
1; RUN: opt %loadNPMPolly '-passes=print<polly-ast>' -disable-output < %s | FileCheck %s
2; XFAIL: *
3
4;int bar1();
5;int bar2();
6;int bar3();
7;int k;
8;#define N 100
9;int A[N];
10;
11;int foo (int z) {
12; int i, j;
13;
14; for (i = 0; i < N; i++) {
15; A[i] = i;
16;
17; for (j = 0; j < N * 2; j++)
18; A[i] = j * A[i];
19; }
20;
21; return A[z];
22;}
23
24target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
25
26@A = common global [100 x i32] zeroinitializer, align 4 ; <ptr> [#uses=2]
27@k = common global i32 0, align 4 ; <ptr> [#uses=0]
28
29define i32 @foo(i32 %z) nounwind {
30bb.nph31.split.us:
31br label %bb.nph.us
32
33for.inc06.us: ; preds = %for.body6.us
34store i32 %mul.us, ptr %arrayidx.us
35%indvar.next = add i64 %indvar, 1 ; <i64> [#uses=2]
36%exitcond32 = icmp eq i64 %indvar.next, 100 ; <i1> [#uses=1]
37br i1 %exitcond32, label %for.end19, label %bb.nph.us
38
39for.body6.us: ; preds = %for.body6.us, %bb.nph.us
40%arrayidx10.tmp.0.us = phi i32 [ %i.027.us, %bb.nph.us ], [ %mul.us, %for.body6.us ] ; <i32> [#uses=1]
41%0 = phi i32 [ 0, %bb.nph.us ], [ %inc.us, %for.body6.us ] ; <i32> [#uses=2]
42%mul.us = mul i32 %arrayidx10.tmp.0.us, %0 ; <i32> [#uses=2]
43%inc.us = add nsw i32 %0, 1 ; <i32> [#uses=2]
44%exitcond = icmp eq i32 %inc.us, 200 ; <i1> [#uses=1]
45br i1 %exitcond, label %for.inc06.us, label %for.body6.us
46
47bb.nph.us: ; preds = %bb.nph31.split.us, %for.inc06.us
48%indvar = phi i64 [ %indvar.next, %for.inc06.us ], [ 0, %bb.nph31.split.us ] ; <i64> [#uses=3]
49%arrayidx.us = getelementptr [100 x i32], ptr @A, i64 0, i64 %indvar ; <ptr> [#uses=2]
50%i.027.us = trunc i64 %indvar to i32 ; <i32> [#uses=2]
51store i32 %i.027.us, ptr %arrayidx.us
52br label %for.body6.us
53
54for.end19: ; preds = %for.inc06.us
55%idxprom21 = sext i32 %z to i64 ; <i64> [#uses=1]
56%arrayidx22 = getelementptr inbounds [100 x i32], ptr @A, i64 0, i64 %idxprom21 ; <ptr> [#uses=1]
57%tmp23 = load i32, ptr %arrayidx22 ; <i32> [#uses=1]
58ret i32 %tmp23
59}
60; CHECK: for (c2=0;c2<=99;c2++) {
61; CHECK: S{{[0-4]}}(c2);
62; CHECK: for (c4=0;c4<=199;c4++) {
63; CHECK: S{{[[0-4]}}(c2,c4);
64; CHECK: }
65; CHECK: S{{[0-4]}}(c2);
66; CHECK: }
67
68