diff --git a/.gitignore b/.gitignore index ae1a032..51419b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/cfe-5.0.0.src.tar.xz +SOURCES/cfe-6.0.1.src.tar.xz SOURCES/cmake-3.4.3.tar.gz -SOURCES/llvm-5.0.0.src.tar.xz +SOURCES/llvm-6.0.1.src.tar.xz diff --git a/.llvm-private.metadata b/.llvm-private.metadata index 28739ee..5b5adb7 100644 --- a/.llvm-private.metadata +++ b/.llvm-private.metadata @@ -1,3 +1,3 @@ -8c67071be174c66264b6c7629c291c0e30ecbdc5 SOURCES/cfe-5.0.0.src.tar.xz +d93d8f3e3d7eb549ac58507383f7fcbdd78804d7 SOURCES/cfe-6.0.1.src.tar.xz 49e4f05d46d4752e514b19ba36bf97d20a7da66a SOURCES/cmake-3.4.3.tar.gz -7b0fd212ecc38461e392cbdcbe6a1d4944138a04 SOURCES/llvm-5.0.0.src.tar.xz +09a6316c5225cab255ba12391e7abe5ff4d28935 SOURCES/llvm-6.0.1.src.tar.xz 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/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch b/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch deleted file mode 100644 index 2fae157..0000000 --- a/SOURCES/0001-PowerPC-Don-t-use-xscvdpspn-on-the-P7.patch +++ /dev/null @@ -1,79 +0,0 @@ -From a481ab548d038c1dfd52ee211b997e2dd33ff5ae Mon Sep 17 00:00:00 2001 -From: Hal Finkel -Date: Wed, 6 Sep 2017 03:08:26 +0000 -Subject: [PATCH] [PowerPC] Don't use xscvdpspn on the P7 - -xscvdpspn was not introduced until the P8, so don't use it on the P7. Fixes a -regression introduced in r288152. - -git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312612 91177308-0d34-0410-b5e6-96231b3b80d8 ---- - lib/Target/PowerPC/PPCISelLowering.cpp | 9 ++++++--- - test/CodeGen/PowerPC/fp-splat.ll | 27 +++++++++++++++++++++++++++ - 2 files changed, 33 insertions(+), 3 deletions(-) - create mode 100644 test/CodeGen/PowerPC/fp-splat.ll - -diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp -index 74dedaf..6295693 100644 ---- a/lib/Target/PowerPC/PPCISelLowering.cpp -+++ b/lib/Target/PowerPC/PPCISelLowering.cpp -@@ -7463,9 +7463,11 @@ static SDValue BuildVSLDOI(SDValue LHS, SDValue RHS, unsigned Amt, EVT VT, - /// - The node is a "load-and-splat" - /// In all other cases, we will choose to keep the BUILD_VECTOR. - static bool haveEfficientBuildVectorPattern(BuildVectorSDNode *V, -- bool HasDirectMove) { -+ bool HasDirectMove, -+ bool HasP8Vector) { - EVT VecVT = V->getValueType(0); -- bool RightType = VecVT == MVT::v2f64 || VecVT == MVT::v4f32 || -+ bool RightType = VecVT == MVT::v2f64 || -+ (HasP8Vector && VecVT == MVT::v4f32) || - (HasDirectMove && (VecVT == MVT::v2i64 || VecVT == MVT::v4i32)); - if (!RightType) - return false; -@@ -7627,7 +7629,8 @@ SDValue PPCTargetLowering::LowerBUILD_VECTOR(SDValue Op, - // lowered to VSX instructions under certain conditions. - // Without VSX, there is no pattern more efficient than expanding the node. - if (Subtarget.hasVSX() && -- haveEfficientBuildVectorPattern(BVN, Subtarget.hasDirectMove())) -+ haveEfficientBuildVectorPattern(BVN, Subtarget.hasDirectMove(), -+ Subtarget.hasP8Vector())) - return Op; - return SDValue(); - } -diff --git a/test/CodeGen/PowerPC/fp-splat.ll b/test/CodeGen/PowerPC/fp-splat.ll -new file mode 100644 -index 0000000..9b1ab21 ---- /dev/null -+++ b/test/CodeGen/PowerPC/fp-splat.ll -@@ -0,0 +1,27 @@ -+; RUN: llc -mcpu=pwr8 -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-P8 -check-prefix=CHECK -+; RUN: llc -mcpu=pwr7 -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-P7 -check-prefix=CHECK -+ -+define <4 x float> @test1(float %a) { -+entry: -+; CHECK-LABEL: test1 -+ %vecins = insertelement <4 x float> undef, float %a, i32 0 -+ %vecins1 = insertelement <4 x float> %vecins, float %a, i32 1 -+ %vecins2 = insertelement <4 x float> %vecins1, float %a, i32 2 -+ %vecins3 = insertelement <4 x float> %vecins2, float %a, i32 3 -+ ret <4 x float> %vecins3 -+; CHECK-P8: xscvdpspn -+; CHECK-P7-NOT: xscvdpspn -+; CHECK: blr -+} -+ -+define <2 x double> @test2(double %a) { -+entry: -+; CHECK-LABEL: test2 -+ %vecins = insertelement <2 x double> undef, double %a, i32 0 -+ %vecins1 = insertelement <2 x double> %vecins, double %a, i32 1 -+ ret <2 x double> %vecins1 -+; CHECK-P8: xxspltd -+; CHECK-P7: xxspltd -+; CHECK: blr -+} -+ --- -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