[InstCombine] Bubble vector.reverse of compare operands to their result.
authorPaul Walker <paul.walker@arm.com>
Mon, 17 Oct 2022 13:45:09 +0000 (14:45 +0100)
committerPaul Walker <paul.walker@arm.com>
Wed, 21 Dec 2022 15:53:14 +0000 (15:53 +0000)
commit362c52ad5a90d4f1c2fb01f3f5989ca4dc13855f
treecc13052b98b2ef15ff533403b3c615219827b36b
parentd8fb46ee5555e73ab7a835b0098d0d7ee371c18b
[InstCombine] Bubble vector.reverse of compare operands to their result.

This mirrors a similar shufflevector transformation so the same
effect is obtained for scalable vectors. The transformation is
only performed when it can be proven the number of resulting
reversals is not increased. By bubbling the reversals from operand
to result this should typically be the case and ideally leads to
back-back shuffles that can be elimitated entirely.

Differential Revision: https://reviews.llvm.org/D139340
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/vector-reverse.ll
llvm/test/Transforms/LoopVectorize/AArch64/sve-vector-reverse-mask4.ll