[SLP]Improve handling gathers/buildvectors with undefs.
authorAlexey Bataev <a.bataev@outlook.com>
Fri, 24 Feb 2023 00:58:01 +0000 (16:58 -0800)
committerAlexey Bataev <a.bataev@outlook.com>
Fri, 24 Feb 2023 21:17:40 +0000 (13:17 -0800)
commitf1c8b72c13f12b8711f652291d434f921a5c9a66
tree5f9abf593c1b3a49b09c1db62e66696b30124f59
parente0efe46b33068f2e651e850cdc3ede0306f1853c
[SLP]Improve handling gathers/buildvectors with undefs.

If have just one non-undef scalar in the buildvector/gather node, we try
to put it to be the very first element, which is profitable in most
cases. Do the preliminary estimation, if this more profitable during
graph rotation and do same for all elements, including extractelements.

Differential Revision: https://reviews.llvm.org/D144689
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/landing_pad.ll
llvm/test/Transforms/SLPVectorizer/X86/phi3.ll
llvm/test/Transforms/SLPVectorizer/X86/pr35497.ll
llvm/test/Transforms/SLPVectorizer/X86/remark_extract_broadcast.ll
llvm/test/Transforms/SLPVectorizer/X86/vectorize-pair-path.ll