1; RUN: opt < %s -basic-aa -loop-interchange -pass-remarks-missed='loop-interchange' -pass-remarks-output=%t -S \
2; RUN:     -verify-dom-info -verify-loop-info -verify-loop-lcssa 2>&1
3; RUN: FileCheck --input-file=%t --check-prefix=REMARKS %s
4
5target triple = "powerpc64le-unknown-linux-gnu"
6
7; REMARKS: --- !Passed
8; REMARKS-NEXT: Pass:            loop-interchange
9; REMARKS-NEXT: Name:            Interchanged
10; REMARKS-NEXT: Function:        pr48212
11
12define void @pr48212([5 x i32]* %filter) {
13entry:
14  br label %L1
15
16L1:                                               ; preds = %entry
17  br label %for.body
18
19for.body:                                         ; preds = %L1, %for.inc6
20  %temp.04 = phi i32 [ undef, %L1 ], [ %temp.1.lcssa, %for.inc6 ]
21  %k1.03 = phi i32 [ 0, %L1 ], [ %inc7, %for.inc6 ]
22  br label %L2
23
24L2:                                               ; preds = %for.body
25  br label %for.body3
26
27for.body3:                                        ; preds = %L2, %for.inc
28  %temp.12 = phi i32 [ %temp.04, %L2 ], [ %add, %for.inc ]
29  %k2.01 = phi i32 [ 0, %L2 ], [ %inc, %for.inc ]
30  %idxprom = sext i32 %k2.01 to i64
31  %arrayidx = getelementptr inbounds [5 x i32], [5 x i32]* %filter, i64 %idxprom
32  %idxprom4 = sext i32 %k1.03 to i64
33  %arrayidx5 = getelementptr inbounds [5 x i32], [5 x i32]* %arrayidx, i64 0, i64 %idxprom4
34  %0 = load i32, i32* %arrayidx5
35  %add = add nsw i32 %temp.12, %0
36  br label %for.inc
37
38for.inc:                                          ; preds = %for.body3
39  %inc = add nsw i32 %k2.01, 1
40  %cmp2 = icmp slt i32 %inc, 3
41  br i1 %cmp2, label %for.body3, label %for.end
42
43for.end:                                          ; preds = %for.inc
44  %temp.1.lcssa = phi i32 [ %add, %for.inc ]
45  br label %for.inc6
46
47for.inc6:                                         ; preds = %for.end
48  %inc7 = add nsw i32 %k1.03, 1
49  %cmp = icmp slt i32 %inc7, 5
50  br i1 %cmp, label %for.body, label %for.end8
51
52for.end8:                                         ; preds = %for.inc6
53  ret void
54}
55
56
57