1+ ; This test checks that we emit only the correct debug message and
2+ ; optimization remark when the loop vectorizer is disabled by loop metadata.
3+
4+ ; REQUIRES: asserts
5+ ; RUN: opt -passes=loop-vectorize -pass-remarks=loop-vectorize \
6+ ; RUN: -pass-remarks-missed=loop-vectorize \
7+ ; RUN: -pass-remarks-analysis=loop-vectorize -debug -disable-output \
8+ ; RUN: < %s 2>&1 | FileCheck %s
9+ ; CHECK-NOT: LV: We can vectorize this loop
10+ ; CHECK-NOT: LV: Not vectorizing: loop hasDisableAllTransformsHint
11+ ; CHECK-NOT: LV: [FIXME] Not vectorizing: loop vect disabled for an unknown reason
12+ ; CHECK-NOT: LV: Not vectorizing: VectorizeOnlyWhenForced is set
13+ ; CHECK-NOT: LV: Not vectorizing: Disabled/already vectorized
14+ ; CHECK-NOT: LV: Not vectorizing: Cannot prove legality
15+ ; CHECK: LV: Loop hints: force=disabled
16+ ; CHECK: LV: Not vectorizing: #pragma vectorize disable.
17+ ; CHECK: remark:
18+ ; CHECK-SAME: loop not vectorized: vectorization is explicitly disabled
19+ ; CHECK: LV: Loop hints prevent vectorization
20+
21+ define dso_local noundef nofpclass(nan inf) double @_Z15CompareDistmatsPKdS0_ (ptr noundef readonly captures(none) %distmat1 , ptr noundef readonly captures(none) %distmat2 ) local_unnamed_addr {
22+ entry:
23+ br label %for.body
24+
25+ for.cond.cleanup: ; preds = %for.body
26+ %add.lcssa = phi double [ %add , %for.body ]
27+ %div = fmul fast double %add.lcssa , 0x3FB1111111111111
28+ %0 = tail call fast double @llvm.sqrt.f64 (double %div )
29+ ret double %0
30+
31+ for.body: ; preds = %entry, %for.body
32+ %i.014 = phi i64 [ 0 , %entry ], [ %inc , %for.body ]
33+ %RMSD.013 = phi double [ 0 .000000e+00 , %entry ], [ %add , %for.body ]
34+ %arrayidx = getelementptr inbounds nuw double , ptr %distmat1 , i64 %i.014
35+ %1 = load double , ptr %arrayidx , align 8
36+ %arrayidx1 = getelementptr inbounds nuw double , ptr %distmat2 , i64 %i.014
37+ %2 = load double , ptr %arrayidx1 , align 8
38+ %sub = fsub fast double %1 , %2
39+ %mul = fmul fast double %sub , %sub
40+ %add = fadd fast double %mul , %RMSD.013
41+ %inc = add nuw nsw i64 %i.014 , 1
42+ %exitcond.not = icmp eq i64 %inc , 15
43+ br i1 %exitcond.not , label %for.cond.cleanup , label %for.body , !llvm.loop !0
44+ }
45+
46+ !0 = distinct !{!0 , !1 }
47+ !1 = !{!"llvm.loop.vectorize.enable" , i1 false }
0 commit comments