[llvm] [VectorCombine] foldShuffleOfShuffles - fold "shuffle (shuffle x, undef), (shuffle y, undef)" -> "shuffle x, y" (PR #88743)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 07:27:29 PDT 2024
================
@@ -1547,6 +1548,73 @@ bool VectorCombine::foldShuffleOfCastops(Instruction &I) {
return true;
}
+/// Try to convert "shuffle (shuffle x, undef), (shuffle y, undef)"
+/// into "shuffle x, y".
+bool VectorCombine::foldShuffleOfShuffles(Instruction &I) {
+ Value *V0, *V1;
+ ArrayRef<int> OuterMask, InnerMask0, InnerMask1;
+ if (!match(&I, m_Shuffle(m_OneUse(m_Shuffle(m_Value(V0), m_Undef(),
+ m_Mask(InnerMask0))),
+ m_OneUse(m_Shuffle(m_Value(V1), m_Undef(),
+ m_Mask(InnerMask1))),
----------------
alexey-bataev wrote:
What if the element is selected from the undef vector? Should be cheking for m_POison instead or check that value do not generate poisons?
https://github.com/llvm/llvm-project/pull/88743
More information about the llvm-commits
mailing list