[llvm] ddd1153 - [InstCombine] Match poison instead of undef in binop of same-mask shuffle fold

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 07:49:30 PST 2023


Author: Nikita Popov
Date: 2023-12-18T16:41:38+01:00
New Revision: ddd11537e2af5596e8a1d213ed6f939a3ecfc72b

URL: https://github.com/llvm/llvm-project/commit/ddd11537e2af5596e8a1d213ed6f939a3ecfc72b
DIFF: https://github.com/llvm/llvm-project/commit/ddd11537e2af5596e8a1d213ed6f939a3ecfc72b.diff

LOG: [InstCombine] Match poison instead of undef in binop of same-mask shuffle fold

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 94f60719b78ca3..20ce5e0ede9e5f 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1728,8 +1728,8 @@ Instruction *InstCombinerImpl::foldVectorBinop(BinaryOperator &Inst) {
 
   // If both arguments of the binary operation are shuffles that use the same
   // mask and shuffle within a single vector, move the shuffle after the binop.
-  if (match(LHS, m_Shuffle(m_Value(V1), m_Undef(), m_Mask(Mask))) &&
-      match(RHS, m_Shuffle(m_Value(V2), m_Undef(), m_SpecificMask(Mask))) &&
+  if (match(LHS, m_Shuffle(m_Value(V1), m_Poison(), m_Mask(Mask))) &&
+      match(RHS, m_Shuffle(m_Value(V2), m_Poison(), m_SpecificMask(Mask))) &&
       V1->getType() == V2->getType() &&
       (LHS->hasOneUse() || RHS->hasOneUse() || LHS == RHS)) {
     // Op(shuffle(V1, Mask), shuffle(V2, Mask)) -> shuffle(Op(V1, V2), Mask)


        


More information about the llvm-commits mailing list