1 ; RUN: opt < %s -passes=loop-interchange -cache-line-size=64 -pass-remarks-missed='loop-interchange' -pass-remarks-output=%t -S \
2 ; RUN: -verify-dom-info -verify-loop-info -verify-loop-lcssa -stats 2>&1
3 ; RUN: FileCheck --input-file=%t --check-prefix=REMARKS %s
9 @e = global [1 x [1 x i32]] zeroinitializer
11 ; REMARKS: --- !Passed
12 ; REMARKS-NEXT: Pass: loop-interchange
13 ; REMARKS-NEXT: Name: Interchanged
14 ; REMARKS-NEXT: Function: pr43326
16 define void @pr43326() {
19 %tobool.not2 = icmp eq i32 %0, 0
20 br i1 %tobool.not2, label %for.end14, label %for.body.lr.ph
22 for.body.lr.ph: ; preds = %entry
23 %d.promoted = load i32, ptr @d
24 %a.promoted = load i32, ptr @a
27 for.body: ; preds = %for.body.lr.ph, %for.inc12
28 %inc1312 = phi i32 [ %a.promoted, %for.body.lr.ph ], [ %inc13, %for.inc12 ]
29 %xor.lcssa.lcssa11 = phi i32 [ %d.promoted, %for.body.lr.ph ], [ %xor.lcssa.lcssa, %for.inc12 ]
32 for.body3: ; preds = %for.body, %for.inc10
33 %xor.lcssa9 = phi i32 [ %xor.lcssa.lcssa11, %for.body ], [ %xor.lcssa, %for.inc10 ]
34 %dec7 = phi i8 [ 0, %for.body ], [ %dec, %for.inc10 ]
35 %idxprom8 = sext i8 %dec7 to i64
38 for.body7: ; preds = %for.body3, %for.inc
39 %xor5 = phi i32 [ %xor.lcssa9, %for.body3 ], [ %xor, %for.inc ]
40 %inc4 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
41 %idxprom = sext i32 %inc4 to i64
42 %arrayidx9 = getelementptr inbounds [1 x [1 x i32]], ptr @e, i64 0, i64 %idxprom, i64 %idxprom8
43 %1 = load i32, ptr %arrayidx9
44 %xor = xor i32 %xor5, %1
47 for.inc: ; preds = %for.body7
48 %inc = add nsw i32 %inc4, 1
49 %cmp5 = icmp slt i32 %inc, 1
50 br i1 %cmp5, label %for.body7, label %for.end
52 for.end: ; preds = %for.inc
53 %xor.lcssa = phi i32 [ %xor, %for.inc ]
54 %inc.lcssa = phi i32 [ %inc, %for.inc ]
57 for.inc10: ; preds = %for.end
58 %dec = add i8 %dec7, -1
59 %cmp = icmp sgt i8 %dec, -1
60 br i1 %cmp, label %for.body3, label %for.end11
62 for.end11: ; preds = %for.inc10
63 %xor.lcssa.lcssa = phi i32 [ %xor.lcssa, %for.inc10 ]
64 %dec.lcssa = phi i8 [ %dec, %for.inc10 ]
65 %inc.lcssa.lcssa = phi i32 [ %inc.lcssa, %for.inc10 ]
68 for.inc12: ; preds = %for.end11
69 %inc13 = add nsw i32 %inc1312, 1
70 %tobool.not = icmp eq i32 %inc13, 0
71 br i1 %tobool.not, label %for.cond.for.end14_crit_edge, label %for.body
73 for.cond.for.end14_crit_edge: ; preds = %for.inc12
74 %inc13.lcssa = phi i32 [ %inc13, %for.inc12 ]
75 %inc.lcssa.lcssa.lcssa = phi i32 [ %inc.lcssa.lcssa, %for.inc12 ]
76 %xor.lcssa.lcssa.lcssa = phi i32 [ %xor.lcssa.lcssa, %for.inc12 ]
77 %dec.lcssa.lcssa = phi i8 [ %dec.lcssa, %for.inc12 ]
78 store i8 %dec.lcssa.lcssa, ptr @b
79 store i32 %xor.lcssa.lcssa.lcssa, ptr @d
80 store i32 %inc.lcssa.lcssa.lcssa, ptr @c
81 store i32 %inc13.lcssa, ptr @a
84 for.end14: ; preds = %for.cond.for.end14_crit_edge, %entry