1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
8 ; void foo(long n, struct com A[][n]) {
9 ; for (long i = 0; i < 100; i++)
10 ; for (long j = 0; j < 1000; j++)
11 ; A[i][j].Real += A[i][j].Img;
15 ; struct com A[100][1000];
20 ; CHECK-NEXT: double MemRef_A[*][(2 * %n)]; // Element size 8
23 ; CHECK: Stmt_for_body3
24 ; CHECK-NEXT: Domain :=
25 ; CHECK-NEXT: [n] -> { Stmt_for_body3[i0, i1] : 0 <= i0 <= 99 and 0 <= i1 <= 999 };
26 ; CHECK-NEXT: Schedule :=
27 ; CHECK-NEXT: [n] -> { Stmt_for_body3[i0, i1] -> [i0, i1] };
28 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
29 ; CHECK-NEXT: [n] -> { Stmt_for_body3[i0, i1] -> MemRef_A[i0, 1 + 2i1] };
30 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
31 ; CHECK-NEXT: [n] -> { Stmt_for_body3[i0, i1] -> MemRef_A[i0, 2i1] };
32 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
33 ; CHECK-NEXT: [n] -> { Stmt_for_body3[i0, i1] -> MemRef_A[i0, 2i1] };
35 source_filename = "/tmp/test.c"
36 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
38 %struct.com = type { double, double }
39 %struct.com2 = type { [20000000000 x double] }
41 define void @foo(i64 %n, ptr %A) {
45 for.cond: ; preds = %for.inc7, %entry
46 %i.0 = phi i64 [ 0, %entry ], [ %inc8, %for.inc7 ]
47 %exitcond1 = icmp ne i64 %i.0, 100
48 br i1 %exitcond1, label %for.body, label %for.end9
50 for.body: ; preds = %for.cond
53 for.cond1: ; preds = %for.inc, %for.body
54 %j.0 = phi i64 [ 0, %for.body ], [ %inc, %for.inc ]
55 %exitcond = icmp ne i64 %j.0, 1000
56 br i1 %exitcond, label %for.body3, label %for.end
58 for.body3: ; preds = %for.cond1
59 %tmp = mul nsw i64 %i.0, %n
60 %arrayidx = getelementptr inbounds %struct.com, ptr %A, i64 %tmp
61 %arrayidx4 = getelementptr inbounds %struct.com, ptr %arrayidx, i64 %j.0
62 %Img = getelementptr inbounds %struct.com, ptr %arrayidx4, i64 0, i32 1
63 %tmp2 = load double, ptr %Img, align 8
64 %tmp3 = mul nsw i64 %i.0, %n
65 %arrayidx5 = getelementptr inbounds %struct.com, ptr %A, i64 %tmp3
66 %arrayidx6 = getelementptr inbounds %struct.com, ptr %arrayidx5, i64 %j.0
67 %tmp4 = load double, ptr %arrayidx6, align 8
68 %add = fadd double %tmp4, %tmp2
69 store double %add, ptr %arrayidx6, align 8
72 for.inc: ; preds = %for.body3
73 %inc = add nuw nsw i64 %j.0, 1
76 for.end: ; preds = %for.cond1
79 for.inc7: ; preds = %for.end
80 %inc8 = add nuw nsw i64 %i.0, 1
83 for.end9: ; preds = %for.cond
88 ; CHECK-NEXT: double MemRef_O[*][%n]; // Element size 8
91 define void @foo_overflow(i64 %n, ptr nocapture %O) local_unnamed_addr #0 {
95 for.cond.cleanup: ; preds = %for.cond.cleanup3
98 for.body: ; preds = %for.cond.cleanup3, %entry
99 %i.024 = phi i64 [ 0, %entry ], [ %inc12, %for.cond.cleanup3 ]
100 %0 = mul nsw i64 %i.024, %n
101 %arrayidx = getelementptr inbounds %struct.com2, ptr %O, i64 %0
104 for.cond.cleanup3: ; preds = %for.body4
105 %inc12 = add nuw nsw i64 %i.024, 1
106 %exitcond25 = icmp eq i64 %inc12, 100
107 br i1 %exitcond25, label %for.cond.cleanup, label %for.body
109 for.body4: ; preds = %for.body4, %for.body
110 %j.023 = phi i64 [ 0, %for.body ], [ %inc, %for.body4 ]
111 %arrayidx5 = getelementptr inbounds %struct.com2, ptr %arrayidx, i64 %j.023
112 %arrayidx6 = getelementptr inbounds [20000000000 x double], ptr %arrayidx5, i64 0, i64 1
113 %1 = load double, ptr %arrayidx6, align 8
114 %2 = load double, ptr %arrayidx5, align 8
115 %add = fadd double %1, %2
116 store double %add, ptr %arrayidx5, align 8
117 %inc = add nuw nsw i64 %j.023, 1
118 %exitcond = icmp eq i64 %inc, 1000
119 br i1 %exitcond, label %for.cond.cleanup3, label %for.body4