1 ; RUN: opt -S -passes='print<access-info>' -pass-remarks-analysis=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ANALYSIS
3 ; Test that LoopVectorize don't report 'Use #pragma loop distribute(enable) to allow loop distribution'
4 ; when we already add #pragma clang loop distribute(enable).
6 ; Testcase derived from the following C:
9 ; void foo (int *restrict y, int *restrict x, int *restrict indices, int n)
12 ; #pragma clang loop distribute(enable)
13 ; for (int i = 0; i < n; i++) {
14 ; y[i + k * M] = y[i + k* M] + 1;
15 ; y[i + k * (M+1)] = indices[i] + 2;
19 define void @foo(ptr noalias nocapture noundef %y, ptr noalias nocapture noundef readnone %x, ptr noalias nocapture noundef readonly %indices, i32 noundef %n) {
20 ; ANALYSIS: Report: unsafe dependent memory operations in loop.
21 ; ANALYSIS: Backward loop carried data dependence that prevents store-to-load forwarding.
23 %cmp22 = icmp sgt i32 %n, 0
24 br i1 %cmp22, label %for.body.preheader, label %for.cond.cleanup
26 for.body.preheader: ; preds = %entry
27 %wide.trip.count = zext i32 %n to i64
30 for.cond.cleanup.loopexit: ; preds = %for.body
31 br label %for.cond.cleanup
33 for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
36 for.body: ; preds = %for.body, %for.body.preheader
37 %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]
38 %0 = add nuw nsw i64 %indvars.iv, 300
39 %arrayidx = getelementptr inbounds i32, ptr %y, i64 %0
40 %1 = load i32, ptr %arrayidx, align 4
41 %add1 = add nsw i32 %1, 1
42 store i32 %add1, ptr %arrayidx, align 4
43 %arrayidx7 = getelementptr inbounds i32, ptr %indices, i64 %indvars.iv
44 %2 = load i32, ptr %arrayidx7, align 4
45 %add8 = add nsw i32 %2, 2
46 %3 = add nuw nsw i64 %indvars.iv, 303
47 %arrayidx12 = getelementptr inbounds i32, ptr %y, i64 %3
48 store i32 %add8, ptr %arrayidx12, align 4
49 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
50 %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
51 br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !0
54 !0 = distinct !{!0, !1}
55 !1 = !{!"llvm.loop.distribute.enable", i1 true}