[llvm] [InstCombine] Fold shuffled intrinsic operands with constant operands (PR #141300)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue May 27 05:52:32 PDT 2025


================
@@ -1430,14 +1431,21 @@ foldShuffledIntrinsicOperands(IntrinsicInst *II,
 
   // See if all arguments are shuffled with the same mask.
   SmallVector<Value *, 4> NewArgs(II->arg_size());
-  NewArgs[0] = X;
   Type *SrcTy = X->getType();
-  for (unsigned i = 1, e = II->arg_size(); i != e; ++i) {
-    if (!match(II->getArgOperand(i),
-               m_Shuffle(m_Value(X), m_Undef(), m_SpecificMask(Mask))) ||
-        X->getType() != SrcTy)
+  for (unsigned i = 0, e = II->arg_size(); i != e; ++i) {
----------------
nikic wrote:

Could use args() here (and push_back).

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


More information about the llvm-commits mailing list