1; RUN: opt -delinearize -analyze -enable-new-pm=0 < %s | FileCheck %s
2; RUN: opt -passes='print<delinearization>' -disable-output < %s 2>&1 | FileCheck %s
3;
4;    void foo(float *A, long *p) {
5;      for (long i = 0; i < 100; i++)
6;        for (long j = 0; j < 100; j++)
7;          A[i * (*p) + j] += i + j;
8;    }
9;
10; CHECK: ArrayDecl[UnknownSize][%pval] with elements of 4 bytes.
11; CHECK: ArrayRef[{0,+,1}<nuw><nsw><%bb2>][{0,+,1}<nuw><nsw><%bb4>]
12;
13target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
14
15define void @foo(float* %A, i64* %p) {
16bb:
17  br label %bb2
18
19bb2:                                              ; preds = %bb16, %bb
20  %i.0 = phi i64 [ 0, %bb ], [ %tmp17, %bb16 ]
21  %exitcond1 = icmp ne i64 %i.0, 100
22  br i1 %exitcond1, label %bb3, label %bb18
23
24bb3:                                              ; preds = %bb2
25  br label %bb4
26
27bb4:                                              ; preds = %bb13, %bb3
28  %j.0 = phi i64 [ 0, %bb3 ], [ %tmp14, %bb13 ]
29  %exitcond = icmp ne i64 %j.0, 100
30  br i1 %exitcond, label %bb5, label %bb15
31
32bb5:                                              ; preds = %bb4
33  %tmp = add nuw nsw i64 %i.0, %j.0
34  %tmp6 = sitofp i64 %tmp to float
35  %pval = load i64, i64* %p, align 8
36  %tmp8 = mul nsw i64 %i.0, %pval
37  %tmp9 = add nsw i64 %tmp8, %j.0
38  %tmp10 = getelementptr inbounds float, float* %A, i64 %tmp9
39  %tmp11 = load float, float* %tmp10, align 4
40  %tmp12 = fadd float %tmp11, %tmp6
41  store float %tmp12, float* %tmp10, align 4
42  br label %bb13
43
44bb13:                                             ; preds = %bb5
45  %tmp14 = add nuw nsw i64 %j.0, 1
46  br label %bb4
47
48bb15:                                             ; preds = %bb4
49  br label %bb16
50
51bb16:                                             ; preds = %bb15
52  %tmp17 = add nuw nsw i64 %i.0, 1
53  br label %bb2
54
55bb18:                                             ; preds = %bb2
56  ret void
57}
58