[VectorUtils] Add getShuffleDemandedElts helper
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 30 Oct 2022 17:03:49 +0000 (17:03 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 30 Oct 2022 17:03:55 +0000 (17:03 +0000)
commit55a11b542e055744cac3beb87714fc90cacba4c0
tree39f6559736107f5311480d8f854185ca0df4d7b3
parenta6935cfed89edb1e10cd20ae0062362b6bdbbda0
[VectorUtils] Add getShuffleDemandedElts helper

We have similar code to translate a demanded elements mask for a shuffle's operands in multiple places - this patch adds a helper function to VectorUtils and updates a number of locations to use it directly.

Differential Revision: https://reviews.llvm.org/D136832
llvm/include/llvm/Analysis/VectorUtils.h
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/Analysis/VectorUtils.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/unittests/Analysis/VectorUtilsTest.cpp