[arch-commits] Commit in llvm/repos/extra-x86_64 (5 files)

Evangelos Foutras foutrelis at archlinux.org
Tue Feb 2 23:58:54 UTC 2021


    Date: Tuesday, February 2, 2021 @ 23:58:53
  Author: foutrelis
Revision: 407108

archrelease: copy trunk to extra-x86_64

Added:
  llvm/repos/extra-x86_64/PKGBUILD
    (from rev 407107, llvm/trunk/PKGBUILD)
  llvm/repos/extra-x86_64/amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch
    (from rev 407107, llvm/trunk/amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch)
  llvm/repos/extra-x86_64/llvm-config.h
    (from rev 407107, llvm/trunk/llvm-config.h)
Deleted:
  llvm/repos/extra-x86_64/PKGBUILD
  llvm/repos/extra-x86_64/llvm-config.h

----------------------------------------------------------+
 PKGBUILD                                                 |  250 ++++++-------
 amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch |   85 ++++
 llvm-config.h                                            |   18 
 3 files changed, 222 insertions(+), 131 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2021-02-02 23:58:46 UTC (rev 407107)
+++ PKGBUILD	2021-02-02 23:58:53 UTC (rev 407108)
@@ -1,122 +0,0 @@
-# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
-# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
-
-pkgname=('llvm' 'llvm-libs' 'llvm-ocaml')
-pkgver=11.0.1
-pkgrel=1
-_ocaml_ver=4.11.1
-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}
-        llvm-config.h)
-sha256sums=('ccd87c254b6aebc5077e4e6977d08d4be888e7eb672c6630a26a15d58b59b528'
-            'SKIP'
-            '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
-validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
-validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar at redhat.com>
-
-prepare() {
-  cd "$srcdir/llvm-$pkgver.src"
-  mkdir build
-}
-
-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/extra-x86_64/PKGBUILD (from rev 407107, llvm/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2021-02-02 23:58:53 UTC (rev 407108)
@@ -0,0 +1,128 @@
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
+
+pkgname=('llvm' 'llvm-libs' 'llvm-ocaml')
+pkgver=11.0.1
+pkgrel=2
+_ocaml_ver=4.11.1
+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}
+        amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch
+        llvm-config.h)
+sha256sums=('ccd87c254b6aebc5077e4e6977d08d4be888e7eb672c6630a26a15d58b59b528'
+            'SKIP'
+            '85b6977005899bc76fcc548e0b6501cae5f50a8ad03060b9f58d03d775323327'
+            '597dc5968c695bbdbb0eac9e8eb5117fcd2773bc91edf5ec103ecffffab8bc48')
+validpgpkeys+=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
+validpgpkeys+=('474E22316ABF4785A88C6E8EA2C794A986419D8A') # Tom Stellard <tstellar at redhat.com>
+
+prepare() {
+  cd "$srcdir/llvm-$pkgver.src"
+  mkdir build
+
+  # https://gitlab.freedesktop.org/mesa/mesa/-/issues/4107
+  # https://bugs.llvm.org/show_bug.cgi?id=48921#c2
+  patch -Np2 -i ../amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.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/extra-x86_64/amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch (from rev 407107, llvm/trunk/amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch)
===================================================================
--- amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch	                        (rev 0)
+++ amdgpu-avoid-an-illegal-operand-in-si-shrink-instr.patch	2021-02-02 23:58:53 UTC (rev 407108)
@@ -0,0 +1,85 @@
+commit b08a140a8fe8d0b0d16a93042b4952d6e34ab913
+Author: Piotr Sobczak <Piotr.Sobczak at amd.com>
+Date:   Wed Jan 27 16:02:49 2021 +0100
+
+    [AMDGPU] Avoid an illegal operand in si-shrink-instructions
+    
+    Before the patch it was possible to trigger a constant bus
+    violation when folding immediates into a shrunk instruction.
+    
+    The patch adds a check to enforce the legality of the new operand.
+    
+    Differential Revision: https://reviews.llvm.org/D95527
+
+diff --git a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
+index 9c6833a7dab6..6c1b16eddc84 100644
+--- a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
++++ b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
+@@ -84,21 +84,23 @@ static bool foldImmediates(MachineInstr &MI, const SIInstrInfo *TII,
+         MachineOperand &MovSrc = Def->getOperand(1);
+         bool ConstantFolded = false;
+ 
+-        if (MovSrc.isImm() && (isInt<32>(MovSrc.getImm()) ||
+-                               isUInt<32>(MovSrc.getImm()))) {
+-          // It's possible to have only one component of a super-reg defined by
+-          // a single mov, so we need to clear any subregister flag.
+-          Src0.setSubReg(0);
+-          Src0.ChangeToImmediate(MovSrc.getImm());
+-          ConstantFolded = true;
+-        } else if (MovSrc.isFI()) {
+-          Src0.setSubReg(0);
+-          Src0.ChangeToFrameIndex(MovSrc.getIndex());
+-          ConstantFolded = true;
+-        } else if (MovSrc.isGlobal()) {
+-          Src0.ChangeToGA(MovSrc.getGlobal(), MovSrc.getOffset(),
+-                          MovSrc.getTargetFlags());
+-          ConstantFolded = true;
++        if (TII->isOperandLegal(MI, Src0Idx, &MovSrc)) {
++          if (MovSrc.isImm() &&
++              (isInt<32>(MovSrc.getImm()) || isUInt<32>(MovSrc.getImm()))) {
++            // It's possible to have only one component of a super-reg defined
++            // by a single mov, so we need to clear any subregister flag.
++            Src0.setSubReg(0);
++            Src0.ChangeToImmediate(MovSrc.getImm());
++            ConstantFolded = true;
++          } else if (MovSrc.isFI()) {
++            Src0.setSubReg(0);
++            Src0.ChangeToFrameIndex(MovSrc.getIndex());
++            ConstantFolded = true;
++          } else if (MovSrc.isGlobal()) {
++            Src0.ChangeToGA(MovSrc.getGlobal(), MovSrc.getOffset(),
++                            MovSrc.getTargetFlags());
++            ConstantFolded = true;
++          }
+         }
+ 
+         if (ConstantFolded) {
+diff --git a/llvm/test/CodeGen/AMDGPU/shrink-instructions-illegal-fold.mir b/llvm/test/CodeGen/AMDGPU/shrink-instructions-illegal-fold.mir
+new file mode 100644
+index 000000000000..7889f437facf
+--- /dev/null
++++ b/llvm/test/CodeGen/AMDGPU/shrink-instructions-illegal-fold.mir
+@@ -0,0 +1,23 @@
++# RUN: llc -march=amdgcn -mcpu=gfx900 -run-pass=si-shrink-instructions --verify-machineinstrs %s -o - | FileCheck %s
++
++# Make sure immediate folding into V_CNDMASK respects constant bus restrictions.
++---
++
++name:            shrink_cndmask_illegal_imm_folding
++tracksRegLiveness: true
++body:             |
++  bb.0:
++    liveins: $vgpr0, $vgpr1
++    ; CHECK-LABEL: name: shrink_cndmask_illegal_imm_folding
++    ; CHECK: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
++    ; CHECK: [[MOV:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 32768, implicit $exec
++    ; CHECK: V_CMP_EQ_U32_e32 0, [[COPY]], implicit-def $vcc, implicit $exec
++    ; CHECK: V_CNDMASK_B32_e32 [[MOV]], killed [[COPY]], implicit $vcc, implicit $exec
++
++    %0:vgpr_32 = COPY $vgpr0
++    %1:vgpr_32 = V_MOV_B32_e32 32768, implicit $exec
++    V_CMP_EQ_U32_e32 0, %0:vgpr_32, implicit-def $vcc, implicit $exec
++    %2:vgpr_32 = V_CNDMASK_B32_e64 0, %1:vgpr_32, 0, killed %0:vgpr_32, $vcc, implicit $exec
++    S_NOP 0
++
++...

Deleted: llvm-config.h
===================================================================
--- llvm-config.h	2021-02-02 23:58:46 UTC (rev 407107)
+++ llvm-config.h	2021-02-02 23:58:53 UTC (rev 407108)
@@ -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/extra-x86_64/llvm-config.h (from rev 407107, llvm/trunk/llvm-config.h)
===================================================================
--- llvm-config.h	                        (rev 0)
+++ llvm-config.h	2021-02-02 23:58:53 UTC (rev 407108)
@@ -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



More information about the arch-commits mailing list