1 ; RUN: opt %loadPolly -polly-opt-isl -polly-ast -polly-opt-fusion=max -analyze < %s | FileCheck %s
4 ; void tf(int C[256][256][256], int A0[256][256][256], int A1[256][256][256]) {
5 ; for (int i = 0; i < 256; ++i)
6 ; for (int j = 0; j < 256; ++j)
7 ; for (int k = 0; k < 256; ++k)
8 ; C[i][j][k] += A0[i][j][k];
10 ; for (int i = 0; i < 256; ++i)
11 ; for (int j = 0; j < 256; ++j)
12 ; for (int k = 0; k < 256; ++k)
13 ; C[i][j][k] += A1[i][j][k];
16 ; The tile_after_fusion.ll test has two statements in separate loop nests and
17 ; checks whether they are tiled after being fused when polly-opt-fusion equals
20 ; CHECK: 1st level tiling - Tiles
21 ; CHECK-NEXT: for (int c0 = 0; c0 <= 7; c0 += 1)
22 ; CHECK-NEXT: for (int c1 = 0; c1 <= 7; c1 += 1)
23 ; CHECK-NEXT: for (int c2 = 0; c2 <= 7; c2 += 1) {
24 ; CHECK-NEXT: // 1st level tiling - Points
25 ; CHECK-NEXT: for (int c3 = 0; c3 <= 31; c3 += 1)
26 ; CHECK-NEXT: for (int c4 = 0; c4 <= 31; c4 += 1)
27 ; CHECK-NEXT: for (int c5 = 0; c5 <= 31; c5 += 1) {
28 ; CHECK-NEXT: Stmt_for_body6(32 * c0 + c3, 32 * c1 + c4, 32 * c2 + c5);
29 ; CHECK-NEXT: Stmt_for_body34(32 * c0 + c3, 32 * c1 + c4, 32 * c2 + c5);
31 source_filename = "tile_after_fusion.c"
32 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
34 define void @tf([256 x [256 x i32]]* %C, [256 x [256 x i32]]* %A0, [256 x [256 x i32]]* %A1) {
38 for.cond: ; preds = %for.inc20, %entry
39 %indvars.iv13 = phi i64 [ %indvars.iv.next14, %for.inc20 ], [ 0, %entry ]
40 %exitcond15 = icmp ne i64 %indvars.iv13, 256
41 br i1 %exitcond15, label %for.body, label %for.end22
43 for.body: ; preds = %for.cond
46 for.cond1: ; preds = %for.inc17, %for.body
47 %indvars.iv10 = phi i64 [ %indvars.iv.next11, %for.inc17 ], [ 0, %for.body ]
48 %exitcond12 = icmp ne i64 %indvars.iv10, 256
49 br i1 %exitcond12, label %for.body3, label %for.end19
51 for.body3: ; preds = %for.cond1
54 for.cond4: ; preds = %for.inc, %for.body3
55 %indvars.iv7 = phi i64 [ %indvars.iv.next8, %for.inc ], [ 0, %for.body3 ]
56 %exitcond9 = icmp ne i64 %indvars.iv7, 256
57 br i1 %exitcond9, label %for.body6, label %for.end
59 for.body6: ; preds = %for.cond4
60 %arrayidx10 = getelementptr inbounds [256 x [256 x i32]], [256 x [256 x i32]]* %A0, i64 %indvars.iv13, i64 %indvars.iv10, i64 %indvars.iv7
61 %tmp = load i32, i32* %arrayidx10, align 4
62 %arrayidx16 = getelementptr inbounds [256 x [256 x i32]], [256 x [256 x i32]]* %C, i64 %indvars.iv13, i64 %indvars.iv10, i64 %indvars.iv7
63 %tmp16 = load i32, i32* %arrayidx16, align 4
64 %add = add nsw i32 %tmp16, %tmp
65 store i32 %add, i32* %arrayidx16, align 4
68 for.inc: ; preds = %for.body6
69 %indvars.iv.next8 = add nuw nsw i64 %indvars.iv7, 1
72 for.end: ; preds = %for.cond4
75 for.inc17: ; preds = %for.end
76 %indvars.iv.next11 = add nuw nsw i64 %indvars.iv10, 1
79 for.end19: ; preds = %for.cond1
82 for.inc20: ; preds = %for.end19
83 %indvars.iv.next14 = add nuw nsw i64 %indvars.iv13, 1
86 for.end22: ; preds = %for.cond
89 for.cond24: ; preds = %for.inc54, %for.end22
90 %indvars.iv4 = phi i64 [ %indvars.iv.next5, %for.inc54 ], [ 0, %for.end22 ]
91 %exitcond6 = icmp ne i64 %indvars.iv4, 256
92 br i1 %exitcond6, label %for.body26, label %for.end56
94 for.body26: ; preds = %for.cond24
97 for.cond28: ; preds = %for.inc51, %for.body26
98 %indvars.iv1 = phi i64 [ %indvars.iv.next2, %for.inc51 ], [ 0, %for.body26 ]
99 %exitcond3 = icmp ne i64 %indvars.iv1, 256
100 br i1 %exitcond3, label %for.body30, label %for.end53
102 for.body30: ; preds = %for.cond28
105 for.cond32: ; preds = %for.inc48, %for.body30
106 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc48 ], [ 0, %for.body30 ]
107 %exitcond = icmp ne i64 %indvars.iv, 256
108 br i1 %exitcond, label %for.body34, label %for.end50
110 for.body34: ; preds = %for.cond32
111 %arrayidx40 = getelementptr inbounds [256 x [256 x i32]], [256 x [256 x i32]]* %A1, i64 %indvars.iv4, i64 %indvars.iv1, i64 %indvars.iv
112 %tmp17 = load i32, i32* %arrayidx40, align 4
113 %arrayidx46 = getelementptr inbounds [256 x [256 x i32]], [256 x [256 x i32]]* %C, i64 %indvars.iv4, i64 %indvars.iv1, i64 %indvars.iv
114 %tmp18 = load i32, i32* %arrayidx46, align 4
115 %add47 = add nsw i32 %tmp18, %tmp17
116 store i32 %add47, i32* %arrayidx46, align 4
119 for.inc48: ; preds = %for.body34
120 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
123 for.end50: ; preds = %for.cond32
126 for.inc51: ; preds = %for.end50
127 %indvars.iv.next2 = add nuw nsw i64 %indvars.iv1, 1
130 for.end53: ; preds = %for.cond28
133 for.inc54: ; preds = %for.end53
134 %indvars.iv.next5 = add nuw nsw i64 %indvars.iv4, 1
137 for.end56: ; preds = %for.cond24