LoadStoreVectorizer: Match nested adds to prove vectorization is safe
authorVolkan Keles <vkeles@apple.com>
Mon, 18 May 2020 19:11:46 +0000 (12:11 -0700)
committerVolkan Keles <vkeles@apple.com>
Mon, 18 May 2020 19:13:01 +0000 (12:13 -0700)
commit63081dc6f642a6be61b3ef213f5c6e257f35671c
treef11a918f68d9727613f6cc9d0d3f0b26ca336f75
parent736db2f710367946452f3f705010ada4227352b0
LoadStoreVectorizer: Match nested adds to prove vectorization is safe

If both OpA and OpB is an add with NSW/NUW and with the same LHS operand,
we can guarantee that the transformation is safe if we can prove that OpA
won't overflow when IdxDiff added to the RHS of OpA.

Review: https://reviews.llvm.org/D79817
llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
llvm/test/Transforms/LoadStoreVectorizer/X86/vectorize-i8-nested-add.ll [new file with mode: 0644]