Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Sep 2017 16:28:57 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r323088 - in vendor/llvm/dist: docs include/llvm/CodeGen lib/Analysis lib/CodeGen/SelectionDAG test/CodeGen/X86
Message-ID:  <201709011628.v81GSvKx095347@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Fri Sep  1 16:28:56 2017
New Revision: 323088
URL: https://svnweb.freebsd.org/changeset/base/323088

Log:
  Vendor import of llvm release_50 branch r312293:
  https://llvm.org/svn/llvm-project/llvm/branches/release_50@312293

Added:
  vendor/llvm/dist/test/CodeGen/X86/pr34137.ll
Modified:
  vendor/llvm/dist/docs/ReleaseNotes.rst
  vendor/llvm/dist/docs/index.rst
  vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h
  vendor/llvm/dist/lib/Analysis/PostDominators.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: vendor/llvm/dist/docs/ReleaseNotes.rst
==============================================================================
--- vendor/llvm/dist/docs/ReleaseNotes.rst	Fri Sep  1 15:54:53 2017	(r323087)
+++ vendor/llvm/dist/docs/ReleaseNotes.rst	Fri Sep  1 16:28:56 2017	(r323088)
@@ -5,12 +5,7 @@ LLVM 5.0.0 Release Notes
 .. contents::
     :local:
 
-.. warning::
-   These are in-progress notes for the upcoming LLVM 5 release.
-   Release notes for previous releases can be found on
-   `the Download Page <http://releases.llvm.org/download.html>`_.
 
-
 Introduction
 ============
 
@@ -26,55 +21,50 @@ have questions or comments, the `LLVM Developer's Mail
 <http://lists.llvm.org/mailman/listinfo/llvm-dev>`_ is a good place to send
 them.
 
-Note that if you are reading this file from a Subversion checkout or the main
-LLVM web page, this document applies to the *next* release, not the current
-one.  To see the release notes for a specific release, please see the `releases
-page <http://llvm.org/releases/>`_.
-
 Non-comprehensive list of changes in this release
 =================================================
-.. NOTE
-   For small 1-3 sentence descriptions, just add an entry at the end of
-   this list. If your description won't fit comfortably in one bullet
-   point (e.g. maybe you would like to give an example of the
-   functionality, or simply have a lot to talk about), see the `NOTE` below
-   for adding a new subsection.
 
 * LLVM's ``WeakVH`` has been renamed to ``WeakTrackingVH`` and a new ``WeakVH``
   has been introduced.  The new ``WeakVH`` nulls itself out on deletion, but
   does not track values across RAUW.
-  
+
 * A new library named ``BinaryFormat`` has been created which holds a collection
   of code which previously lived in ``Support``.  This includes the
   ``file_magic`` structure and ``identify_magic`` functions, as well as all the
   structure and type definitions for DWARF, ELF, COFF, WASM, and MachO file
   formats.
-  
+
 * The tool ``llvm-pdbdump`` has been renamed ``llvm-pdbutil`` to better reflect
   its nature as a general purpose PDB manipulation / diagnostics tool that does
   more than just dumping contents.
-  
+
 * The ``BBVectorize`` pass has been removed. It was fully replaced and no
   longer used back in 2014 but we didn't get around to removing it. Now it is
   gone. The SLP vectorizer is the suggested non-loop vectorization pass.
 
-.. NOTE
-   If you would like to document a larger change, then you can add a
-   subsection about it right here. You can copy the following boilerplate
-   and un-indent it (the indentation causes it to be inside this comment).
+* A new tool opt-viewer.py has been added to visualize optimization remarks in
+  HTML.  The tool processes the YAML files produced by clang with the
+  -fsave-optimization-record option.
 
-   Special New Feature
-   -------------------
+* A new CMake macro ``LLVM_REVERSE_ITERATION`` has been added. If enabled, all
+  supported unordered LLVM containers would be iterated in reverse order. This
+  is useful for uncovering non-determinism caused by iteration of unordered
+  containers. Currently, it supports reverse iteration of SmallPtrSet and
+  DenseMap.
 
-   Makes programs 10x faster by doing Special New Thing.
+* A new tool ``llvm-dlltool`` has been added to create short import libraries
+  from GNU style definition files. The tool utilizes the PE COFF SPEC Import
+  Library Format and PE COFF Auxiliary Weak Externals Format to achieve
+  compatibility with LLD and MSVC LINK.
 
+
 Changes to the LLVM IR
 ----------------------
 
 * The datalayout string may now indicate an address space to use for
-  the pointer type of alloca rather than the default of 0.
+  the pointer type of ``alloca`` rather than the default of 0.
 
-* Added speculatable attribute indicating a function which does has no
+* Added ``speculatable`` attribute indicating a function which has no
   side-effects which could inhibit hoisting of calls.
 
 Changes to the Arm Targets
@@ -108,9 +98,43 @@ During this release the ARM target has:
 Changes to the MIPS Target
 --------------------------
 
- During this release ...
+* The microMIPS64R6 backend is deprecated and will be removed in the next
+  release.
 
+* The MIPS backend now directly supports vector types for arguments and return
+  values (previously this required ABI specific LLVM IR).
 
+* Added documentation for how the MIPS backend handles address lowering.
+
+* Added a GCC compatible option -m(no-)madd4 to control the generation of four
+  operand multiply addition/subtraction instructions.
+
+* Added basic support for the XRay instrumentation system.
+
+* Added support for more assembly aliases and macros.
+
+* Added support for the ``micromips`` and ``nomicromips`` function attributes
+  which control micromips code generation on a per function basis.
+
+* Added the ``long-calls`` feature for non-pic environments. This feature is
+  used where the callee is out of range of the caller using a standard call
+  sequence. It must be enabled specifically.
+
+* Added support for performing microMIPS code generation via function
+  attributes.
+
+* Added experimental support for the static relocation model for the N64 ABI.
+
+* Added partial support for the MT ASE.
+
+* Added basic support for code size reduction for microMIPS.
+
+* Fixed numerous bugs including: multi-precision arithmetic support, various
+  vectorization bugs, debug information for thread local variables, debug
+  sections lacking the correct flags, crashing when disassembling sections
+  whose size is not a multiple of two or four.
+
+
 Changes to the PowerPC Target
 -----------------------------
 
@@ -118,26 +142,24 @@ Changes to the PowerPC Target
   vabsduw, modsw, moduw, modsd, modud, lxv, stxv, vextublx, vextubrx, vextuhlx,
   vextuhrx, vextuwlx, vextuwrx, vextsb2w, vextsb2d, vextsh2w, vextsh2d, and
   vextsw2d
-  
+
 * Implemented Optimal Code Sequences from The PowerPC Compiler Writer's Guide.
 
 * Enable -fomit-frame-pointer by default.
-  
+
 * Improved handling of bit reverse intrinsic.
-  
+
 * Improved handling of memcpy and memcmp functions.
-  
+
 * Improved handling of branches with static branch hints.
-  
+
 * Improved codegen for atomic load_acquire.
-  
+
 * Improved block placement during code layout
 
 * Many improvements to instruction selection and code generation
 
 
-
-
 Changes to the X86 Target
 -------------------------
 
@@ -173,6 +195,9 @@ Changes to the X86 Target
 
 * Fixed many inline assembly bugs.
 
+* Preliminary support for tracing NetBSD processes and core files with a single
+  thread in LLDB.
+
 Changes to the AMDGPU Target
 -----------------------------
 
@@ -187,21 +212,16 @@ required for compiling basic Rust programs.
 * Enable the branch relaxation pass so that we don't crash on large
   stack load/stores
 
-* Add support for lowering bit-rotations to the native `ror` and `rol`
+* Add support for lowering bit-rotations to the native ``ror`` and ``rol``
   instructions
 
 * Fix bug where function pointers were treated as pointers to RAM and not
   pointers to program memory
 
-* Fix broken code generaton for shift-by-variable expressions
+* Fix broken code generation for shift-by-variable expressions
 
 * Support zero-sized types in argument lists; this is impossible in C,
   but possible in Rust
-
-Changes to the OCaml bindings
------------------------------
-
- During this release ...
 
 
 Changes to the C API

Modified: vendor/llvm/dist/docs/index.rst
==============================================================================
--- vendor/llvm/dist/docs/index.rst	Fri Sep  1 15:54:53 2017	(r323087)
+++ vendor/llvm/dist/docs/index.rst	Fri Sep  1 16:28:56 2017	(r323088)
@@ -1,11 +1,6 @@
 Overview
 ========
 
-.. warning::
-
-   If you are using a released version of LLVM, see `the download page
-   <http://llvm.org/releases/>`_ to find your documentation.
-
 The LLVM compiler infrastructure supports a wide range of projects, from
 industrial strength compilers to specialized JIT applications to small
 research projects.

Modified: vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h
==============================================================================
--- vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h	Fri Sep  1 15:54:53 2017	(r323087)
+++ vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h	Fri Sep  1 16:28:56 2017	(r323088)
@@ -801,7 +801,8 @@ class SDNode : public FoldingSetNode, public ilist_nod
   /// if DAG changes.
   static bool hasPredecessorHelper(const SDNode *N,
                                    SmallPtrSetImpl<const SDNode *> &Visited,
-                                   SmallVectorImpl<const SDNode *> &Worklist) {
+                                   SmallVectorImpl<const SDNode *> &Worklist,
+                                   unsigned int MaxSteps = 0) {
     if (Visited.count(N))
       return true;
     while (!Worklist.empty()) {
@@ -816,6 +817,8 @@ class SDNode : public FoldingSetNode, public ilist_nod
       }
       if (Found)
         return true;
+      if (MaxSteps != 0 && Visited.size() >= MaxSteps)
+        return false;
     }
     return false;
   }

Modified: vendor/llvm/dist/lib/Analysis/PostDominators.cpp
==============================================================================
--- vendor/llvm/dist/lib/Analysis/PostDominators.cpp	Fri Sep  1 15:54:53 2017	(r323087)
+++ vendor/llvm/dist/lib/Analysis/PostDominators.cpp	Fri Sep  1 16:28:56 2017	(r323088)
@@ -23,8 +23,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "postdomtree"
 
-template class llvm::DominatorTreeBase<BasicBlock, true>; // PostDomTreeBase
-
 //===----------------------------------------------------------------------===//
 //  PostDominatorTree Implementation
 //===----------------------------------------------------------------------===//

Modified: vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
==============================================================================
--- vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Sep  1 15:54:53 2017	(r323087)
+++ vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Fri Sep  1 16:28:56 2017	(r323088)
@@ -1118,22 +1118,30 @@ SDValue DAGCombiner::PromoteIntBinOp(SDValue Op) {
     SDValue RV =
         DAG.getNode(ISD::TRUNCATE, DL, VT, DAG.getNode(Opc, DL, PVT, NN0, NN1));
 
-    // New replace instances of N0 and N1
-    if (Replace0 && N0 && N0.getOpcode() != ISD::DELETED_NODE && NN0 &&
-        NN0.getOpcode() != ISD::DELETED_NODE) {
+    // We are always replacing N0/N1's use in N and only need
+    // additional replacements if there are additional uses.
+    Replace0 &= !N0->hasOneUse();
+    Replace1 &= (N0 != N1) && !N1->hasOneUse();
+
+    // Combine Op here so it is presreved past replacements.
+    CombineTo(Op.getNode(), RV);
+
+    // If operands have a use ordering, make sur we deal with
+    // predecessor first.
+    if (Replace0 && Replace1 && N0.getNode()->isPredecessorOf(N1.getNode())) {
+      std::swap(N0, N1);
+      std::swap(NN0, NN1);
+    }
+
+    if (Replace0) {
       AddToWorklist(NN0.getNode());
       ReplaceLoadWithPromotedLoad(N0.getNode(), NN0.getNode());
     }
-
-    if (Replace1 && N1 && N1.getOpcode() != ISD::DELETED_NODE && NN1 &&
-        NN1.getOpcode() != ISD::DELETED_NODE) {
+    if (Replace1) {
       AddToWorklist(NN1.getNode());
       ReplaceLoadWithPromotedLoad(N1.getNode(), NN1.getNode());
     }
-
-    // Deal with Op being deleted.
-    if (Op && Op.getOpcode() != ISD::DELETED_NODE)
-      return RV;
+    return Op;
   }
   return SDValue();
 }
@@ -12599,25 +12607,37 @@ void DAGCombiner::getStoreMergeCandidates(
         }
 }
 
-// We need to check that merging these stores does not cause a loop
-// in the DAG. Any store candidate may depend on another candidate
+// We need to check that merging these stores does not cause a loop in
+// the DAG. Any store candidate may depend on another candidate
 // indirectly through its operand (we already consider dependencies
 // through the chain). Check in parallel by searching up from
 // non-chain operands of candidates.
+
 bool DAGCombiner::checkMergeStoreCandidatesForDependencies(
     SmallVectorImpl<MemOpLink> &StoreNodes, unsigned NumStores) {
+
+  // FIXME: We should be able to truncate a full search of
+  // predecessors by doing a BFS and keeping tabs the originating
+  // stores from which worklist nodes come from in a similar way to
+  // TokenFactor simplfication.
+
   SmallPtrSet<const SDNode *, 16> Visited;
   SmallVector<const SDNode *, 8> Worklist;
-  // search ops of store candidates
+  unsigned int Max = 8192;
+  // Search Ops of store candidates.
   for (unsigned i = 0; i < NumStores; ++i) {
     SDNode *n = StoreNodes[i].MemNode;
     // Potential loops may happen only through non-chain operands
     for (unsigned j = 1; j < n->getNumOperands(); ++j)
       Worklist.push_back(n->getOperand(j).getNode());
   }
-  // search through DAG. We can stop early if we find a storenode
+  // Search through DAG. We can stop early if we find a store node.
   for (unsigned i = 0; i < NumStores; ++i) {
-    if (SDNode::hasPredecessorHelper(StoreNodes[i].MemNode, Visited, Worklist))
+    if (SDNode::hasPredecessorHelper(StoreNodes[i].MemNode, Visited, Worklist,
+                                     Max))
+      return false;
+    // Check if we ended early, failing conservatively if so.
+    if (Visited.size() >= Max)
       return false;
   }
   return true;

Added: vendor/llvm/dist/test/CodeGen/X86/pr34137.ll
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ vendor/llvm/dist/test/CodeGen/X86/pr34137.ll	Fri Sep  1 16:28:56 2017	(r323088)
@@ -0,0 +1,53 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
+
+@var_3 = external global i16, align 2
+@var_13 = external global i16, align 2
+@var_212 = external global i64, align 8
+
+define void @pr34127() {
+; CHECK-LABEL: pr34127:
+; CHECK:       # BB#0: # %entry
+; CHECK-NEXT:    movzwl {{.*}}(%rip), %eax
+; CHECK-NEXT:    movw {{.*}}(%rip), %cx
+; CHECK-NEXT:    andw %ax, %cx
+; CHECK-NEXT:    andl %eax, %ecx
+; CHECK-NEXT:    movl %ecx, -{{[0-9]+}}(%rsp)
+; CHECK-NEXT:    xorl %edx, %edx
+; CHECK-NEXT:    testw %cx, %cx
+; CHECK-NEXT:    sete %dl
+; CHECK-NEXT:    andl %eax, %edx
+; CHECK-NEXT:    movq %rdx, {{.*}}(%rip)
+; CHECK-NEXT:    movw $0, (%rax)
+; CHECK-NEXT:    retq
+entry:
+  %a = alloca i32, align 4
+  %0 = load i16, i16* @var_3, align 2
+  %conv = zext i16 %0 to i32
+  %1 = load i16, i16* @var_3, align 2
+  %conv1 = zext i16 %1 to i32
+  %2 = load i16, i16* @var_13, align 2
+  %conv2 = zext i16 %2 to i32
+  %and = and i32 %conv1, %conv2
+  %and3 = and i32 %conv, %and
+  store i32 %and3, i32* %a, align 4
+  %3 = load i16, i16* @var_3, align 2
+  %conv4 = zext i16 %3 to i32
+  %4 = load i16, i16* @var_3, align 2
+  %conv5 = zext i16 %4 to i32
+  %5 = load i16, i16* @var_13, align 2
+  %conv6 = zext i16 %5 to i32
+  %and7 = and i32 %conv5, %conv6
+  %and8 = and i32 %conv4, %and7
+  %tobool = icmp ne i32 %and8, 0
+  %lnot = xor i1 %tobool, true
+  %conv9 = zext i1 %lnot to i32
+  %6 = load i16, i16* @var_3, align 2
+  %conv10 = zext i16 %6 to i32
+  %and11 = and i32 %conv9, %conv10
+  %conv12 = sext i32 %and11 to i64
+  store i64 %conv12, i64* @var_212, align 8
+  %conv14 = zext i1 undef to i16
+  store i16 %conv14, i16* undef, align 2
+  ret void
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709011628.v81GSvKx095347>