Skip to content

Commit 4b8fb71

Browse files
fhahnBStott6
authored andcommitted
[LV] Precommit additional early-exit tests from llvm#174864.
Pre-commit tests from llvm#174864.
1 parent 9e1d1b3 commit 4b8fb71

File tree

4 files changed

+444
-88
lines changed

4 files changed

+444
-88
lines changed

llvm/test/Transforms/LoopVectorize/early_exit_legality.ll

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,45 @@ loop.end:
593593
}
594594

595595

596+
; Two early exits on parallel branches (neither dominates the other).
597+
define i64 @uncountable_exits_on_parallel_branches() {
598+
; CHECK-LABEL: LV: Checking a loop in 'uncountable_exits_on_parallel_branches'
599+
; CHECK: LV: Not vectorizing: Loop has too many uncountable exits.
600+
entry:
601+
%p1 = alloca [1024 x i8]
602+
%p2 = alloca [1024 x i8]
603+
call void @init_mem(ptr %p1, i64 1024)
604+
call void @init_mem(ptr %p2, i64 1024)
605+
br label %header
606+
607+
header:
608+
%index = phi i64 [ %index.next, %latch ], [ 3, %entry ]
609+
%arrayidx = getelementptr inbounds i8, ptr %p1, i64 %index
610+
%ld1 = load i8, ptr %arrayidx, align 1
611+
%branch.cond = icmp sgt i8 %ld1, 0
612+
br i1 %branch.cond, label %left, label %right
613+
614+
left:
615+
%arrayidx.left = getelementptr inbounds i8, ptr %p2, i64 %index
616+
%ld.left = load i8, ptr %arrayidx.left, align 1
617+
%cmp.left = icmp eq i8 %ld1, %ld.left
618+
br i1 %cmp.left, label %loop.end, label %latch
619+
620+
right:
621+
%cmp.right = icmp ult i8 %ld1, 34
622+
br i1 %cmp.right, label %loop.end, label %latch
623+
624+
latch:
625+
%index.next = add i64 %index, 1
626+
%exitcond = icmp ne i64 %index.next, 67
627+
br i1 %exitcond, label %header, label %loop.end
628+
629+
loop.end:
630+
%retval = phi i64 [ %index, %left ], [ 100, %right ], [ 43, %latch ]
631+
ret i64 %retval
632+
}
633+
634+
596635
declare i32 @foo(i32) readonly
597636
declare <vscale x 4 x i32> @foo_vec(<vscale x 4 x i32>)
598637

0 commit comments

Comments
 (0)