1 ; RUN: opt < %s -aa-pipeline=default -passes='print<da>' -da-miv-max-level-threshold=2
3 ;; Check to make sure when MIV tests reach a maximum depth level
4 ;; threshold, the resulting dependence is conservatively correct.
6 ;; for (int i = 0; i < n; i++)
7 ;; for (int j = 0; j < m; j++)
8 ;; for (int k = 0; k < o; k++)
9 ;; A[i+j+k] = A[i-j+k] + B[i+j+k];
12 ; CHECK: Src: %2 = load float, float* %arrayidx, align 4 --> Dst: %5 = load float, float* %arrayidx12, align 4
13 ; CHECK-NEXT: da analyze - none!
14 ; CHECK: Src: %2 = load float, float* %arrayidx, align 4 --> Dst: store float %add13, float* %arrayidx17, align 4
15 ; CHECK-NEXT: da analyze - anti [* * *|<]!
16 ; CHECK: Src: %5 = load float, float* %arrayidx12, align 4 --> Dst: store float %add13, float* %arrayidx17, align 4
17 ; CHECK-NEXT: da analyze - none!
19 define void @foo(ptr noalias %A, ptr noalias %B, i32 signext %m, i32 signext %n, i32 signext %o) {
21 %cmp5 = icmp sgt i32 %n, 0
22 br i1 %cmp5, label %for.body.preheader, label %for.end23
24 for.body.preheader: ; preds = %entry
25 %wide.trip.count21 = zext i32 %n to i64
28 for.body: ; preds = %for.body.preheader, %for.inc21
29 %indvars.iv19 = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next20, %for.inc21 ]
30 %cmp23 = icmp sgt i32 %m, 0
31 br i1 %cmp23, label %for.body4.preheader, label %for.inc21
33 for.body4.preheader: ; preds = %for.body
34 %wide.trip.count17 = zext i32 %m to i64
37 for.body4: ; preds = %for.body4.preheader, %for.inc18
38 %indvars.iv12 = phi i64 [ 0, %for.body4.preheader ], [ %indvars.iv.next13, %for.inc18 ]
39 %cmp61 = icmp sgt i32 %o, 0
40 br i1 %cmp61, label %for.body8.preheader, label %for.inc18
42 for.body8.preheader: ; preds = %for.body4
43 %wide.trip.count = zext i32 %o to i64
46 for.body8: ; preds = %for.body8.preheader, %for.body8
47 %indvars.iv = phi i64 [ 0, %for.body8.preheader ], [ %indvars.iv.next, %for.body8 ]
48 %0 = sub nsw i64 %indvars.iv19, %indvars.iv12
49 %1 = add nsw i64 %0, %indvars.iv
50 %arrayidx = getelementptr inbounds float, ptr %A, i64 %1
51 %2 = load float, ptr %arrayidx, align 4
52 %3 = add nuw nsw i64 %indvars.iv19, %indvars.iv12
53 %4 = add nuw nsw i64 %3, %indvars.iv
54 %arrayidx12 = getelementptr inbounds float, ptr %B, i64 %4
55 %5 = load float, ptr %arrayidx12, align 4
56 %add13 = fadd fast float %2, %5
57 %6 = add nuw nsw i64 %indvars.iv19, %indvars.iv12
58 %7 = add nuw nsw i64 %6, %indvars.iv
59 %arrayidx17 = getelementptr inbounds float, ptr %A, i64 %7
60 store float %add13, ptr %arrayidx17, align 4
61 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
62 %exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count
63 br i1 %exitcond, label %for.body8, label %for.inc18.loopexit
65 for.inc18.loopexit: ; preds = %for.body8
68 for.inc18: ; preds = %for.inc18.loopexit, %for.body4
69 %indvars.iv.next13 = add nuw nsw i64 %indvars.iv12, 1
70 %exitcond18 = icmp ne i64 %indvars.iv.next13, %wide.trip.count17
71 br i1 %exitcond18, label %for.body4, label %for.inc21.loopexit
73 for.inc21.loopexit: ; preds = %for.inc18
76 for.inc21: ; preds = %for.inc21.loopexit, %for.body
77 %indvars.iv.next20 = add nuw nsw i64 %indvars.iv19, 1
78 %exitcond22 = icmp ne i64 %indvars.iv.next20, %wide.trip.count21
79 br i1 %exitcond22, label %for.body, label %for.end23.loopexit
81 for.end23.loopexit: ; preds = %for.inc21
84 for.end23: ; preds = %for.end23.loopexit, %entry