git: e5896578b222 - stable/12 - Apply llvm fix for possible hangs with CPUTYPE=skylake-avx512

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 04 Jun 2022 11:44:54 UTC
The branch stable/12 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=e5896578b22271be25f18996033a176fc6cdfe19

commit e5896578b22271be25f18996033a176fc6cdfe19
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-06-01 21:43:18 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-06-04 11:44:33 +0000

    Apply llvm fix for possible hangs with CPUTYPE=skylake-avx512
    
    Merge commit e8305c0b8f49 from llvm git (by Simon Pilgrim)
    
        [X86] combineX86ShuffleChain - don't fold to truncate(concat(V1,V2)) if it was already a PACK op
    
        Fixes #55050
    
    PR:             264394
    Reported by:    VVD <vvd@unislabs.com>
    MFC after:      3 days
    
    (cherry picked from commit 592e876a422960a78938caa714f2263ff38eb87b)
---
 contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
index 032db2a80a77..a9a3343abc4d 100644
--- a/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -36195,7 +36195,11 @@ static SDValue combineX86ShuffleChain(ArrayRef<SDValue> Inputs, SDValue Root,
          (RootVT.is128BitVector() && Subtarget.hasVLX())) &&
         (MaskEltSizeInBits > 8 || Subtarget.hasBWI()) &&
         isSequentialOrUndefInRange(Mask, 0, NumMaskElts, 0, 2)) {
-      if (Depth == 0 && Root.getOpcode() == ISD::TRUNCATE)
+      // Bail if this was already a truncation or PACK node.
+      // We sometimes fail to match PACK if we demand known undef elements.
+      if (Depth == 0 && (Root.getOpcode() == ISD::TRUNCATE ||
+                         Root.getOpcode() == X86ISD::PACKSS ||
+                         Root.getOpcode() == X86ISD::PACKUS))
         return SDValue(); // Nothing to do!
       ShuffleSrcVT = MVT::getIntegerVT(MaskEltSizeInBits * 2);
       ShuffleSrcVT = MVT::getVectorVT(ShuffleSrcVT, NumMaskElts / 2);