[llvm] VectorCombine: Fold chains of shuffles fed by length-changing shuffles (PR #168819)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 7 11:26:22 PST 2025


================
@@ -2877,6 +2878,174 @@ bool VectorCombine::foldShuffleOfShuffles(Instruction &I) {
   return true;
 }
 
+/// Try to convert a chain of length-preserving shuffles that are fed by
+/// length-changing shuffles from the same source, e.g. a chain of length 3:
+///
+///   "shuffle (shuffle (shuffle x, (shuffle y, undef)),
+///                                 (shuffle y, undef)),
+//                                  (shuffle y, undef)"
+///
+/// into a single shuffle fed by a length-changing shuffle:
+///
+///   "shuffle x, (shuffle y, undef)"
+///
+/// Such chains arise e.g. from folding extract/insert sequences.
+bool VectorCombine::foldShufflesOfLengthChangingShuffles(Instruction &I) {
----------------
arsenm wrote:

This is a really long function for only one changed test function? 

https://github.com/llvm/llvm-project/pull/168819


More information about the llvm-commits mailing list