git: 8c5c5a01e50d - main - devel/llvm11: fix hangs with CPUTYPE=skylake-avx512

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Tue, 05 Jul 2022 12:35:24 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8c5c5a01e50d37cbcc50c0499fee610f55570c99

commit 8c5c5a01e50d37cbcc50c0499fee610f55570c99
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2022-07-05 12:32:58 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2022-07-05 12:32:58 +0000

    devel/llvm11: fix 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:             264480
    MFH:            2022Q3
    Sponsored by:   DARPA, AFRL
---
 devel/llvm11/Makefile                                     | 10 +++++-----
 .../llvm11/files/patch-lib_Target_X86_X86ISelLowering.cpp | 15 +++++++++++++++
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/devel/llvm11/Makefile b/devel/llvm11/Makefile
index e8f66d19c899..f0c2973f0dc0 100644
--- a/devel/llvm11/Makefile
+++ b/devel/llvm11/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	llvm
 DISTVERSION=	11.0.1
-PORTREVISION=	6
+PORTREVISION=	7
 CATEGORIES=	devel lang
 MASTER_SITES=	https://github.com/llvm/llvm-project/releases/download/llvmorg-${DISTVERSION:S/rc/-rc/}/ \
 		https://${PRE_}releases.llvm.org/${LLVM_RELEASE}/${RCDIR}
@@ -31,7 +31,7 @@ DATADIR=	${PREFIX}/share/${PORTNAME}${LLVM_SUFFIX}
 
 USES=		cmake compiler:c++11-lib cpe libedit perl5 tar:xz \
 		shebangfix
-_USES_PYTHON?=	python:3.6+,build
+_USES_PYTHON?=	python:build
 USES+=		${_USES_PYTHON}
 USE_LDCONFIG=	${LLVM_PREFIX}/lib
 SHEBANG_FILES=	utils/lit/lit.py utils/llvm-lit/llvm-lit.in \
@@ -129,7 +129,7 @@ GOLD_DESC=		Build the LLVM Gold plugin for LTO
 GOLD_CMAKE_ON=		-DLLVM_BINUTILS_INCDIR=${LOCALBASE}/include
 GOLD_BUILD_DEPENDS=	${LOCALBASE}/bin/ld.gold:devel/binutils
 LIT_DESC=		Install lit and FileCheck test tools
-LIT_VARS=		_USES_PYTHON=python:3.6+
+LIT_VARS=		_USES_PYTHON=python
 LLD_DESC=		Install lld, the LLVM linker
 LLD_DISTFILES=		lld-${DISTVERSION}.src${EXTRACT_SUFX}
 LLDB_BUILD_DEPENDS=	swig:devel/swig
@@ -145,12 +145,12 @@ LLDB_DISTFILES=		lldb-${DISTVERSION}.src${EXTRACT_SUFX}
 LLDB_EXTRA_PATCHES=	${PATCHDIR}/lldb
 LLDB_IMPLIES=		CLANG
 LLDB_PORTDOCS=		lldb
-LLDB_VARS=		_USES_PYTHON=python:3.6+
+LLDB_VARS=		_USES_PYTHON=python
 OPENMP_DESC=		Install libomp, the LLVM OpenMP runtime library
 OPENMP_DISTFILES=	openmp-${DISTVERSION}.src${EXTRACT_SUFX}
 PYCLANG_DESC=		Install python bindings to libclang
 PYCLANG_IMPLIES=	CLANG
-PYCLANG_VARS=		_USES_PYTHON=python:3.6+
+PYCLANG_VARS=		_USES_PYTHON=python
 PYCLANG_CMAKE_ON=	-DCLANG_PYTHON_BINDINGS_VERSIONS=${PYTHON_VER}
 
 .if defined(WITH_DEBUG)
diff --git a/devel/llvm11/files/patch-lib_Target_X86_X86ISelLowering.cpp b/devel/llvm11/files/patch-lib_Target_X86_X86ISelLowering.cpp
new file mode 100644
index 000000000000..ad1254577241
--- /dev/null
+++ b/devel/llvm11/files/patch-lib_Target_X86_X86ISelLowering.cpp
@@ -0,0 +1,15 @@
+--- lib/Target/X86/X86ISelLowering.cpp.orig
++++ lib/Target/X86/X86ISelLowering.cpp
+@@ -36201,7 +36201,11 @@
+          (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);