[PATCH] D87679: [LV] Unroll factor is expected to be > 0
Evgeniy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 03:16:38 PDT 2020
ebrevnov created this revision.
Herald added subscribers: llvm-commits, zzheng, hiraditya.
Herald added a project: LLVM.
ebrevnov requested review of this revision.
LV fails with assertion checking that UF > 0. We already set UF to 1 if it is 0 except the case when IC > MaxInterleaveCount. The fix is to set UF to 1 for that case as well.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87679
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/zero_unroll.ll
Index: llvm/test/Transforms/LoopVectorize/zero_unroll.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/LoopVectorize/zero_unroll.ll
@@ -0,0 +1,26 @@
+; RUN: opt -S -loop-vectorize -mtriple=s390x-linux-gnu -tiny-trip-count-interleave-threshold=4 -vectorizer-min-trip-count=8 < %s
+; RUN: opt -S -passes=loop-vectorize -mtriple=s390x-linux-gnu -tiny-trip-count-interleave-threshold=4 -vectorizer-min-trip-count=8 < %s
+
+; Function Attrs: nofree norecurse noreturn nounwind writeonly
+define dso_local i32 @main(i32 %arg, i8** nocapture readnone %arg1) local_unnamed_addr #0 {
+bb:
+ %0 = alloca i8, align 1
+ store i8 0, i8* %0, align 1
+ br label %bb4.i.i
+
+bb4.i.i.loopexit: ; preds = %bb5.i.i
+ br label %bb4.i.i
+
+bb4.i.i: ; preds = %bb4.i.i.loopexit, %bb
+ br label %bb5.i.i
+
+bb5.i.i: ; preds = %bb5.i.i, %bb4.i.i
+ %storemerge.i.i = phi i8 [ 0, %bb4.i.i ], [ %tmp12.i.i, %bb5.i.i ]
+ store i8 %storemerge.i.i, i8* %0, align 2
+ %tmp8.i.i = icmp ult i8 %storemerge.i.i, 8
+ %tmp12.i.i = add nuw nsw i8 %storemerge.i.i, 1
+ br i1 %tmp8.i.i, label %bb5.i.i, label %bb4.i.i.loopexit
+}
+
+attributes #0 = { nofree norecurse noreturn nounwind writeonly "target-cpu"="z13" }
+
Index: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5616,7 +5616,8 @@
// that the target and trip count allows.
if (IC > MaxInterleaveCount)
IC = MaxInterleaveCount;
- else if (IC < 1)
+
+ if (IC < 1)
IC = 1;
// Interleave if we vectorized this loop and there is a reduction that could
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87679.291847.patch
Type: text/x-patch
Size: 1853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/1e6da4c2/attachment.bin>
More information about the llvm-commits
mailing list