[arch-commits] Commit in lib32-llvm/trunk (5 files)

Laurent Carlier lcarlier at archlinux.org
Fri Mar 16 15:17:47 UTC 2018


    Date: Friday, March 16, 2018 @ 15:17:46
  Author: lcarlier
Revision: 308887

upgpkg: lib32-llvm 6.0.0-1

upstream update 6.0.0

Added:
  lib32-llvm/trunk/D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch
  lib32-llvm/trunk/D44420-cmake-fix-a-typo-in-llvm_config-macro.patch
  lib32-llvm/trunk/PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch
  lib32-llvm/trunk/PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch
Modified:
  lib32-llvm/trunk/PKGBUILD

--------------------------------------------------------------------+
 D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch      |   36 +
 D44420-cmake-fix-a-typo-in-llvm_config-macro.patch                 |   13 
 PKGBUILD                                                           |   90 +--
 PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch     |  262 ++++++++++
 PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch |   34 +
 5 files changed, 378 insertions(+), 57 deletions(-)

Added: D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch
===================================================================
--- D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch	                        (rev 0)
+++ D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch	2018-03-16 15:17:46 UTC (rev 308887)
@@ -0,0 +1,36 @@
+From 4d613a84ce271c6225068bef67d727ae02b2e3b1 Mon Sep 17 00:00:00 2001
+From: Pavel Labath <labath at google.com>
+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 fe4df5278498..e70018679846 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@)

Added: D44420-cmake-fix-a-typo-in-llvm_config-macro.patch
===================================================================
--- D44420-cmake-fix-a-typo-in-llvm_config-macro.patch	                        (rev 0)
+++ D44420-cmake-fix-a-typo-in-llvm_config-macro.patch	2018-03-16 15:17:46 UTC (rev 308887)
@@ -0,0 +1,13 @@
+Index: cmake/modules/LLVM-Config.cmake
+===================================================================
+--- cmake/modules/LLVM-Config.cmake
++++ cmake/modules/LLVM-Config.cmake
+@@ -68,7 +68,7 @@
+   cmake_parse_arguments(ARG "USE_SHARED" "" "" ${ARGN})
+   set(link_components ${ARG_UNPARSED_ARGUMENTS})
+ 
+-  if(USE_SHARED)
++  if(ARG_USE_SHARED)
+     # If USE_SHARED is specified, then we link against libLLVM,
+     # but also against the component libraries below. This is
+     # done in case libLLVM does not contain all of the components

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2018-03-16 14:23:55 UTC (rev 308886)
+++ PKGBUILD	2018-03-16 15:17:46 UTC (rev 308887)
@@ -1,46 +1,44 @@
 # $Id$
-# Maintainer: Evangelos Foutras <foutrelis at gmail.com>
+# Maintainer: Laurent Carlier <lordheavym at gmail.com>
+# Contributor: Evangelos Foutras <foutrelis at gmail.com>
 # Contributor: Jan "heftig" Steffens <jan.steffens at gmail.com>
-# Contributor: Sebastian Nowicki <sebnow at gmail.com>
-# Contributor: Devin Cofer <ranguvar{AT]archlinux[DOT}us>
-# Contributor: Tobias Kieslich <tobias at justdreams.de>
-# Contributor: Geoffroy Carrier <geoffroy.carrier at aur.archlinux.org>
-# Contributor: Tomas Lindquist Olsen <tomas at famolsen.dk>
-# Contributor: Roberto Alsina <ralsina at kde.org>
-# Contributor: Gerardo Exequiel Pozzi <vmlinuz386 at yahoo.com.ar>
 
-pkgname=('lib32-llvm' 'lib32-llvm-libs' 'lib32-clang')
-pkgver=5.0.1
+pkgname=('lib32-llvm' 'lib32-llvm-libs')
+pkgver=6.0.0
 pkgrel=1
 arch=('x86_64')
 url="http://llvm.org/"
 license=('custom:University of Illinois/NCSA Open Source License')
-makedepends=('cmake' 'lib32-libffi' 'lib32-zlib' 'python2' 'gcc-multilib'
+makedepends=('cmake' 'ninja' 'lib32-libffi' 'lib32-zlib' 'python2' 'gcc-multilib'
              'lib32-libxml2')
 options=('staticlibs')
 source=(http://releases.llvm.org/$pkgver/llvm-$pkgver.src.tar.xz{,.sig}
-        http://releases.llvm.org/$pkgver/cfe-$pkgver.src.tar.xz{,.sig}
-        http://releases.llvm.org/$pkgver/compiler-rt-$pkgver.src.tar.xz{,.sig})
-sha256sums=('5fa7489fc0225b11821cab0362f5813a05f2bcf2533e8a4ea9c9c860168807b0'
+        PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch
+        PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch
+        D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch
+        D44420-cmake-fix-a-typo-in-llvm_config-macro.patch)
+sha256sums=('1ff53c915b4e761ef400b803f07261ade637b0c269d99569f18040f3dcee4408'
             'SKIP'
-            '135f6c9b0cd2da1aff2250e065946258eb699777888df39ca5a5b4fe5e23d0ff'
-            'SKIP'
-            '4edd1417f457a9b3f0eb88082530490edf3cf6a7335cdce8ecbc5d3e16a895da'
-            'SKIP')
-validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D'
-              '11E521D646982372EB577A1F8F0871F202119294')
+            '5a90833c15c4981e7accd405290491d7930f991d30943d7ae9e4e338149731ff'
+            'da80b59c9abe9fe864ff8dc42132c5aa135a79d342fd147ae6f54e2621e009fa'
+            '96e2f3ca8b7d1bdbe2606a1eebb12c57b39838d1bcc15e40388e8d59649a9f4a'
+            '5cc114fd711e6ea836a6270b2f713e2e751c49e8b5ffa6c6812127ca801acef3')
+validpgpkeys=('B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans at chromium.org>
+validpgpkeys+=('11E521D646982372EB577A1F8F0871F202119294') # Tom Stellard <tom at stellard.net>
 
 prepare() {
   cd "$srcdir/llvm-$pkgver.src"
   mkdir build
 
-  mv "$srcdir/cfe-$pkgver.src" tools/clang
-  mv "$srcdir/compiler-rt-$pkgver.src" projects/compiler-rt
+  # https://bugs.llvm.org/show_bug.cgi?id=36417
+  patch -Np1 -i ../PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch
+  patch -Np1 -i ../PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch
 
-  # Somehow CMake finds the 64-bit library in /lib first,
-  # so let's preseed CMAKE_LIBRARY_PATH with /lib32.
-  sed -i '/^[[:blank:]]*find_library(FFI_LIBRARY_PATH/i\
-         list(INSERT CMAKE_LIBRARY_PATH 0 /usr/lib32)' cmake/config-ix.cmake
+  # https://reviews.llvm.org/D44391
+  patch -Np1 -i ../D44391-export-LLVM_DYLIB_COMPONENTS-in-LLVMConfig.cmake.patch
+
+  # https://reviews.llvm.org/D44420
+  patch -Np0 -i ../D44420-cmake-fix-a-typo-in-llvm_config-macro.patch
 }
 
 build() {
@@ -48,7 +46,7 @@
 
   export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
 
-  cmake \
+  cmake .. -G Ninja \
     -DCMAKE_BUILD_TYPE=Release \
     -DCMAKE_INSTALL_PREFIX=/usr \
     -DLLVM_LIBDIR_SUFFIX=32 \
@@ -55,6 +53,7 @@
     -DCMAKE_C_FLAGS:STRING=-m32 \
     -DCMAKE_CXX_FLAGS:STRING=-m32 \
     -DLLVM_TARGET_ARCH:STRING=i686 \
+    -DLLVM_HOST_TRIPLE=$CHOST \
     -DLLVM_DEFAULT_TARGET_TRIPLE="i686-pc-linux-gnu" \
     -DLLVM_BUILD_LLVM_DYLIB=ON \
     -DLLVM_LINK_LLVM_DYLIB=ON \
@@ -64,24 +63,18 @@
     -DLLVM_ENABLE_SPHINX=OFF \
     -DLLVM_ENABLE_DOXYGEN=OFF \
     -DFFI_INCLUDE_DIR=$(pkg-config --variable=includedir libffi) \
-    -DLLVM_BINUTILS_INCDIR=/usr/include \
-    ..
+    -DLLVM_BINUTILS_INCDIR=/usr/include
 
-  make
-
-  # Disable automatic installation of components that go into subpackages
-  sed -i '/\(clang\|lldb\)\/cmake_install.cmake/d' tools/cmake_install.cmake
-  sed -i '/extra\/cmake_install.cmake/d' tools/clang/tools/cmake_install.cmake
-  sed -i '/compiler-rt\/cmake_install.cmake/d' projects/cmake_install.cmake
+  ninja all
 }
 
 package_lib32-llvm() {
-  pkgdesc="Low Level Virtual Machine (32-bit)"
+  pkgdesc="Collection of modular and reusable compiler and toolchain technologies (32-bit)"
   depends=('lib32-llvm-libs' 'llvm')
 
-  cd "$srcdir/llvm-$pkgver.src"
+  cd "$srcdir/llvm-$pkgver.src/build"
 
-  make -C build DESTDIR="$pkgdir" install
+  DESTDIR="$pkgdir" ninja install
 
   # The runtime library goes into lib32-llvm-libs
   mv "$pkgdir"/usr/lib32/lib{LLVM,LTO}*.so* "$srcdir"
@@ -94,9 +87,6 @@
   mv "$pkgdir/usr/include/llvm/Config/llvm-config.h" \
     "$pkgdir/usr/lib32/llvm-config-32.h"
 
-  # Get rid of example Hello transformation
-  rm "$pkgdir"/usr/lib32/*LLVMHello.*
-
   rm -rf "$pkgdir"/usr/{bin,include,share/{doc,man,llvm,opt-viewer}}
 
   # Needed for multilib (https://bugs.archlinux.org/task/29951)
@@ -107,12 +97,12 @@
   mkdir "$pkgdir"/usr/bin
   mv "$pkgdir/usr/lib32/llvm-config" "$pkgdir/usr/bin/llvm-config32"
 
-  install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+  install -Dm644 ../LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
 }
 
 package_lib32-llvm-libs() {
   pkgdesc="Low Level Virtual Machine (runtime library)(32-bit) "
-  depends=('lib32-libffi' 'lib32-zlib' 'lib32-ncurses' 'lib32-gcc-libs')
+  depends=('lib32-libffi' 'lib32-zlib' 'lib32-ncurses' 'lib32-libxml2' 'lib32-gcc-libs')
 
   install -d "$pkgdir/usr/lib32"
 
@@ -128,17 +118,3 @@
 
   install -Dm644 llvm-$pkgver.src/LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
 }
-
-package_lib32-clang() {
-  pkgdesc="C language family frontend for LLVM"
-  url="http://clang.llvm.org/"
-  depends=('lib32-llvm' 'clang' 'gcc-multilib')
-
-  cd "$srcdir/llvm-$pkgver.src"
-
-  make -C build/tools/clang DESTDIR="$pkgdir" install
-
-  rm -r "$pkgdir"/usr/{bin,include,share,libexec}
-
-  install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
-}

Added: PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch
===================================================================
--- PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch	                        (rev 0)
+++ PR36417-DebugInfo-discard-invalid-DBG_VALUE-instructions.patch	2018-03-16 15:17:46 UTC (rev 308887)
@@ -0,0 +1,262 @@
+From 783006ec19853403b8fe799e4c1b9496cb03504a Mon Sep 17 00:00:00 2001
+From: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
+Date: Tue, 6 Mar 2018 08:47:07 +0000
+Subject: [PATCH] [DebugInfo] Discard invalid DBG_VALUE instructions in
+ LiveDebugVariables
+
+Summary:
+This is a workaround for pr36417
+https://bugs.llvm.org/show_bug.cgi?id=36417
+
+LiveDebugVariables will now verify that the DBG_VALUE instructions
+are sane (prior to register allocation) by asking LIS if a virtual
+register used in the DBG_VALUE is live (or dead def) in the slot
+index before the DBG_VALUE. If it isn't sane the DBG_VALUE is
+discarded.
+
+One pass that was identified as introducing non-sane DBG_VALUE
+instructtons, when analysing pr36417, was the DAG->DAG Instruction
+Selection. It sometimes inserts DBG_VALUE instructions referring to
+a virtual register that is defined later in the same basic block.
+So it is a use before def kind of problem. The DBG_VALUE is
+typically inserted in the beginning of a basic block when this
+happens. The problem can be seen in the test case
+test/DebugInfo/X86/dbg-value-inlined-parameter.ll
+
+Reviewers: aprantl, rnk, probinson
+
+Reviewed By: aprantl
+
+Subscribers: vsk, davide, alexcrichton, Ka-Ka, eraman, llvm-commits, JDevlieghere
+
+Differential Revision: https://reviews.llvm.org/D43956
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326769 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/CodeGen/LiveDebugVariables.cpp                 |  38 +++++-
+ test/DebugInfo/X86/dbg-value-inlined-parameter.ll  |   6 +-
+ .../X86/live-debug-vars-discard-invalid.mir        | 141 +++++++++++++++++++++
+ 3 files changed, 181 insertions(+), 4 deletions(-)
+ create mode 100644 test/DebugInfo/X86/live-debug-vars-discard-invalid.mir
+
+diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp
+index 09168b6b9309..f3fcd004defd 100644
+--- a/lib/CodeGen/LiveDebugVariables.cpp
++++ b/lib/CodeGen/LiveDebugVariables.cpp
+@@ -514,6 +514,39 @@ bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) {
+     return false;
+   }
+ 
++  // Detect invalid DBG_VALUE instructions, with a debug-use of a virtual
++  // register that hasn't been defined yet. If we do not remove those here, then
++  // the re-insertion of the DBG_VALUE instruction after register allocation
++  // will be incorrect.
++  // TODO: If earlier passes are corrected to generate sane debug information
++  // (and if the machine verifier is improved to catch this), then these checks
++  // could be removed or replaced by asserts.
++  bool Discard = false;
++  if (MI.getOperand(0).isReg() &&
++      TargetRegisterInfo::isVirtualRegister(MI.getOperand(0).getReg())) {
++    const unsigned Reg = MI.getOperand(0).getReg();
++    if (!LIS->hasInterval(Reg)) {
++      // The DBG_VALUE is described by a virtual register that does not have a
++      // live interval. Discard the DBG_VALUE.
++      Discard = true;
++      DEBUG(dbgs() << "Discarding debug info (no LIS interval): "
++            << Idx << " " << MI);
++    } else {
++      // The DBG_VALUE is only valid if either Reg is live out from Idx, or Reg
++      // is defined dead at Idx (where Idx is the slot index for the instruction
++      // preceeding the DBG_VALUE).
++      const LiveInterval &LI = LIS->getInterval(Reg);
++      LiveQueryResult LRQ = LI.Query(Idx);
++      if (!LRQ.valueOutOrDead()) {
++        // We have found a DBG_VALUE with the value in a virtual register that
++        // is not live. Discard the DBG_VALUE.
++        Discard = true;
++        DEBUG(dbgs() << "Discarding debug info (reg not live): "
++              << Idx << " " << MI);
++      }
++    }
++  }
++
+   // Get or create the UserValue for (variable,offset) here.
+   bool IsIndirect = MI.getOperand(1).isImm();
+   if (IsIndirect)
+@@ -522,7 +555,10 @@ bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) {
+   const DIExpression *Expr = MI.getDebugExpression();
+   UserValue *UV =
+       getUserValue(Var, Expr, MI.getDebugLoc());
+-  UV->addDef(Idx, MI.getOperand(0), IsIndirect);
++  if (!Discard)
++    UV->addDef(Idx, MI.getOperand(0), IsIndirect);
++  else
++    UV->addDef(Idx, MachineOperand::CreateReg(0U, RegState::Debug), false);
+   return true;
+ }
+ 
+diff --git a/test/DebugInfo/X86/dbg-value-inlined-parameter.ll b/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
+index 9954039654bb..e83cf0aa7ffd 100644
+--- a/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
++++ b/test/DebugInfo/X86/dbg-value-inlined-parameter.ll
+@@ -32,10 +32,10 @@
+ ;CHECK-NEXT: DW_AT_call_line
+ 
+ ;CHECK: DW_TAG_formal_parameter
+-;FIXME: Linux shouldn't drop this parameter either...
+ ;CHECK-NOT: DW_TAG
+-;DARWIN:   DW_AT_abstract_origin {{.*}} "sp"
+-;DARWIN: DW_TAG_formal_parameter
++;FIXME: Shouldn't drop this parameter...
++;XCHECK:   DW_AT_abstract_origin {{.*}} "sp"
++;XCHECK: DW_TAG_formal_parameter
+ ;CHECK: DW_AT_abstract_origin {{.*}} "nums"
+ ;CHECK-NOT: DW_TAG_formal_parameter
+ 
+diff --git a/test/DebugInfo/X86/live-debug-vars-discard-invalid.mir b/test/DebugInfo/X86/live-debug-vars-discard-invalid.mir
+new file mode 100644
+index 000000000000..abc21bc6ac90
+--- /dev/null
++++ b/test/DebugInfo/X86/live-debug-vars-discard-invalid.mir
+@@ -0,0 +1,141 @@
++# RUN: llc -mtriple=x86_64-linux-gnu -start-before greedy -stop-after virtregrewriter -o - %s | FileCheck %s
++
++--- |
++  ; ModuleID = '<stdin>'
++  source_filename = "test/DebugInfo/X86/dbg-value-inlined-parameter.ll"
++  target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
++  target triple = "x86_64-apple-darwin"
++
++  %struct.S1 = type { float*, i32 }
++
++  @p = common global %struct.S1 zeroinitializer, align 8, !dbg !0
++
++  ; Function Attrs: nounwind optsize ssp
++  define void @foobar() !dbg !15 {
++  entry:
++    tail call void @llvm.dbg.value(metadata %struct.S1* @p, metadata !18, metadata !DIExpression()) , !dbg !25
++    ret void, !dbg !32
++  }
++
++  ; Function Attrs: nounwind readnone speculatable
++  declare void @llvm.dbg.value(metadata, metadata, metadata) #2
++
++  !llvm.dbg.cu = !{!2}
++  !llvm.module.flags = !{!14}
++
++  !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
++  !1 = !DIGlobalVariable(name: "p", scope: !2, file: !3, line: 14, type: !6, isLocal: false, isDefinition: true)
++  !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 2.9 (trunk 125693)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !4, globals: !5, imports: !4)
++  !3 = !DIFile(filename: "nm2.c", directory: "/private/tmp")
++  !4 = !{}
++  !5 = !{!0}
++  !6 = !DIDerivedType(tag: DW_TAG_typedef, name: "S1", scope: !2, file: !3, line: 4, baseType: !7)
++  !7 = !DICompositeType(tag: DW_TAG_structure_type, name: "S1", scope: !2, file: !3, line: 1, size: 128, align: 64, elements: !8)
++  !8 = !{!9, !12}
++  !9 = !DIDerivedType(tag: DW_TAG_member, name: "m", scope: !3, file: !3, line: 2, baseType: !10, size: 64, align: 64)
++  !10 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !2, baseType: !11, size: 64, align: 64)
++  !11 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float)
++  !12 = !DIDerivedType(tag: DW_TAG_member, name: "nums", scope: !3, file: !3, line: 3, baseType: !13, size: 32, align: 32, offset: 64)
++  !13 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
++  !14 = !{i32 1, !"Debug Info Version", i32 3}
++  !15 = distinct !DISubprogram(name: "foobar", scope: !3, file: !3, line: 15, type: !16, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2)
++  !16 = !DISubroutineType(types: !17)
++  !17 = !{null}
++  !18 = !DILocalVariable(name: "sp", arg: 1, scope: !19, file: !3, line: 7, type: !24)
++  !19 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 8, type: !20, isLocal: false, isDefinition: true, scopeLine: 8, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, variables: !22)
++  !20 = !DISubroutineType(types: !21)
++  !21 = !{!13}
++  !22 = !{!18, !23}
++  !23 = !DILocalVariable(name: "nums", arg: 2, scope: !19, file: !3, line: 7, type: !13)
++  !24 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !2, baseType: !6, size: 64, align: 64)
++  !25 = !DILocation(line: 7, column: 13, scope: !19, inlinedAt: !26)
++  !26 = !DILocation(line: 16, column: 3, scope: !27)
++  !27 = distinct !DILexicalBlock(scope: !15, file: !3, line: 15, column: 15)
++  !32 = !DILocation(line: 17, column: 1, scope: !27)
++
++...
++---
++name:            foobar
++tracksRegLiveness: true
++body:             |
++  bb.0:
++    %1:gr64 = IMPLICIT_DEF
++    %2:gr64 = IMPLICIT_DEF
++
++  bb.1:
++    ; This DBG_VALUE will be discarded (use before def of %0).
++    DBG_VALUE debug-use %0, debug-use %noreg, !18, !DIExpression(), debug-location !25
++    %0:gr64 = IMPLICIT_DEF
++    %0:gr64 = IMPLICIT_DEF
++    %0:gr64 = IMPLICIT_DEF
++    %0:gr64 = IMPLICIT_DEF
++
++  bb.2:
++    ; This DBG_VALUE will be discarded (%1 is defined earlier, but it is not live in, so we do not know where %1 is stored).
++    DBG_VALUE debug-use %1, debug-use %noreg, !18, !DIExpression(), debug-location !25
++    %1:gr64 = IMPLICIT_DEF
++    %1:gr64 = IMPLICIT_DEF
++    %1:gr64 = IMPLICIT_DEF
++    %1:gr64 = IMPLICIT_DEF
++    ; This DBG_VALUE is kept, even if %1 is dead, it was defined in the prev instruction,
++    ; so the value should be available for as long as the register allocated to %1 is live.
++    DBG_VALUE debug-use %1, debug-use %noreg, !18, !DIExpression(), debug-location !25
++
++  bb.3:
++    %1:gr64 = IMPLICIT_DEF
++    DBG_VALUE 0, debug-use %noreg, !23, !DIExpression(), debug-location !25
++    ; This DBG_VALUE is kept, even if %1 is dead, it was defined in the prev non-dbg instruction,
++    ; so the value should be available for as long as the register allocated to %1 is live.
++    DBG_VALUE debug-use %1, debug-use %noreg, !18, !DIExpression(), debug-location !25
++
++  bb.4:
++    ; All DBG_VALUEs here should survive. %2 is livein as it was defined in bb.0, and it has use/def in the BTS64rr instruction.
++    DBG_VALUE debug-use %2, debug-use %noreg, !18, !DIExpression(), debug-location !25
++    %2:gr64 = BTS64rr %2, 0, implicit-def %eflags
++    DBG_VALUE 0, debug-use %noreg, !23, !DIExpression(), debug-location !25
++    DBG_VALUE debug-use %2, debug-use %noreg, !18, !DIExpression(), debug-location !25
++    %2:gr64 = BTS64rr %2, 0, implicit-def %eflags
++    DBG_VALUE debug-use %2, debug-use %noreg, !18, !DIExpression(), debug-location !25
++    %2:gr64 = BTS64rr %2, 0, implicit-def %eflags
++    DBG_VALUE debug-use %2, debug-use %noreg, !18, !DIExpression(), debug-location !25
++
++  bb.5:
++    RET 0, debug-location !32
++...
++
++# CHECK-LABEL: name: foobar
++
++# CHECK-LABEL: bb.1:
++## After solving https://bugs.llvm.org/show_bug.cgi?id=36579 we expect to get a
++##   DBG_VALUE debug-use %noreg
++## here.
++# CHECK-NOT:    DBG_VALUE
++
++# CHECK-LABEL: bb.2:
++## After solving https://bugs.llvm.org/show_bug.cgi?id=36579 we expect to get a
++##   DBG_VALUE debug-use %noreg
++## here.
++# CHECK-NOT:    DBG_VALUE
++# CHECK:        dead renamable %rcx = IMPLICIT_DEF
++# CHECK-NEXT:   dead renamable %rcx = IMPLICIT_DEF
++# CHECK-NEXT:   dead renamable %rcx = IMPLICIT_DEF
++# CHECK-NEXT:   dead renamable %rcx = IMPLICIT_DEF
++# CHECK-NEXT:   DBG_VALUE debug-use %rcx, debug-use %noreg, !18, !DIExpression()
++
++# CHECK-LABEL: bb.3:
++# CHECK:        dead renamable %rcx = IMPLICIT_DEF
++# CHECK-NEXT:   DBG_VALUE 0, debug-use %noreg, !23, !DIExpression()
++# CHECK-NEXT:   DBG_VALUE debug-use %rcx, debug-use %noreg, !18, !DIExpression()
++
++# CHECK-LABEL: bb.4:
++# CHECK:        liveins: %rax
++# CHECK:        DBG_VALUE debug-use %rax, debug-use %noreg, !18, !DIExpression()
++# CHECK-NEXT:   renamable %rax = BTS64rr killed renamable %rax, 0, implicit-def %eflags
++# CHECK-NEXT:   DBG_VALUE 0, debug-use %noreg, !23, !DIExpression()
++# CHECK-NEXT:   DBG_VALUE debug-use %rax, debug-use %noreg, !18, !DIExpression()
++# CHECK-NEXT:   renamable %rax = BTS64rr killed renamable %rax, 0, implicit-def %eflags
++# CHECK-NEXT:   DBG_VALUE debug-use %rax, debug-use %noreg, !18, !DIExpression()
++# CHECK-NEXT:   dead renamable %rax = BTS64rr killed renamable %rax, 0, implicit-def %eflags
++
++# CHECK-LABEL: bb.5:
++# CHECK-NEXT:   RET 0

Added: PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch
===================================================================
--- PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch	                        (rev 0)
+++ PR36417-fixup-for-rL326769-RegState-Debug-is-being-truncated.patch	2018-03-16 15:17:46 UTC (rev 308887)
@@ -0,0 +1,34 @@
+From 866cf8f3afa0224e31d36ca0351ac5cb0d303757 Mon Sep 17 00:00:00 2001
+From: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
+Date: Tue, 6 Mar 2018 13:23:28 +0000
+Subject: [PATCH] Fixup for rL326769 (RegState::Debug is being truncated to a
+ bool)
+
+I obviously messed up arguments to MachineOperand::CreateReg
+in rL326769. This should make it work as intended.
+
+Thanks to RKSimon for spotting this.
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326780 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/CodeGen/LiveDebugVariables.cpp | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/lib/CodeGen/LiveDebugVariables.cpp b/lib/CodeGen/LiveDebugVariables.cpp
+index f3fcd004defd..8c547cdcff33 100644
+--- a/lib/CodeGen/LiveDebugVariables.cpp
++++ b/lib/CodeGen/LiveDebugVariables.cpp
+@@ -557,8 +557,11 @@ bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) {
+       getUserValue(Var, Expr, MI.getDebugLoc());
+   if (!Discard)
+     UV->addDef(Idx, MI.getOperand(0), IsIndirect);
+-  else
+-    UV->addDef(Idx, MachineOperand::CreateReg(0U, RegState::Debug), false);
++  else {
++    MachineOperand MO = MachineOperand::CreateReg(0U, false);
++    MO.setIsDebug();
++    UV->addDef(Idx, MO, false);
++  }
+   return true;
+ }
+ 



More information about the arch-commits mailing list