Skip to content

Commit ea14bdb

Browse files
committed
[LV] Add test showing debug output for loops with uncountable BTCs.
Currently we print an early-exit related related debug message, even though there's no early exit.
1 parent cda43e1 commit ea14bdb

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
; REQUIRES: asserts
2+
; RUN: opt -p loop-vectorize -debug %s 2>&1 | FileCheck %s
3+
4+
5+
; CHECK-LABEL: LV: Checking a loop in 'latch_exit_cannot_compute_btc_due_to_step'
6+
; CHECK: LV: Did not find one integer induction var.
7+
; CHECK-NEXT: LV: Not vectorizing: Early exit is not the latch predecessor.
8+
; CHECK-NEXT: LV: Interleaving disabled by the pass manager
9+
; CHECK-NEXT: LV: Not vectorizing: Cannot prove legality.
10+
11+
; CHECK-LABEL: LV: Checking a loop in 'header_exit_cannot_compute_btc_due_to_step'
12+
; CHECK: LV: Found an induction variable.
13+
; CHECK-NEXT: LV: Did not find one integer induction var.
14+
; CHECK-NEXT: LV: Not vectorizing: Cannot determine exact exit count for latch block.
15+
; CHECK-NEXT: LV: Interleaving disabled by the pass manager
16+
; CHECK-NEXT: LV: Not vectorizing: Cannot prove legality.
17+
18+
; CHECK-NOT: vector.body
19+
define void @latch_exit_cannot_compute_btc_due_to_step(ptr %dst, i64 %step) {
20+
entry:
21+
br label %loop
22+
23+
loop: ; preds = %loop, %for.cond.us
24+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
25+
%iv.next = add i64 %iv, %step
26+
%gep = getelementptr i8, ptr %dst, i64 %iv
27+
store i8 0, ptr %gep, align 1
28+
%ec = icmp eq i64 %iv.next, 1000
29+
br i1 %ec, label %loop, label %exit
30+
31+
exit:
32+
ret void
33+
}
34+
35+
define void @header_exit_cannot_compute_btc_due_to_step(ptr %dst, i64 %step) {
36+
entry:
37+
br label %loop.header
38+
39+
loop.header:
40+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop.latch ]
41+
%iv.next = add i64 %iv, %step
42+
%ec = icmp eq i64 %iv.next, 1000
43+
br i1 %ec, label %loop.latch, label %exit
44+
45+
loop.latch:
46+
%gep = getelementptr i8, ptr %dst, i64 %iv
47+
store i8 0, ptr %gep, align 1
48+
br label %loop.header
49+
50+
exit:
51+
ret void
52+
}

0 commit comments

Comments
 (0)