diff --git a/SOURCES/0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch b/SOURCES/0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch new file mode 100644 index 0000000..a747015 --- /dev/null +++ b/SOURCES/0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch @@ -0,0 +1,46 @@ +From 69bb97a917250d0d299c4aa3d03bde9513351159 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Mon, 9 Jul 2018 10:35:30 -0700 +Subject: [PATCH] Don't run BV DAG Combine before legalization if it assumes legal types + +--- + lib/Target/PowerPC/PPCISelLowering.cpp | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp +index 4966e88..378e494 100644 +--- a/lib/Target/PowerPC/PPCISelLowering.cpp ++++ b/lib/Target/PowerPC/PPCISelLowering.cpp +@@ -11923,10 +11923,15 @@ static SDValue combineBVOfVecSExt(SDNode *N, SelectionDAG &DAG) { + auto isSExtOfVecExtract = [&](SDValue Op) -> bool { + if (!Op) + return false; +- if (Op.getOpcode() != ISD::SIGN_EXTEND) ++ if (Op.getOpcode() != ISD::SIGN_EXTEND && ++ Op.getOpcode() != ISD::SIGN_EXTEND_INREG) + return false; + ++ // A SIGN_EXTEND_INREG might be fed by an ANY_EXTEND to produce a value ++ // of the right width. + SDValue Extract = Op.getOperand(0); ++ if (Extract.getOpcode() == ISD::ANY_EXTEND) ++ Extract = Extract.getOperand(0); + if (Extract.getOpcode() != ISD::EXTRACT_VECTOR_ELT) + return false; + +@@ -12014,8 +12019,10 @@ SDValue PPCTargetLowering::DAGCombineBuildVector(SDNode *N, + return Reduced; + + // If we're building a vector out of extended elements from another vector +- // we have P9 vector integer extend instructions. +- if (Subtarget.hasP9Altivec()) { ++ // we have P9 vector integer extend instructions. The code assumes legal ++ // input types (i.e. it can't handle things like v4i16) so do not run before ++ // legalization. ++ if (Subtarget.hasP9Altivec() && !DCI.isBeforeLegalize()) { + Reduced = combineBVOfVecSExt(N, DAG); + if (Reduced) + return Reduced; +-- +1.8.3.1 + diff --git a/SOURCES/0001-Export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch b/SOURCES/0001-Export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch new file mode 100644 index 0000000..c5c6c63 --- /dev/null +++ b/SOURCES/0001-Export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch @@ -0,0 +1,39 @@ +From 4d613a84ce271c6225068bef67d727ae02b2e3b1 Mon Sep 17 00:00:00 2001 +From: Pavel Labath +Date: Wed, 14 Mar 2018 09:28:38 +0000 +Subject: [PATCH] Export LLVM_DYLIB_COMPONENTS in LLVMConfig.cmake + +Summary: +This is needed so that external projects (e.g. a standalone build of +lldb) can link to the LLVM shared library via the USE_SHARED argument of +llvm_config. Without this, llvm_config would add LLVM to the link list, +but then also add the constituent static libraries, resulting in +multiply defined symbols. + +Reviewers: beanz, mgorny + +Subscribers: llvm-commits + +Differential Revision: https://reviews.llvm.org/D44391 + +git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327484 91177308-0d34-0410-b5e6-96231b3b80d8 +--- + cmake/modules/LLVMConfig.cmake.in | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in +index fe4df52..e700186 100644 +--- a/cmake/modules/LLVMConfig.cmake.in ++++ b/cmake/modules/LLVMConfig.cmake.in +@@ -13,6 +13,8 @@ set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@) + + set(LLVM_AVAILABLE_LIBS @LLVM_AVAILABLE_LIBS@) + ++set(LLVM_DYLIB_COMPONENTS @LLVM_DYLIB_COMPONENTS@) ++ + set(LLVM_ALL_TARGETS @LLVM_ALL_TARGETS@) + + set(LLVM_TARGETS_TO_BUILD @LLVM_TARGETS_TO_BUILD@) +-- +1.8.3.1 + diff --git a/SPECS/llvm.spec b/SPECS/llvm.spec index 48cca5b..2b29f6b 100644 --- a/SPECS/llvm.spec +++ b/SPECS/llvm.spec @@ -1,6 +1,6 @@ -%global maj_ver 5 +%global maj_ver 6 %global min_ver 0 -%global patch_ver 0 +%global patch_ver 1 # Components enabled if supported by target architecture: %ifarch %ix86 x86_64 @@ -22,6 +22,8 @@ ExcludeArch: ppc s390 %{?rhel6:s390x} %endif %ifarch ppc64 ppc64le %global host_target PowerPC +# Limit build jobs on ppc64 systems to avoid running out of memory. +%global _smp_mflags -j8 %endif %ifarch %ix86 x86_64 %global host_target X86 @@ -41,27 +43,27 @@ ExcludeArch: ppc s390 %{?rhel6:s390x} Name: llvm-private Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 3%{?dist} +Release: 2%{?dist} Summary: llvm engine for Mesa Group: System Environment/Libraries License: NCSA URL: http://llvm.org -Source0: http://llvm.org/releases/%{version}/llvm-%{version}.src.tar.xz +Source0: http://llvm.org/releases/%{version}/llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz Source1: cmake-3.4.3.tar.gz -Source2: http://llvm.org/releases/%{version}/cfe-%{version}.src.tar.xz +Source2: http://llvm.org/releases/%{version}/cfe-%{version}%{?rc_ver:rc%{rc_ver}}.src.tar.xz Source100: llvm-config.h Source101: clang-config.h Patch1: 0001-Fix-CMake-include-patch.patch -Patch2: 0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch +Patch5: 0001-Export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch +Patch6: 0001-Don-t-run-BV-DAG-Combine-before-legalization-if-it-a.patch BuildRequires: cmake BuildRequires: zlib-devel %if %{with gold} BuildRequires: binutils-devel %endif -BuildRequires: libstdc++-static BuildRequires: python %description @@ -78,14 +80,15 @@ This package contains library and header files needed to build the LLVM support in Mesa. %prep -%setup -T -q -b 2 -n cfe-%{version}.src +%setup -T -q -b 2 -n cfe-%{version}%{?rc_ver:rc%{rc_ver}}.src -%setup -q -n llvm-%{version}.src +%setup -q -n llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src tar xf %{SOURCE1} %patch1 -p1 -b .fixinc -%patch2 -p1 -b .xscvdpsp +%patch5 -p1 -b .cmake-fix +%patch6 -p1 -b .p9-fix %build @@ -110,7 +113,6 @@ export PATH=$BUILD_DIR/bin:$PATH -DLLVM_VERSION_SUFFIX="-%{llvm_lib_suffix}" \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic -static-libstdc++" \ %if 0%{?__isa_bits} == 64 -DLLVM_LIBDIR_SUFFIX=64 \ %else @@ -151,23 +153,23 @@ export PATH=$BUILD_DIR/bin:$PATH -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \ -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF -make %{?_smp_mflags} VERBOSE=1 +make %{?_smp_mflags} VERBOSE=1 LLVM llvm-config FileCheck not count gtest gtest_main # Build clang separately, because we need to build with # -DBUILD_SHARED_LIBS:BOOL=ON for clang, but we don't want # this for LLVM. -cd ../../cfe-%{version}.src +cd ../../cfe-%{version}%{?rc_ver:rc%{rc_ver}}.src mkdir -p _build cd _build -%cmake .. \ +%cmake .. \ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DLLVM_CONFIG:FILEPATH=%{_builddir}/llvm-%{version}.src/_build/bin/llvm-config \ + -DLLVM_CONFIG:FILEPATH=%{_builddir}/llvm-%{version}%{?rc_ver:rc%{rc_ver}}.src/_build/bin/llvm-config \ \ -DCLANG_ENABLE_ARCMT:BOOL=ON \ -DCLANG_ENABLE_STATIC_ANALYZER:BOOL=ON \ - -DCLANG_INCLUDE_DOCS:BOOL=ON \ + -DCLANG_INCLUDE_DOCS:BOOL=OFF \ -DCLANG_INCLUDE_TESTS:BOOL=ON \ -DCLANG_PLUGIN_SUPPORT:BOOL=ON \ -DENABLE_LINKER_BUILD_ID:BOOL=ON \ @@ -186,9 +188,9 @@ make %{?_smp_mflags} # Install LLVM cd _build -make install DESTDIR=%{buildroot} +make install-LLVM install-llvm-config install-llvm-headers install-cmake-exports DESTDIR=%{buildroot} -cd ../../cfe-%{version}.src/_build +cd ../../cfe-%{version}%{?rc_ver:rc%{rc_ver}}.src/_build make install DESTDIR=%{buildroot} @@ -207,9 +209,6 @@ rm -f %{buildroot}%{_libdir}/libLLVM.so # they require the build directory to work find examples -name 'Makefile' | xargs -0r rm -f -# Rename tools needed by rust. -for t in mc ar as; do mv -v %{buildroot}/%{_bindir}/llvm-$t %{buildroot}/%{_bindir}/llvm-private-$t-%{__isa_bits}; done; - # RHEL: strip out most binaries, most libs, and man pages ls %{buildroot}%{_bindir}/* | grep -v bin/llvm-private | xargs rm -f ls %{buildroot}%{_libdir}/* | grep -v libLLVM | grep -v libclang | xargs rm -f @@ -217,19 +216,14 @@ rm -rf %{buildroot}%{_mandir}/man1 # RHEL: Strip out some headers Mesa doesn't need rm -rf %{buildroot}%{_includedir}/llvm-private/llvm/{Assembly} -rm -rf %{buildroot}%{_includedir}/llvm-private/llvm/Option rm -rf %{buildroot}%{_includedir}/llvm-private/llvm/TableGen rm -rf %{buildroot}%{_includedir}/llvm-c/lto.h # RHEL: Strip out cmake build foo rm -rf %{buildroot}%{_datadir}/llvm/cmake +rm -rf %{buildroot}%{_libdir}/cmake/llvm/LLVMExports-* rm -rf %{buildroot}%{_libdir}/cmake/clang -# RHEL: bcc uses find_package(LLVM) in its cmake file, which requires -# LLVMConfig.cmake to be installed. -find %{buildroot}%{_libdir}/cmake/llvm/ ! -name 'LLVMConfig.cmake' -type f -exec rm -rf {} + - - # RHEL: Strip out eveything in _datadir and _libexedir rm -rf %{buildroot}%{_datadir}/* rm -rf %{buildroot}%{_libexecdir}/* @@ -244,13 +238,10 @@ for f in `find %{buildroot}%{_libdir} -iname 'libclang*' `; do mv $f %{buildroot %check cd _build -# 3.8.1 note: skx failures are XFAIL. the skylake backport does not wire -# up AVX512 for skylake, but the tests are from code that expects that. -# safe to ignore. -make check-all || : +make %{?_smp_mflags} check-all || : -cd ../../cfe-%{version}.src/_build -make check-all || : +cd ../../cfe-%{version}%{?rc_ver:rc%{rc_ver}}.src/_build +make %{?_smp_mflags} check-all %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -264,12 +255,31 @@ make check-all || : %{_bindir}/llvm-private* %{_includedir}/llvm-private/llvm %{_includedir}/llvm-private/llvm-c -%{_libdir}/cmake/llvm/LLVMConfig.cmake +%{_libdir}/cmake/llvm/ %{_includedir}/llvm-private/clang %{_includedir}/llvm-private/clang-c %{_libdir}/clang/%{version}/include %changelog +* Thu Jul 19 2018 Tom Stellard - 6.0.1-2 +- Fix crash on power9 +- Resolves: rhbz#1595996 + +* Mon Jul 09 2018 Tom Stellard - 6.0.1-1 +- 6.0.1 Release + +* Thu Jun 07 2018 Tom Stellard - 6.0.1-0.4.rc2 +- 6.0.1-rc2 Release + +* Wed Jun 06 2018 Tom Stellard - 6.0.1-0.3.rc1 +- Fixup cmake files so bcc can use them + +* Thu May 31 2018 Tom Stellard - 6.0.1-0.2.rc1 +- Keep cmake files in package, because bcc needs them + +* Wed Apr 04 2018 Tom Stellard - 6.0.1-0.1.rc1 +- Rebase to LLVM 6.0.1-rc1 + * Thu Dec 14 2017 Tom Stellard - 5.0.0-3 - Backport r312612 from upstream llvm: [PowerPC] Don't use xscvdpspn on the P7