Skip to content

Commit a5e45b1

Browse files
committed
Add interchange-s231.ll
1 parent f22cde1 commit a5e45b1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
; REQUIRES: asserts
2+
; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 -verify-dom-info -verify-loop-info \
3+
; RUN: -S -debug 2>&1 | FileCheck %s
4+
5+
@aa = global [256 x [256 x float]] zeroinitializer, align 64
6+
@bb = global [256 x [256 x float]] zeroinitializer, align 64
7+
8+
;; for (int nl = 0; nl < 10000000/256; nl++)
9+
;; for (int i = 0; i < 256; ++i)
10+
;; for (int j = 1; j < 256; j++)
11+
;; aa[j][i] = aa[j - 1][i] + bb[j][i];
12+
13+
; CHECK: Found output dependency between Src and Dst
14+
; CHECK: Src: store float %add, ptr %arrayidx18
15+
; CHECK: Dst: store float %add, ptr %arrayidx18
16+
; CHECK: Processing InnerLoopId = 2 and OuterLoopId = 1
17+
; CHECK: Not interchanging loops. Cannot prove legality.
18+
19+
define float @s231() {
20+
entry:
21+
br label %for.cond1.preheader
22+
23+
; Loop:
24+
for.cond1.preheader: ; preds = %entry, %for.cond.cleanup3
25+
%nl.036 = phi i32 [ 0, %entry ], [ %inc23, %for.cond.cleanup3 ]
26+
br label %for.cond5.preheader
27+
28+
for.cond.cleanup3: ; preds = %for.cond.cleanup7
29+
%inc23 = add nuw nsw i32 %nl.036, 1
30+
%exitcond41 = icmp ne i32 %inc23, 39062
31+
br i1 %exitcond41, label %for.cond1.preheader, label %for.cond.cleanup
32+
33+
for.cond.cleanup7: ; preds = %for.body8
34+
%indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
35+
%exitcond40 = icmp ne i64 %indvars.iv.next39, 256
36+
br i1 %exitcond40, label %for.cond5.preheader, label %for.cond.cleanup3
37+
38+
for.body8: ; preds = %for.cond5.preheader, %for.body8
39+
%indvars.iv = phi i64 [ 1, %for.cond5.preheader ], [ %indvars.iv.next, %for.body8 ]
40+
%0 = add nsw i64 %indvars.iv, -1
41+
%arrayidx10 = getelementptr inbounds [256 x [256 x float]], ptr @aa, i64 0, i64 %0, i64 %indvars.iv38
42+
%1 = load float, ptr %arrayidx10, align 4
43+
%arrayidx14 = getelementptr inbounds [256 x [256 x float]], ptr @bb, i64 0, i64 %indvars.iv, i64 %indvars.iv38
44+
%2 = load float, ptr %arrayidx14, align 4
45+
%add = fadd fast float %2, %1
46+
%arrayidx18 = getelementptr inbounds [256 x [256 x float]], ptr @aa, i64 0, i64 %indvars.iv, i64 %indvars.iv38
47+
store float %add, ptr %arrayidx18, align 4
48+
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
49+
%exitcond = icmp ne i64 %indvars.iv.next, 256
50+
br i1 %exitcond, label %for.body8, label %for.cond.cleanup7
51+
52+
for.cond5.preheader: ; preds = %for.cond1.preheader, %for.cond.cleanup7
53+
%indvars.iv38 = phi i64 [ 0, %for.cond1.preheader ], [ %indvars.iv.next39, %for.cond.cleanup7 ]
54+
br label %for.body8
55+
56+
; Exit blocks
57+
for.cond.cleanup: ; preds = %for.cond.cleanup3
58+
ret float undef
59+
}

0 commit comments

Comments
 (0)