xref: /llvm-project/llvm/test/Transforms/LoopVectorize/VE/disable_lv.ll (revision 7d7577256b76e4293f455b8093504d5f7044ab4b)
1; RUN: opt < %s -passes=loop-vectorize -mtriple=ve-linux -S | FileCheck %s -check-prefix=VE
2; RUN: opt < %s -passes=loop-vectorize -mtriple=x86_64-pc_linux -mcpu=core-avx2 -S | FileCheck %s -check-prefix=AVX
3
4; Make sure LV does not trigger for VE on an appealing loop that vectorizes for x86 AVX.
5
6; TODO: Remove this test once VE vector isel is deemed stable.
7
8; VE-NOT: llvm.loop.isvectorized
9; AVX: llvm.loop.isvectorized
10
11define dso_local void @foo(ptr noalias nocapture %A, ptr noalias nocapture readonly %B, i32 signext %n) local_unnamed_addr {
12entry:
13  %cmp = icmp sgt i32 %n, 0
14  br i1 %cmp, label %omp.inner.for.body.preheader, label %simd.if.end
15
16omp.inner.for.body.preheader:                     ; preds = %entry
17  %wide.trip.count = zext i32 %n to i64
18  br label %omp.inner.for.body
19
20omp.inner.for.body:                               ; preds = %omp.inner.for.body.preheader, %omp.inner.for.body
21  %indvars.iv = phi i64 [ 0, %omp.inner.for.body.preheader ], [ %indvars.iv.next, %omp.inner.for.body ]
22  %arrayidx = getelementptr inbounds i32, ptr %B, i64 %indvars.iv
23  %0 = load i32, ptr %arrayidx, align 4, !llvm.access.group !6
24  %mul6 = mul nsw i32 %0, 3
25  %arrayidx8 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
26  store i32 %mul6, ptr %arrayidx8, align 4, !llvm.access.group !6
27  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
28  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
29  br i1 %exitcond.not, label %simd.if.end, label %omp.inner.for.body, !llvm.loop !7
30
31simd.if.end:                                      ; preds = %omp.inner.for.body, %entry
32  ret void
33}
34
35!6 = distinct !{}
36!7 = distinct !{!7, !8, !9}
37!8 = !{!"llvm.loop.parallel_accesses", !6}
38!9 = !{!"llvm.loop.vectorize.enable", i1 true}
39