[InstCombine] Bubble vector.reverse of select 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)
commit87c494b8975332123fb6321a2ab7bf490dc7d29c
tree23bfd14915adb980d98209b082254d7e01e5885e
parent362c52ad5a90d4f1c2fb01f3f5989ca4dc13855f
[InstCombine] Bubble vector.reverse of select 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/D139339
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/vector-reverse.ll