Date: Wednesday, October 27, 2021 @ 06:14:08 Author: foutrelis Revision: 426678
archrelease: copy trunk to staging-x86_64 Added: llvm/repos/staging-x86_64/PKGBUILD (from rev 426677, llvm/trunk/PKGBUILD) llvm/repos/staging-x86_64/disable-bswap-for-spir.patch (from rev 426677, llvm/trunk/disable-bswap-for-spir.patch) llvm/repos/staging-x86_64/llvm-config.h (from rev 426677, llvm/trunk/llvm-config.h) llvm/repos/staging-x86_64/no-strict-aliasing-DwarfCompileUnit.patch (from rev 426677, llvm/trunk/no-strict-aliasing-DwarfCompileUnit.patch) Deleted: llvm/repos/staging-x86_64/PKGBUILD llvm/repos/staging-x86_64/llvm-config.h llvm/repos/staging-x86_64/no-strict-aliasing-DwarfCompileUnit.patch -------------------------------------------+ PKGBUILD | 261 ++++++++++++++-------------- disable-bswap-for-spir.patch | 50 +++++ llvm-config.h | 18 - no-strict-aliasing-DwarfCompileUnit.patch | 26 +- 4 files changed, 205 insertions(+), 150 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2021-10-27 06:13:53 UTC (rev 426677) +++ PKGBUILD 2021-10-27 06:14:08 UTC (rev 426678) @@ -1,128 +0,0 @@ -# Maintainer: Evangelos Foutras <evange...@foutrelis.com> -# Contributor: Jan "heftig" Steffens <jan.steff...@gmail.com> - -pkgname=('llvm' 'llvm-libs' 'llvm-ocaml') -pkgver=13.0.0 -pkgrel=1 -_ocaml_ver=4.12.0 -arch=('x86_64') -url="https://llvm.org/" -license=('custom:Apache 2.0 with LLVM Exception') -makedepends=('cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2' - "ocaml>=$_ocaml_ver" 'ocaml-ctypes' 'ocaml-findlib' - 'python-setuptools' 'python-psutil' 'python-sphinx' - 'python-recommonmark') -options=('staticlibs') -_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver -source=($_source_base/$pkgname-$pkgver.src.tar.xz{,.sig} - no-strict-aliasing-DwarfCompileUnit.patch - llvm-config.h) -sha256sums=('408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020' - 'SKIP' - 'd1eff24508e35aae6c26a943dbaa3ef5acb60a145b008fd1ef9ac6f6c4faa662' - '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48') -validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <h...@chromium.org> -validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstel...@redhat.com> - -prepare() { - cd "$srcdir/llvm-$pkgver.src" - mkdir build - - # Work around intermittent 'clang -O -g' crashes - # https://bugs.llvm.org/show_bug.cgi?id=50611#c3 - patch -Np2 -i ../no-strict-aliasing-DwarfCompileUnit.patch -} - -build() { - cd "$srcdir/llvm-$pkgver.src/build" - - cmake .. -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DLLVM_HOST_TRIPLE=$CHOST \ - -DLLVM_BUILD_LLVM_DYLIB=ON \ - -DLLVM_LINK_LLVM_DYLIB=ON \ - -DLLVM_INSTALL_UTILS=ON \ - -DLLVM_ENABLE_RTTI=ON \ - -DLLVM_ENABLE_FFI=ON \ - -DLLVM_BUILD_TESTS=ON \ - -DLLVM_BUILD_DOCS=ON \ - -DLLVM_ENABLE_SPHINX=ON \ - -DLLVM_ENABLE_DOXYGEN=OFF \ - -DSPHINX_WARNINGS_AS_ERRORS=OFF \ - -DLLVM_BINUTILS_INCDIR=/usr/include - ninja all ocaml_doc -} - -check() { - cd "$srcdir/llvm-$pkgver.src/build" - ninja check -} - -package_llvm() { - pkgdesc="Collection of modular and reusable compiler and toolchain technologies" - depends=('llvm-libs' 'perl') - - cd "$srcdir/llvm-$pkgver.src/build" - - DESTDIR="$pkgdir" ninja install - - # Include lit for running lit-based tests in other projects - pushd ../utils/lit - python3 setup.py install --root="$pkgdir" -O1 - popd - - # Remove documentation sources - rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo} - - # The runtime libraries go into llvm-libs - mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}*.so* "$srcdir" - mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir" - - # OCaml bindings go to a separate package - rm -rf "$srcdir"/ocaml.{lib,doc} - mv "$pkgdir/usr/lib/ocaml" "$srcdir/ocaml.lib" - mv "$pkgdir/usr/share/doc/$pkgname/ocaml-html" "$srcdir/ocaml.doc" - - if [[ $CARCH == x86_64 ]]; then - # Needed for multilib (https://bugs.archlinux.org/task/29951) - # Header stub is taken from Fedora - mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h - cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h" - fi - - install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" -} - -package_llvm-libs() { - pkgdesc="LLVM runtime libraries" - depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2') - - install -d "$pkgdir/usr/lib" - cp -P \ - "$srcdir"/lib{LLVM,LTO,Remarks}*.so* \ - "$srcdir"/LLVMgold.so \ - "$pkgdir/usr/lib/" - - # Symlink LLVMgold.so from /usr/lib/bfd-plugins - # https://bugs.archlinux.org/task/28479 - install -d "$pkgdir/usr/lib/bfd-plugins" - ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so" - - install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \ - "$pkgdir/usr/share/licenses/$pkgname/LICENSE" -} - -package_llvm-ocaml() { - pkgdesc="OCaml bindings for LLVM" - depends=('llvm' "ocaml=$_ocaml_ver" 'ocaml-ctypes') - - install -d "$pkgdir"/{usr/lib,usr/share/doc/$pkgname} - cp -a "$srcdir/ocaml.lib" "$pkgdir/usr/lib/ocaml" - cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname/html" - - install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \ - "$pkgdir/usr/share/licenses/$pkgname/LICENSE" -} - -# vim:set ts=2 sw=2 et: Copied: llvm/repos/staging-x86_64/PKGBUILD (from rev 426677, llvm/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2021-10-27 06:14:08 UTC (rev 426678) @@ -0,0 +1,133 @@ +# Maintainer: Evangelos Foutras <evange...@foutrelis.com> +# Contributor: Jan "heftig" Steffens <jan.steff...@gmail.com> + +pkgname=('llvm' 'llvm-libs' 'llvm-ocaml') +pkgver=13.0.0 +pkgrel=2 +_ocaml_ver=4.12.0 +arch=('x86_64') +url="https://llvm.org/" +license=('custom:Apache 2.0 with LLVM Exception') +makedepends=('cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2' + "ocaml>=$_ocaml_ver" 'ocaml-ctypes' 'ocaml-findlib' + 'python-setuptools' 'python-psutil' 'python-sphinx' + 'python-recommonmark') +options=('staticlibs') +_source_base=https://github.com/llvm/llvm-project/releases/download/llvmorg-$pkgver +source=($_source_base/$pkgname-$pkgver.src.tar.xz{,.sig} + no-strict-aliasing-DwarfCompileUnit.patch + disable-bswap-for-spir.patch + llvm-config.h) +sha256sums=('408d11708643ea826f519ff79761fcdfc12d641a2510229eec459e72f8163020' + 'SKIP' + 'd1eff24508e35aae6c26a943dbaa3ef5acb60a145b008fd1ef9ac6f6c4faa662' + 'af163392fbc19d65d11ab4b1510a2eae39b417d6228023b3ba5395b138bb41f5' + '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48') +validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <h...@chromium.org> +validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstel...@redhat.com> + +prepare() { + cd "$srcdir/llvm-$pkgver.src" + mkdir build + + # Work around intermittent 'clang -O -g' crashes + # https://bugs.llvm.org/show_bug.cgi?id=50611#c3 + patch -Np2 -i ../no-strict-aliasing-DwarfCompileUnit.patch + + # Fix an ISPC build failure (https://github.com/ispc/ispc/issues/2189) + patch -Np2 -i ../disable-bswap-for-spir.patch +} + +build() { + cd "$srcdir/llvm-$pkgver.src/build" + + cmake .. -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_HOST_TRIPLE=$CHOST \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_ENABLE_FFI=ON \ + -DLLVM_BUILD_TESTS=ON \ + -DLLVM_BUILD_DOCS=ON \ + -DLLVM_ENABLE_SPHINX=ON \ + -DLLVM_ENABLE_DOXYGEN=OFF \ + -DSPHINX_WARNINGS_AS_ERRORS=OFF \ + -DLLVM_BINUTILS_INCDIR=/usr/include + ninja all ocaml_doc +} + +check() { + cd "$srcdir/llvm-$pkgver.src/build" + ninja check +} + +package_llvm() { + pkgdesc="Collection of modular and reusable compiler and toolchain technologies" + depends=('llvm-libs' 'perl') + + cd "$srcdir/llvm-$pkgver.src/build" + + DESTDIR="$pkgdir" ninja install + + # Include lit for running lit-based tests in other projects + pushd ../utils/lit + python3 setup.py install --root="$pkgdir" -O1 + popd + + # Remove documentation sources + rm -r "$pkgdir"/usr/share/doc/$pkgname/html/{_sources,.buildinfo} + + # The runtime libraries go into llvm-libs + mv -f "$pkgdir"/usr/lib/lib{LLVM,LTO,Remarks}*.so* "$srcdir" + mv -f "$pkgdir"/usr/lib/LLVMgold.so "$srcdir" + + # OCaml bindings go to a separate package + rm -rf "$srcdir"/ocaml.{lib,doc} + mv "$pkgdir/usr/lib/ocaml" "$srcdir/ocaml.lib" + mv "$pkgdir/usr/share/doc/$pkgname/ocaml-html" "$srcdir/ocaml.doc" + + if [[ $CARCH == x86_64 ]]; then + # Needed for multilib (https://bugs.archlinux.org/task/29951) + # Header stub is taken from Fedora + mv "$pkgdir/usr/include/llvm/Config/llvm-config"{,-64}.h + cp "$srcdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config.h" + fi + + install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} + +package_llvm-libs() { + pkgdesc="LLVM runtime libraries" + depends=('gcc-libs' 'zlib' 'libffi' 'libedit' 'ncurses' 'libxml2') + + install -d "$pkgdir/usr/lib" + cp -P \ + "$srcdir"/lib{LLVM,LTO,Remarks}*.so* \ + "$srcdir"/LLVMgold.so \ + "$pkgdir/usr/lib/" + + # Symlink LLVMgold.so from /usr/lib/bfd-plugins + # https://bugs.archlinux.org/task/28479 + install -d "$pkgdir/usr/lib/bfd-plugins" + ln -s ../LLVMgold.so "$pkgdir/usr/lib/bfd-plugins/LLVMgold.so" + + install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \ + "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} + +package_llvm-ocaml() { + pkgdesc="OCaml bindings for LLVM" + depends=('llvm' "ocaml=$_ocaml_ver" 'ocaml-ctypes') + + install -d "$pkgdir"/{usr/lib,usr/share/doc/$pkgname} + cp -a "$srcdir/ocaml.lib" "$pkgdir/usr/lib/ocaml" + cp -a "$srcdir/ocaml.doc" "$pkgdir/usr/share/doc/$pkgname/html" + + install -Dm644 "$srcdir/llvm-$pkgver.src/LICENSE.TXT" \ + "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} + +# vim:set ts=2 sw=2 et: Copied: llvm/repos/staging-x86_64/disable-bswap-for-spir.patch (from rev 426677, llvm/trunk/disable-bswap-for-spir.patch) =================================================================== --- disable-bswap-for-spir.patch (rev 0) +++ disable-bswap-for-spir.patch 2021-10-27 06:14:08 UTC (rev 426678) @@ -0,0 +1,50 @@ +# Based on https://github.com/ispc/ispc/blob/main/llvm_patches/12_0_disable-A-B-A-B-and-BSWAP-in-InstCombine.patch + +diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp +index d01a021bf3f4..bccce825a03d 100644 +--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp ++++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp +@@ -15,6 +15,7 @@ + #include "llvm/ADT/APInt.h" + #include "llvm/ADT/STLExtras.h" + #include "llvm/ADT/SmallVector.h" ++#include "llvm/ADT/Triple.h" + #include "llvm/Analysis/InstructionSimplify.h" + #include "llvm/Analysis/ValueTracking.h" + #include "llvm/IR/Constant.h" +@@ -1369,9 +1370,12 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) { + } + } + +- // A+B --> A|B iff A and B have no bits set in common. +- if (haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT)) +- return BinaryOperator::CreateOr(LHS, RHS); ++ // Disable this transformation for ISPC SPIR-V ++ if (!Triple(I.getModule()->getTargetTriple()).isSPIR()) { ++ // A+B --> A|B iff A and B have no bits set in common. ++ if (haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT)) ++ return BinaryOperator::CreateOr(LHS, RHS); ++ } + + // add (select X 0 (sub n A)) A --> select X A n + { +diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +index 120852c44474..8de55311ce3e 100644 +--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp ++++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +@@ -2671,9 +2671,12 @@ Instruction *InstCombinerImpl::visitOr(BinaryOperator &I) { + if (Instruction *FoldedLogic = foldBinOpIntoSelectOrPhi(I)) + return FoldedLogic; + +- if (Instruction *BitOp = matchBSwapOrBitReverse(I, /*MatchBSwaps*/ true, +- /*MatchBitReversals*/ true)) +- return BitOp; ++ // Disable this transformation for ISPC SPIR-V ++ if (!Triple(I.getModule()->getTargetTriple()).isSPIR()) { ++ if (Instruction *BitOp = matchBSwapOrBitReverse(I, /*MatchBSwaps*/ true, ++ /*MatchBitReversals*/ true)) ++ return BitOp; ++ } + + if (Instruction *Funnel = matchFunnelShift(I, *this)) + return Funnel; Deleted: llvm-config.h =================================================================== --- llvm-config.h 2021-10-27 06:13:53 UTC (rev 426677) +++ llvm-config.h 2021-10-27 06:14:08 UTC (rev 426678) @@ -1,9 +0,0 @@ -#include <bits/wordsize.h> - -#if __WORDSIZE == 32 -#include "llvm-config-32.h" -#elif __WORDSIZE == 64 -#include "llvm-config-64.h" -#else -#error "Unknown word size" -#endif Copied: llvm/repos/staging-x86_64/llvm-config.h (from rev 426677, llvm/trunk/llvm-config.h) =================================================================== --- llvm-config.h (rev 0) +++ llvm-config.h 2021-10-27 06:14:08 UTC (rev 426678) @@ -0,0 +1,9 @@ +#include <bits/wordsize.h> + +#if __WORDSIZE == 32 +#include "llvm-config-32.h" +#elif __WORDSIZE == 64 +#include "llvm-config-64.h" +#else +#error "Unknown word size" +#endif Deleted: no-strict-aliasing-DwarfCompileUnit.patch =================================================================== --- no-strict-aliasing-DwarfCompileUnit.patch 2021-10-27 06:13:53 UTC (rev 426677) +++ no-strict-aliasing-DwarfCompileUnit.patch 2021-10-27 06:14:08 UTC (rev 426678) @@ -1,13 +0,0 @@ -diff --git a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt -index eb924282a75e..85929b54d6ce 100644 ---- a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt -+++ b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt -@@ -44,3 +44,8 @@ add_llvm_component_library(LLVMAsmPrinter - Support - Target - ) -+ -+# https://bugs.llvm.org/show_bug.cgi?id=50611#c3 -+if (CMAKE_COMPILER_IS_GNUCXX) -+ set_source_files_properties(DwarfCompileUnit.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing) -+endif() Copied: llvm/repos/staging-x86_64/no-strict-aliasing-DwarfCompileUnit.patch (from rev 426677, llvm/trunk/no-strict-aliasing-DwarfCompileUnit.patch) =================================================================== --- no-strict-aliasing-DwarfCompileUnit.patch (rev 0) +++ no-strict-aliasing-DwarfCompileUnit.patch 2021-10-27 06:14:08 UTC (rev 426678) @@ -0,0 +1,13 @@ +diff --git a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt +index eb924282a75e..85929b54d6ce 100644 +--- a/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt ++++ b/llvm/lib/CodeGen/AsmPrinter/CMakeLists.txt +@@ -44,3 +44,8 @@ add_llvm_component_library(LLVMAsmPrinter + Support + Target + ) ++ ++# https://bugs.llvm.org/show_bug.cgi?id=50611#c3 ++if (CMAKE_COMPILER_IS_GNUCXX) ++ set_source_files_properties(DwarfCompileUnit.cpp PROPERTIES COMPILE_FLAGS -fno-strict-aliasing) ++endif()