[SLP]Improve isGatherShuffledEntry by looking deeper through the reused scalars.
authorAlexey Bataev <a.bataev@outlook.com>
Tue, 10 Jan 2023 21:49:05 +0000 (13:49 -0800)
committerAlexey Bataev <a.bataev@outlook.com>
Thu, 19 Jan 2023 21:46:25 +0000 (13:46 -0800)
commit9bdcf8778a5c6f57e6d05308e9dde655bba97698
tree7422d3fd1887b631431798dadff79cc9b45ccdf6
parent9fecd58e5e2ead68f09677db912a29585810eb81
[SLP]Improve isGatherShuffledEntry by looking deeper through the reused scalars.

The compiler may produce better results if it does not look for
constants, uses an extra analysis of phi nodes, looks through all tree
nodes without skipping the cases, where the very first set of nodes is
empty. Also, it tries to reshufle the nodes if it is profitable for
sure, i.e. at least 2 scalars are used for single node permutation and at
least 3 scalars are used for the permutation of 2 nodes.

Part of D110978

Differential Revision: https://reviews.llvm.org/D141512
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/AArch64/horizontal.ll
llvm/test/Transforms/SLPVectorizer/X86/PR39774.ll
llvm/test/Transforms/SLPVectorizer/X86/crash_netbsd_decompress.ll