LoadStoreVectorizer: support different operand orders in the add sequence match
authorSlava Nikolaev <vnikolaev@apple.com>
Thu, 10 Jun 2021 23:01:01 +0000 (16:01 -0700)
committerVolkan Keles <vkeles@apple.com>
Thu, 10 Jun 2021 23:31:35 +0000 (16:31 -0700)
commit119965865cc730060e4cc95690ee7dab91c2c440
tree86c7c7f4b7e38526f28cd867b780a80d9e3a3f06
parentb73742bc8d2ec53f0892f1609837c088f9cfcf64
LoadStoreVectorizer: support different operand orders in the add sequence match

First we refactor the code which does no wrapping add sequences
match: we need to allow different operand orders for
the key add instructions involved in the match.

Then we use the refactored code trying 4 variants of matching operands.

Originally the code relied on the fact that the matching operands
of the two last add instructions of memory index calculations
had the same LHS argument. But which operand is the same
in the two instructions is actually not essential, so now we allow
that to be any of LHS or RHS of each of the two instructions.
This increases the chances of vectorization to happen.

Reviewed By: volkan

Differential Revision: https://reviews.llvm.org/D103912
llvm/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
llvm/test/Transforms/LoadStoreVectorizer/X86/vectorize-i8-nested-add.ll