[llvm] d14c8f0 - [X86] getFauxShuffleMask - don't allow undefs in constant for AND/ANDNP shuffle masks

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 28 04:33:23 PST 2024


Author: Simon Pilgrim
Date: 2024-01-28T11:33:21Z
New Revision: d14c8f06ea1dceba1ec6c0823e55e3a142a48f46

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

LOG: [X86] getFauxShuffleMask - don't allow undefs in constant for AND/ANDNP shuffle masks

Early out from getTargetConstantBitsFromNode call instead of just returning if an undef was found.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 27b6cf35ea7686..e1a4a7fb5d15ef 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -5719,12 +5719,13 @@ static bool getFauxShuffleMask(SDValue N, const APInt &DemandedElts,
     SDValue N1 = N.getOperand(1);
     bool IsAndN = (X86ISD::ANDNP == Opcode);
     uint64_t ZeroMask = IsAndN ? 255 : 0;
-    if (!getTargetConstantBitsFromNode(IsAndN ? N0 : N1, 8, UndefElts, EltBits))
+    if (!getTargetConstantBitsFromNode(IsAndN ? N0 : N1, 8, UndefElts, EltBits,
+                                       /*AllowWholeUndefs*/ false,
+                                       /*AllowPartialUndefs*/ false))
       return false;
     // We can't assume an undef src element gives an undef dst - the other src
     // might be zero.
-    if (!UndefElts.isZero())
-      return false;
+    assert(UndefElts.isZero() && "Expected UNDEF element in AND/ANDNP mask");
     for (int i = 0, e = (int)EltBits.size(); i != e; ++i) {
       const APInt &ByteBits = EltBits[i];
       if (ByteBits != 0 && ByteBits != 255)


        


More information about the llvm-commits mailing list