[llvm] [VectorCombine] Fold ZExt/SExt (Shuffle (ZExt/SExt %src)) to ZExt/SExt (Shuffle %src). (PR #141109)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 08:20:27 PDT 2025


================
@@ -2791,6 +2792,60 @@ bool VectorCombine::foldShuffleToIdentity(Instruction &I) {
   return true;
 }
 
+bool VectorCombine::foldShuffleExt(Instruction &I) {
+  // Try to fold vector zero- and sign-extends split across multiple operations
+  // into a single extend.
+
+  // Check if we have ZEXT/SEXT (SHUFFLE (ZEXT/SEXT %src), _, identity-mask),
----------------
preames wrote:

Code structure wise, I think you're rooting this from the wrong node.  I think this should start from the outer extend, and then match the whole pattern.  

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


More information about the llvm-commits mailing list