Skip to content

Commit 3c4c8de

Browse files
author
GYT
committed
Testing part 3: hasDisableAllTransformsHint code path
1 parent 109b3fd commit 3c4c8de

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
; This test checks that we emit only the correct debug messages and
2+
; optimization remark when the loop vectorizer is disabled by loop metadata
3+
; that requests no loop transformations.
4+
5+
; REQUIRES: asserts
6+
; RUN: opt -passes=loop-vectorize -pass-remarks=loop-vectorize \
7+
; RUN: -pass-remarks-missed=loop-vectorize \
8+
; RUN: -pass-remarks-analysis=loop-vectorize -debug -disable-output \
9+
; RUN: -force-vector-interleave=1 -force-vector-width=2 \
10+
; RUN: < %s 2>&1 | FileCheck %s
11+
; CHECK-NOT: LV: We can vectorize this loop
12+
; CHECK-NOT: LV: Not vectorizing: #pragma vectorize disable.
13+
; CHECK-NOT: LV: [FIXME] Not vectorizing: loop vect disabled for an unknown reason
14+
; CHECK-NOT: LV: Not vectorizing: VectorizeOnlyWhenForced is set
15+
; CHECK-NOT: LV: Not vectorizing: Disabled/already vectorized
16+
; CHECK-NOT: LV: Not vectorizing: Cannot prove legality
17+
; CHECK: LV: Loop hints: force=disabled
18+
; CHECK: LV: Not vectorizing: loop hasDisableAllTransformsHint.
19+
; CHECK: remark:
20+
; CHECK-SAME: loop not vectorized: vectorization is explicitly disabled
21+
; CHECK: LV: Loop hints prevent vectorization
22+
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
23+
define void @disable_nonforced(ptr nocapture %a, i32 %n) {
24+
entry:
25+
%cmp4 = icmp sgt i32 %n, 0
26+
br i1 %cmp4, label %for.body, label %for.end
27+
28+
for.body:
29+
%indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]
30+
%arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv
31+
%0 = trunc i64 %indvars.iv to i32
32+
store i32 %0, ptr %arrayidx, align 4
33+
%indvars.iv.next = add i64 %indvars.iv, 1
34+
%lftr.wideiv = trunc i64 %indvars.iv.next to i32
35+
%exitcond = icmp eq i32 %lftr.wideiv, %n
36+
br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
37+
38+
for.end:
39+
ret void
40+
}
41+
42+
!0 = !{!0, !{!"llvm.loop.disable_nonforced"}}

0 commit comments

Comments
 (0)