[SLP]Improve bottom-to-top reordering.
authorAlexey Bataev <a.bataev@outlook.com>
Tue, 22 Feb 2022 21:50:17 +0000 (13:50 -0800)
committerAlexey Bataev <a.bataev@outlook.com>
Mon, 28 Feb 2022 14:48:46 +0000 (06:48 -0800)
commite4b9640867150723b33f81c6479682fc955b55aa
treec2bee6a1c5b69971f43eea848d7b842253cdbb3b
parenta64d3c602fb7e533855a64cb4d9fec77ea0a079e
[SLP]Improve bottom-to-top reordering.

Currently bottom-to-top reordering analysis counts orders of the
operands and then adds natural order counts for the operand users. It is
very conservative, this the user nodes themselves may require
reordering. Patch improves bottom-to-top analysis by checking for the
user nodes if they require/allows the reordring. If the user node must
be reordered, has reused scalars, is an alternate op vectorization node,
is a non-ordered gather node or may allow reordering because of the
reordered operands, such node is considered as the node that allows
reodring and is not counted as a node with the natural order.

Differential Revision: https://reviews.llvm.org/D120492
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
llvm/test/Transforms/SLPVectorizer/X86/bottom-to-top-reorder.ll
llvm/test/Transforms/SLPVectorizer/X86/reordered-top-scalars.ll