Skip to content

Commit 936c9bb

Browse files
committed
Add test for chained condition load with gather
1 parent e33de7d commit 936c9bb

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

llvm/test/Transforms/LoopVectorize/early_exit_store_legality.ll

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,5 +351,33 @@ exit:
351351
ret void
352352
}
353353

354+
define void @loop_contains_store_condition_load_is_chained(ptr dereferenceable(40) noalias %array, ptr align 8 dereferenceable(160) readonly %offsets, ptr align 2 dereferenceable(40) readonly %pred) {
355+
; CHECK-LABEL: LV: Checking a loop in 'loop_contains_store_condition_load_is_chained'
356+
; CHECK: LV: Not vectorizing: Writes to memory unsupported in early exit loops.
357+
entry:
358+
br label %for.body
359+
360+
for.body:
361+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.inc ]
362+
%st.addr = getelementptr inbounds nuw i16, ptr %array, i64 %iv
363+
%data = load i16, ptr %st.addr, align 2
364+
%inc = add nsw i16 %data, 1
365+
store i16 %inc, ptr %st.addr, align 2
366+
%gather.addr = getelementptr inbounds nuw i64, ptr %offsets, i64 %iv
367+
%ee.offset = load i64, ptr %gather.addr, align 8
368+
%ee.addr = getelementptr inbounds nuw i16, ptr %pred, i64 %ee.offset
369+
%ee.val = load i16, ptr %ee.addr, align 2
370+
%ee.cond = icmp sgt i16 %ee.val, 500
371+
br i1 %ee.cond, label %exit, label %for.inc
372+
373+
for.inc:
374+
%iv.next = add nuw nsw i64 %iv, 1
375+
%counted.cond = icmp eq i64 %iv.next, 20
376+
br i1 %counted.cond, label %exit, label %for.body
377+
378+
exit:
379+
ret void
380+
}
381+
354382
declare void @init_mem(ptr, i64);
355383
declare i64 @get_an_unknown_offset();

0 commit comments

Comments
 (0)