2 ; RUN: opt < %s -analyze -delinearize -debug 2>&1 | FileCheck %s
3 ; void foo (int m, int n, char *A) {
4 ; for (int i=0; i < m; i++)
5 ; for(int j=0; j< n; j++)
9 ; ModuleID = 'delin.cpp'
10 ;target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
11 ;target triple = "aarch64--linux-gnu"
13 ; CHECK-LABEL: Delinearization on function foo
14 ; CHECK: Inst: %4 = load i8, i8* %arrayidx.us, align 1
16 ; CHECK-NEXT: {0,+,1}<nuw><nsw><%for.body3.lr.ph.us>
17 ; CHECK-NEXT: {0,+,1}<nuw><nsw><%for.body3.us>
18 ; CHECK: succeeded to delinearize
20 define void @foo(i32 %m, i32 %n, i8* nocapture %A) #0 {
24 entry.split: ; preds = %entry
25 %cmp15 = icmp sgt i32 %m, 0
26 %cmp213 = icmp sgt i32 %n, 0
27 %or.cond = and i1 %cmp15, %cmp213
28 br i1 %or.cond, label %for.cond1.preheader.lr.ph.split.us, label %for.end8
30 for.cond1.preheader.lr.ph.split.us: ; preds = %entry.split
32 %1 = sext i32 %n to i64
34 br label %for.body3.lr.ph.us
36 for.body3.us: ; preds = %for.body3.us, %for.body3.lr.ph.us
37 %indvars.iv = phi i64 [ 0, %for.body3.lr.ph.us ], [ %indvars.iv.next, %for.body3.us ]
38 %3 = add nsw i64 %indvars.iv, %5
39 %arrayidx.us = getelementptr inbounds i8, i8* %A, i64 %3
40 %4 = load i8, i8* %arrayidx.us, align 1
41 %add4.us = add i8 %4, 1
42 store i8 %add4.us, i8* %arrayidx.us, align 1
43 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
44 %lftr.wideiv = trunc i64 %indvars.iv to i32
45 %exitcond = icmp eq i32 %lftr.wideiv, %0
46 br i1 %exitcond, label %for.cond1.for.inc6_crit_edge.us, label %for.body3.us
48 for.body3.lr.ph.us: ; preds = %for.cond1.for.inc6_crit_edge.us, %for.cond1.preheader.lr.ph.split.us
49 %indvars.iv19 = phi i64 [ %indvars.iv.next20, %for.cond1.for.inc6_crit_edge.us ], [ 0, %for.cond1.preheader.lr.ph.split.us ]
50 %5 = mul nsw i64 %indvars.iv19, %1
51 br label %for.body3.us
53 for.cond1.for.inc6_crit_edge.us: ; preds = %for.body3.us
54 %indvars.iv.next20 = add nuw nsw i64 %indvars.iv19, 1
55 %lftr.wideiv22 = trunc i64 %indvars.iv19 to i32
56 %exitcond23 = icmp eq i32 %lftr.wideiv22, %2
57 br i1 %exitcond23, label %for.end8.loopexit, label %for.body3.lr.ph.us
59 for.end8.loopexit: ; preds = %for.cond1.for.inc6_crit_edge.us
62 for.end8: ; preds = %for.end8.loopexit, %entry.split