Skip to content

Commit c290bec

Browse files
author
GYT
committed
Testing part 2: VectorizeOnlyWhenForced code path
1 parent c0e6aec commit c290bec

File tree

2 files changed

+48
-2
lines changed

2 files changed

+48
-2
lines changed

llvm/test/Transforms/LoopVectorize/check-disabled-vectorization-msgs.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; This test checks that we emit only the correct debug message and
1+
; This test checks that we emit only the correct debug messages and
22
; optimization remark when the loop vectorizer is disabled by loop metadata.
33

44
; REQUIRES: asserts
@@ -44,4 +44,4 @@ for.body: ; preds = %entry, %for.body
4444
}
4545

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

0 commit comments

Comments
 (0)