[llvm] [VectorCombine] Fold permute of intrinsics into intrinsic of permutes: shuffle(intrinsic, poison/undef) -> intrinsic(shuffle) (PR #170052)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 01:53:49 PST 2025


================
@@ -2960,6 +2961,93 @@ bool VectorCombine::foldShuffleOfIntrinsics(Instruction &I) {
   return true;
 }
 
+/// Try to convert
+/// "shuffle (intrinsic), (poison/undef)" into "intrinsic (shuffle)".
+bool VectorCombine::foldPermuteOfIntrinsic(Instruction &I) {
+  Value *V0, *V1;
+  ArrayRef<int> Mask;
+  if (!match(&I, m_Shuffle(m_OneUse(m_Value(V0)), m_Value(V1), m_Mask(Mask))))
----------------
RKSimon wrote:

Any reason we can't just merge this with foldShuffleOfIntrinsics?

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


More information about the llvm-commits mailing list