[clang] [llvm] [InstCombine] Canonicalise Zero Vector operand to always be RHS of a shuffle vector (PR #237258)

Kieran B via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 9 02:14:04 PST 2026


================
@@ -3068,6 +3070,13 @@ Instruction *InstCombinerImpl::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
     return &SVI;
   }
 
+  // shuffle ZeroVec, x, mask --> shuffle x, ZeroVec, mask'
+  if (match(LHS, m_CombineOr(m_Zero(), m_AnyZeroFP())) &&
+      !match(RHS, m_CombineOr(m_Zero(), m_AnyZeroFP()))) {
----------------
kieroxide wrote:

Done

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


More information about the cfe-commits mailing list