[LV] Strip wrap flags from vectorized reductions
authorAyal Zaks <ayal.zaks@intel.com>
Thu, 19 Dec 2019 22:04:49 +0000 (00:04 +0200)
committerAyal Zaks <ayal.zaks@intel.com>
Fri, 20 Dec 2019 12:48:53 +0000 (14:48 +0200)
commite498be573871c94119033dd151773a55ceb0beb7
treedc05439e1f87d0ec8452a74d77fb26b4b77b2747
parent04329dbfa6c219997ab72567842d81778f9f7f47
[LV] Strip wrap flags from vectorized reductions

A sequence of additions or multiplications that is known not to wrap, may wrap
if it's order is changed (i.e., reassociated). Therefore when vectorizing
integer sum or product reductions, their no-wrap flags need to be removed.

Fixes PR43828

Patch by Denis Antrushin

Differential Revision: https://reviews.llvm.org/D69563
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/AArch64/arbitrary-induction-step.ll
llvm/test/Transforms/LoopVectorize/X86/tail_loop_folding.ll
llvm/test/Transforms/LoopVectorize/if-pred-stores.ll
llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
llvm/test/Transforms/LoopVectorize/no_int_induction.ll
llvm/test/Transforms/LoopVectorize/nuw.ll [new file with mode: 0644]
llvm/test/Transforms/LoopVectorize/reduction-small-size.ll
llvm/test/Transforms/LoopVectorize/reduction.ll