1be51fa45SRoman Lebedev; RUN: opt < %s -passes=loop-vectorize,transform-warning -S 2>&1 | FileCheck %s 271bd59f0SDavid Sherwood 371bd59f0SDavid Sherwood; Like no_array_bounds.ll we verify warnings are generated when vectorization/interleaving is 471bd59f0SDavid Sherwood; explicitly specified and fails to occur for both fixed and scalable vectorize.width loop hints. 571bd59f0SDavid Sherwood 671bd59f0SDavid Sherwood; #pragma clang loop vectorize(enable) 771bd59f0SDavid Sherwood; for (int i = 0; i < number; i++) { 871bd59f0SDavid Sherwood; A[B[i]]++; 971bd59f0SDavid Sherwood; } 1071bd59f0SDavid Sherwood 1171bd59f0SDavid 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*7d757725SNikita Popovdefine dso_local void @foo(ptr nocapture %A, ptr nocapture readonly %B, i32 %N) { 1371bd59f0SDavid Sherwoodentry: 1471bd59f0SDavid Sherwood %cmp7 = icmp sgt i32 %N, 0 1571bd59f0SDavid Sherwood br i1 %cmp7, label %for.body.preheader, label %for.end 1671bd59f0SDavid Sherwood 1771bd59f0SDavid Sherwoodfor.body.preheader: ; preds = %entry 1871bd59f0SDavid Sherwood %wide.trip.count = zext i32 %N to i64 1971bd59f0SDavid Sherwood br label %for.body 2071bd59f0SDavid Sherwood 2171bd59f0SDavid Sherwoodfor.body: ; preds = %for.body.preheader, %for.body 2271bd59f0SDavid Sherwood %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] 23*7d757725SNikita Popov %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv 24*7d757725SNikita Popov %0 = load i32, ptr %arrayidx, align 4 2571bd59f0SDavid Sherwood %idxprom1 = sext i32 %0 to i64 26*7d757725SNikita Popov %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %idxprom1 27*7d757725SNikita Popov %1 = load i32, ptr %arrayidx2, align 4 2871bd59f0SDavid Sherwood %inc = add nsw i32 %1, 1 29*7d757725SNikita Popov store i32 %inc, ptr %arrayidx2, align 4 3071bd59f0SDavid Sherwood %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 3171bd59f0SDavid Sherwood %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count 3271bd59f0SDavid Sherwood br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !0 3371bd59f0SDavid Sherwood 3471bd59f0SDavid Sherwoodfor.end: ; preds = %for.body, %entry 3571bd59f0SDavid Sherwood ret void 3671bd59f0SDavid Sherwood} 3771bd59f0SDavid Sherwood 3871bd59f0SDavid 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*7d757725SNikita Popovdefine dso_local void @foo2(ptr nocapture %A, ptr nocapture readonly %B, i32 %N) { 4071bd59f0SDavid Sherwoodentry: 4171bd59f0SDavid Sherwood %cmp7 = icmp sgt i32 %N, 0 4271bd59f0SDavid Sherwood br i1 %cmp7, label %for.body.preheader, label %for.end 4371bd59f0SDavid Sherwood 4471bd59f0SDavid Sherwoodfor.body.preheader: ; preds = %entry 4571bd59f0SDavid Sherwood %wide.trip.count = zext i32 %N to i64 4671bd59f0SDavid Sherwood br label %for.body 4771bd59f0SDavid Sherwood 4871bd59f0SDavid Sherwoodfor.body: ; preds = %for.body.preheader, %for.body 4971bd59f0SDavid Sherwood %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ] 50*7d757725SNikita Popov %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv 51*7d757725SNikita Popov %0 = load i32, ptr %arrayidx, align 4 5271bd59f0SDavid Sherwood %idxprom1 = sext i32 %0 to i64 53*7d757725SNikita Popov %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %idxprom1 54*7d757725SNikita Popov %1 = load i32, ptr %arrayidx2, align 4 5571bd59f0SDavid Sherwood %inc = add nsw i32 %1, 1 56*7d757725SNikita Popov store i32 %inc, ptr %arrayidx2, align 4 5771bd59f0SDavid Sherwood %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 5871bd59f0SDavid Sherwood %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count 5971bd59f0SDavid Sherwood br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !3 6071bd59f0SDavid Sherwood 6171bd59f0SDavid Sherwoodfor.end: ; preds = %for.body, %entry 6271bd59f0SDavid Sherwood ret void 6371bd59f0SDavid Sherwood} 6471bd59f0SDavid Sherwood 6571bd59f0SDavid Sherwood!0 = distinct !{!0, !1, !2} 6671bd59f0SDavid Sherwood!1 = !{!"llvm.loop.vectorize.enable", i1 true} 6771bd59f0SDavid Sherwood!2 = !{!"llvm.loop.vectorize.width", i32 1} 6871bd59f0SDavid Sherwood!3 = distinct !{!3, !1, !2, !4} 6971bd59f0SDavid Sherwood!4 = !{!"llvm.loop.vectorize.scalable.enable", i1 true} 70