1*71bd59f0SDavid Sherwood; RUN: opt < %s -loop-vectorize -transform-warning -S 2>&1 | FileCheck %s 2*71bd59f0SDavid Sherwood 3*71bd59f0SDavid Sherwood; Like no_array_bounds.ll we verify warnings are generated when vectorization/interleaving is 4*71bd59f0SDavid Sherwood; explicitly specified and fails to occur for both fixed and scalable vectorize.width loop hints. 5*71bd59f0SDavid Sherwood 6*71bd59f0SDavid Sherwood; #pragma clang loop vectorize(enable) 7*71bd59f0SDavid Sherwood; for (int i = 0; i < number; i++) { 8*71bd59f0SDavid Sherwood; A[B[i]]++; 9*71bd59f0SDavid Sherwood; } 10*71bd59f0SDavid Sherwood 11*71bd59f0SDavid Sherwood; CHECK: warning: <unknown>:0:0: loop not interleaved: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering 12*71bd59f0SDavid Sherwooddefine dso_local void @foo(i32* nocapture %A, i32* nocapture readonly %B, i32 %N) { 13*71bd59f0SDavid Sherwoodentry: 14*71bd59f0SDavid Sherwood %cmp7 = icmp sgt i32 %N, 0 15*71bd59f0SDavid Sherwood br i1 %cmp7, label %for.body.preheader, label %for.end 16*71bd59f0SDavid Sherwood 17*71bd59f0SDavid Sherwoodfor.body.preheader: ; preds = %entry 18*71bd59f0SDavid Sherwood %wide.trip.count = zext i32 %N to i64 19*71bd59f0SDavid Sherwood br label %for.body 20*71bd59f0SDavid Sherwood 21*71bd59f0SDavid Sherwoodfor.body: ; preds = %for.body.preheader, %for.body 22*71bd59f0SDavid Sherwood %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] 23*71bd59f0SDavid Sherwood %arrayidx = getelementptr inbounds i32, i32* %B, i64 %indvars.iv 24*71bd59f0SDavid Sherwood %0 = load i32, i32* %arrayidx, align 4 25*71bd59f0SDavid Sherwood %idxprom1 = sext i32 %0 to i64 26*71bd59f0SDavid Sherwood %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %idxprom1 27*71bd59f0SDavid Sherwood %1 = load i32, i32* %arrayidx2, align 4 28*71bd59f0SDavid Sherwood %inc = add nsw i32 %1, 1 29*71bd59f0SDavid Sherwood store i32 %inc, i32* %arrayidx2, align 4 30*71bd59f0SDavid Sherwood %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 31*71bd59f0SDavid Sherwood %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count 32*71bd59f0SDavid Sherwood br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !0 33*71bd59f0SDavid Sherwood 34*71bd59f0SDavid Sherwoodfor.end: ; preds = %for.body, %entry 35*71bd59f0SDavid Sherwood ret void 36*71bd59f0SDavid Sherwood} 37*71bd59f0SDavid Sherwood 38*71bd59f0SDavid Sherwood; CHECK: warning: <unknown>:0:0: loop not vectorized: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering 39*71bd59f0SDavid Sherwooddefine dso_local void @foo2(i32* nocapture %A, i32* nocapture readonly %B, i32 %N) { 40*71bd59f0SDavid Sherwoodentry: 41*71bd59f0SDavid Sherwood %cmp7 = icmp sgt i32 %N, 0 42*71bd59f0SDavid Sherwood br i1 %cmp7, label %for.body.preheader, label %for.end 43*71bd59f0SDavid Sherwood 44*71bd59f0SDavid Sherwoodfor.body.preheader: ; preds = %entry 45*71bd59f0SDavid Sherwood %wide.trip.count = zext i32 %N to i64 46*71bd59f0SDavid Sherwood br label %for.body 47*71bd59f0SDavid Sherwood 48*71bd59f0SDavid Sherwoodfor.body: ; preds = %for.body.preheader, %for.body 49*71bd59f0SDavid Sherwood %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] 50*71bd59f0SDavid Sherwood %arrayidx = getelementptr inbounds i32, i32* %B, i64 %indvars.iv 51*71bd59f0SDavid Sherwood %0 = load i32, i32* %arrayidx, align 4 52*71bd59f0SDavid Sherwood %idxprom1 = sext i32 %0 to i64 53*71bd59f0SDavid Sherwood %arrayidx2 = getelementptr inbounds i32, i32* %A, i64 %idxprom1 54*71bd59f0SDavid Sherwood %1 = load i32, i32* %arrayidx2, align 4 55*71bd59f0SDavid Sherwood %inc = add nsw i32 %1, 1 56*71bd59f0SDavid Sherwood store i32 %inc, i32* %arrayidx2, align 4 57*71bd59f0SDavid Sherwood %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 58*71bd59f0SDavid Sherwood %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count 59*71bd59f0SDavid Sherwood br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !3 60*71bd59f0SDavid Sherwood 61*71bd59f0SDavid Sherwoodfor.end: ; preds = %for.body, %entry 62*71bd59f0SDavid Sherwood ret void 63*71bd59f0SDavid Sherwood} 64*71bd59f0SDavid Sherwood 65*71bd59f0SDavid Sherwood!0 = distinct !{!0, !1, !2} 66*71bd59f0SDavid Sherwood!1 = !{!"llvm.loop.vectorize.enable", i1 true} 67*71bd59f0SDavid Sherwood!2 = !{!"llvm.loop.vectorize.width", i32 1} 68*71bd59f0SDavid Sherwood!3 = distinct !{!3, !1, !2, !4} 69*71bd59f0SDavid Sherwood!4 = !{!"llvm.loop.vectorize.scalable.enable", i1 true} 70