1 ; RUN: opt < %s -basicaa -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 | FileCheck -check-prefix=IR %s
3 ; RUN: FileCheck --input-file=%t %s
5 ; Outer loop only reductions are not supported currently.
7 @A = common global [500 x [500 x i32]] zeroinitializer
11 ;; for( int i=1;i<N;i++) {
12 ;; for( int j=1;j<N;j++)
18 ; CHECK-NEXT: Pass: loop-interchange
19 ; CHECK-NEXT: Name: UnsupportedPHI
20 ; CHECK-NEXT: Function: reduction_01
22 ; IR-LABEL: @reduction_01(
25 define i32 @reduction_01(i32 %N) {
27 br label %outer.header
29 outer.header: ; preds = %for.cond1.for.inc6_crit_edge, %entry
30 %indvars.iv18 = phi i64 [ %indvars.iv.next19, %outer.inc ], [ 1, %entry ]
31 %add15 = phi i32 [ 0, %entry ], [ %add, %outer.inc ]
34 for.body3: ; preds = %for.body3, %for.body3.lr.ph
35 %indvars.iv = phi i64 [ 1, %outer.header ], [ %indvars.iv.next, %for.body3 ]
36 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
37 %lftr.wideiv = trunc i64 %indvars.iv.next to i32
38 %exitcond = icmp eq i32 %lftr.wideiv, %N
39 br i1 %exitcond, label %outer.inc, label %for.body3
41 outer.inc: ; preds = %for.body3
42 %arrayidx5 = getelementptr inbounds [500 x [500 x i32]], [500 x [500 x i32]]* @A, i64 0, i64 %indvars.iv, i64 %indvars.iv18
43 %0 = load i32, i32* %arrayidx5
44 %add = add nsw i32 %add15, %0
45 %indvars.iv.next19 = add nuw nsw i64 %indvars.iv18, 1
46 %lftr.wideiv20 = trunc i64 %indvars.iv.next19 to i32
47 %exitcond21 = icmp eq i32 %lftr.wideiv20, %N
48 br i1 %exitcond21, label %for.end8, label %outer.header
50 for.end8: ; preds = %for.cond1.for.inc6_crit_edge, %entry