[PATCH] D69563: [LV] Strip wrap flags from vectorized reductions
Denis Antrushin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 06:52:56 PDT 2019
dantrushin created this revision.
dantrushin added reviewers: fhahn, hsaito, hfinkel.
Herald added subscribers: jfb, rkruppe, hiraditya.
Herald added a project: LLVM.
Wrap flags set on scalar reductions may become invalid after vectorization
After vectorization with interleaving, vectorized reduction might look
like this:
%vec.phi = phi <4 x i32> [ <i32 -104, i32 0, i32 0, i32 0>, %vector.ph ], [ %2, %vector.body ]
%vec.phi2 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %3, %vector.body ]
%2 = sub nuw nsw <4 x i32> %vec.phi, %broadcast.splat
%3 = sub nuw nsw <4 x i32> %vec.phi2, %broadcast.splat
Note that nowrap flags are invalid (0 - x wraps) and must be reset even
though they were correct in scalar case. Otherwise, InstSimplify will
throw (0-X)<nsw> out as a no-op
Fixes PR43828
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D69563
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/X86/tail_loop_folding.ll
llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
llvm/test/Transforms/LoopVectorize/no_int_induction.ll
llvm/test/Transforms/LoopVectorize/nuw.ll
llvm/test/Transforms/LoopVectorize/reduction-small-size.ll
llvm/test/Transforms/LoopVectorize/reduction.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69563.226892.patch
Type: text/x-patch
Size: 6894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191029/74967ca1/attachment-0001.bin>
More information about the llvm-commits
mailing list