Skip to content

Commit 666e431

Browse files
authored
[NFC][LV] Improve ee with sideeffects legality test (#158275)
Addressing postcommit comments for 54fc536
1 parent 3c7c892 commit 666e431

File tree

1 file changed

+41
-20
lines changed

1 file changed

+41
-20
lines changed

llvm/test/Transforms/LoopVectorize/early_exit_store_legality.ll

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -604,36 +604,57 @@ exit:
604604

605605
;; ICE was caused by assert for the load used in the uncountable exit condition
606606
;; being guaranteed to execute.
607-
@e = external addrspace(21) global [4 x i8]
608-
define void @crash_conditional_load_for_uncountable_exit() {
607+
@ee.global = external global [4 x i8]
608+
define void @crash_conditional_load_for_uncountable_exit(ptr dereferenceable(40) noalias %store.area) {
609609
; CHECK-LABEL: LV: Checking a loop in 'crash_conditional_load_for_uncountable_exit'
610610
; CHECK: LV: Not vectorizing: Load for uncountable exit not guaranteed to execute.
611611
entry:
612-
br label %cont
612+
br label %for.body
613613

614-
handler.out_of_bounds:
615-
unreachable
614+
for.body:
615+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.inc ]
616+
%ee.addr = getelementptr i8, ptr @ee.global, i64 %iv
617+
br i1 false, label %ee.block, label %invalid.block
618+
619+
ee.block:
620+
%ee.val = load i8, ptr %ee.addr, align 1
621+
store i16 0, ptr %store.area, align 2
622+
%ee.cmp = icmp eq i8 %ee.val, 0
623+
br i1 %ee.cmp, label %for.inc, label %invalid.block
616624

617-
cont:
618-
%h.06 = phi i64 [ 0, %entry ], [ %inc, %a.exit ]
619-
%arrayidx = getelementptr i8, ptr addrspace(21) @e, i64 %h.06
620-
br i1 false, label %cont1, label %handler.type_mismatch
625+
for.inc:
626+
%iv.next = add nuw nsw i64 %iv, 1
627+
%counted.cond = icmp eq i64 %iv.next, 10
628+
br i1 %counted.cond, label %invalid.block, label %for.body
621629

622-
handler.type_mismatch:
630+
invalid.block:
623631
unreachable
632+
}
633+
634+
define void @crash_conditional_load_for_uncountable_exit_argptr(ptr dereferenceable(40) noalias %store.area, ptr dereferenceable(4) %load.area, i1 %skip.cond) {
635+
; CHECK-LABEL: LV: Checking a loop in 'crash_conditional_load_for_uncountable_exit_argptr'
636+
; CHECK: LV: Not vectorizing: Loop has too many uncountable exits.
637+
entry:
638+
br label %for.body
624639

625-
cont1:
626-
%0 = load i8, ptr addrspace(21) %arrayidx, align 1
627-
store i16 0, ptr null, align 2
628-
%cmp.not.i.i = icmp eq i8 %0, 0
629-
br i1 %cmp.not.i.i, label %a.exit, label %if.then.i.i
640+
for.body:
641+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.inc ]
642+
%ee.addr = getelementptr i8, ptr %load.area, i64 %iv
643+
br i1 %skip.cond, label %ee.block, label %invalid.block
630644

631-
if.then.i.i:
632-
unreachable
645+
ee.block:
646+
%ee.val = load i8, ptr %ee.addr, align 1
647+
store i16 0, ptr %store.area, align 2
648+
%ee.cmp = icmp eq i8 %ee.val, 0
649+
br i1 %ee.cmp, label %for.inc, label %invalid.block
633650

634-
a.exit:
635-
%inc = add i64 %h.06, 1
636-
br i1 true, label %handler.out_of_bounds, label %cont
651+
for.inc:
652+
%iv.next = add nuw nsw i64 %iv, 1
653+
%counted.cond = icmp eq i64 %iv.next, 10
654+
br i1 %counted.cond, label %invalid.block, label %for.body
655+
656+
invalid.block:
657+
unreachable
637658
}
638659

639660

0 commit comments

Comments
 (0)