Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Aug 2016 19:41:29 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r304310 - in projects/clang390-import/contrib/llvm: . include/llvm-c include/llvm/ADT include/llvm/Analysis include/llvm/CodeGen include/llvm/IR include/llvm/Target lib/Analysis lib/Cod...
Message-ID:  <201608171941.u7HJfTVF083741@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Aug 17 19:41:29 2016
New Revision: 304310
URL: https://svnweb.freebsd.org/changeset/base/304310

Log:
  Update llvm to release_39 branch r278877.

Added:
  projects/clang390-import/contrib/llvm/lib/IR/AttributeSetNode.h
     - copied unchanged from r304309, vendor/llvm/dist/lib/IR/AttributeSetNode.h
Modified:
  projects/clang390-import/contrib/llvm/LICENSE.TXT
  projects/clang390-import/contrib/llvm/include/llvm-c/Core.h
  projects/clang390-import/contrib/llvm/include/llvm/ADT/GraphTraits.h
  projects/clang390-import/contrib/llvm/include/llvm/ADT/SCCIterator.h
  projects/clang390-import/contrib/llvm/include/llvm/ADT/STLExtras.h
  projects/clang390-import/contrib/llvm/include/llvm/ADT/Triple.h
  projects/clang390-import/contrib/llvm/include/llvm/ADT/iterator.h
  projects/clang390-import/contrib/llvm/include/llvm/Analysis/CallGraph.h
  projects/clang390-import/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
  projects/clang390-import/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h
  projects/clang390-import/contrib/llvm/include/llvm/IR/Attributes.h
  projects/clang390-import/contrib/llvm/include/llvm/IR/CFG.h
  projects/clang390-import/contrib/llvm/include/llvm/IR/IntrinsicsX86.td
  projects/clang390-import/contrib/llvm/include/llvm/Target/TargetLowering.h
  projects/clang390-import/contrib/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
  projects/clang390-import/contrib/llvm/lib/Analysis/ConstantFolding.cpp
  projects/clang390-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp
  projects/clang390-import/contrib/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp
  projects/clang390-import/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStack.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackColoring.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackLayout.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  projects/clang390-import/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
  projects/clang390-import/contrib/llvm/lib/IR/AttributeImpl.h
  projects/clang390-import/contrib/llvm/lib/IR/AutoUpgrade.cpp
  projects/clang390-import/contrib/llvm/lib/IR/Core.cpp
  projects/clang390-import/contrib/llvm/lib/IR/Metadata.cpp
  projects/clang390-import/contrib/llvm/lib/Support/Triple.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AArch64/AArch64.td
  projects/clang390-import/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPU.h
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUIntrinsicInfo.h
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/R600ISelLowering.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/R600ISelLowering.h
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIDefines.h
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIISelLowering.h
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIInstrFormats.td
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIInstrInfo.h
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIInstrInfo.td
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIInstructions.td
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIIntrinsics.td
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
  projects/clang390-import/contrib/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
  projects/clang390-import/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp
  projects/clang390-import/contrib/llvm/lib/Target/ARM/ARMInstrInfo.td
  projects/clang390-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td
  projects/clang390-import/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
  projects/clang390-import/contrib/llvm/lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
  projects/clang390-import/contrib/llvm/lib/Target/Mips/MipsTargetMachine.cpp
  projects/clang390-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp
  projects/clang390-import/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp
  projects/clang390-import/contrib/llvm/lib/Target/X86/X86InstrInfo.h
  projects/clang390-import/contrib/llvm/lib/Target/X86/X86InstrSSE.td
  projects/clang390-import/contrib/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/IPO/GlobalOpt.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Scalar/ConstantProp.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Scalar/EarlyCSE.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Scalar/LICM.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Utils/CloneFunction.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Utils/InlineFunction.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Utils/LCSSA.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Utils/LoopSimplify.cpp
  projects/clang390-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Directory Properties:
  projects/clang390-import/contrib/llvm/   (props changed)

Modified: projects/clang390-import/contrib/llvm/LICENSE.TXT
==============================================================================
--- projects/clang390-import/contrib/llvm/LICENSE.TXT	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/LICENSE.TXT	Wed Aug 17 19:41:29 2016	(r304310)
@@ -61,8 +61,6 @@ licenses, and/or restrictions:
 
 Program             Directory
 -------             ---------
-Autoconf            llvm/autoconf
-                    llvm/projects/ModuleMaker/autoconf
 Google Test         llvm/utils/unittest/googletest
 OpenBSD regex       llvm/lib/Support/{reg*, COPYRIGHT.regex}
 pyyaml tests        llvm/test/YAMLParser/{*.data, LICENSE.TXT}

Modified: projects/clang390-import/contrib/llvm/include/llvm-c/Core.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm-c/Core.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm-c/Core.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -2014,6 +2014,9 @@ void LLVMAddFunctionAttr(LLVMValueRef Fn
 
 void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx,
                              LLVMAttributeRef A);
+unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx);
+void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx,
+                              LLVMAttributeRef *Attrs);
 LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F,
                                              LLVMAttributeIndex Idx,
                                              unsigned KindID);
@@ -2600,6 +2603,9 @@ void LLVMSetInstrParamAlignment(LLVMValu
 
 void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx,
                               LLVMAttributeRef A);
+unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, LLVMAttributeIndex Idx);
+void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx,
+                               LLVMAttributeRef *Attrs);
 LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C,
                                               LLVMAttributeIndex Idx,
                                               unsigned KindID);

Modified: projects/clang390-import/contrib/llvm/include/llvm/ADT/GraphTraits.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/ADT/GraphTraits.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/ADT/GraphTraits.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -27,19 +27,24 @@ template<class GraphType>
 struct GraphTraits {
   // Elements to provide:
 
+  // NOTICE: We are in a transition from migration interfaces that require
+  // NodeType *, to NodeRef. NodeRef is required to be cheap to copy, but does
+  // not have to be a raw pointer. In the transition, user should define
+  // NodeType, and NodeRef = NodeType *.
+  //
   // typedef NodeType          - Type of Node in the graph
+  // typedef NodeRef           - NodeType *
   // typedef ChildIteratorType - Type used to iterate over children in graph
 
-  // static NodeType *getEntryNode(const GraphType &)
+  // static NodeRef getEntryNode(const GraphType &)
   //    Return the entry node of the graph
 
-  // static ChildIteratorType child_begin(NodeType *)
-  // static ChildIteratorType child_end  (NodeType *)
+  // static ChildIteratorType child_begin(NodeRef)
+  // static ChildIteratorType child_end  (NodeRef)
   //    Return iterators that point to the beginning and ending of the child
   //    node list for the specified node.
   //
 
-
   // typedef  ...iterator nodes_iterator;
   // static nodes_iterator nodes_begin(GraphType *G)
   // static nodes_iterator nodes_end  (GraphType *G)
@@ -57,7 +62,7 @@ struct GraphTraits {
   // your argument to XXX_begin(...) is unknown or needs to have the proper .h
   // file #include'd.
   //
-  typedef typename GraphType::UnknownGraphTypeError NodeType;
+  typedef typename GraphType::UnknownGraphTypeError NodeRef;
 };
 
 

Modified: projects/clang390-import/contrib/llvm/include/llvm/ADT/SCCIterator.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/ADT/SCCIterator.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/ADT/SCCIterator.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -37,23 +37,22 @@ namespace llvm {
 /// build up a vector of nodes in a particular SCC. Note that it is a forward
 /// iterator and thus you cannot backtrack or re-visit nodes.
 template <class GraphT, class GT = GraphTraits<GraphT>>
-class scc_iterator
-    : public iterator_facade_base<
-          scc_iterator<GraphT, GT>, std::forward_iterator_tag,
-          const std::vector<typename GT::NodeType *>, ptrdiff_t> {
-  typedef typename GT::NodeType NodeType;
+class scc_iterator : public iterator_facade_base<
+                         scc_iterator<GraphT, GT>, std::forward_iterator_tag,
+                         const std::vector<typename GT::NodeRef>, ptrdiff_t> {
+  typedef typename GT::NodeRef NodeRef;
   typedef typename GT::ChildIteratorType ChildItTy;
-  typedef std::vector<NodeType *> SccTy;
+  typedef std::vector<NodeRef> SccTy;
   typedef typename scc_iterator::reference reference;
 
   /// Element of VisitStack during DFS.
   struct StackElement {
-    NodeType *Node;       ///< The current node pointer.
+    NodeRef Node;         ///< The current node pointer.
     ChildItTy NextChild;  ///< The next child, modified inplace during DFS.
     unsigned MinVisited;  ///< Minimum uplink value of all children of Node.
 
-    StackElement(NodeType *Node, const ChildItTy &Child, unsigned Min)
-      : Node(Node), NextChild(Child), MinVisited(Min) {}
+    StackElement(NodeRef Node, const ChildItTy &Child, unsigned Min)
+        : Node(Node), NextChild(Child), MinVisited(Min) {}
 
     bool operator==(const StackElement &Other) const {
       return Node == Other.Node &&
@@ -67,10 +66,10 @@ class scc_iterator
   ///
   /// nodeVisitNumbers are per-node visit numbers, also used as DFS flags.
   unsigned visitNum;
-  DenseMap<NodeType *, unsigned> nodeVisitNumbers;
+  DenseMap<NodeRef, unsigned> nodeVisitNumbers;
 
   /// Stack holding nodes of the SCC.
-  std::vector<NodeType *> SCCNodeStack;
+  std::vector<NodeRef> SCCNodeStack;
 
   /// The current SCC, retrieved using operator*().
   SccTy CurrentSCC;
@@ -80,7 +79,7 @@ class scc_iterator
   std::vector<StackElement> VisitStack;
 
   /// A single "visit" within the non-recursive DFS traversal.
-  void DFSVisitOne(NodeType *N);
+  void DFSVisitOne(NodeRef N);
 
   /// The stack-based DFS traversal; defined below.
   void DFSVisitChildren();
@@ -88,7 +87,7 @@ class scc_iterator
   /// Compute the next SCC using the DFS traversal.
   void GetNextSCC();
 
-  scc_iterator(NodeType *entryN) : visitNum(0) {
+  scc_iterator(NodeRef entryN) : visitNum(0) {
     DFSVisitOne(entryN);
     GetNextSCC();
   }
@@ -131,7 +130,7 @@ public:
 
   /// This informs the \c scc_iterator that the specified \c Old node
   /// has been deleted, and \c New is to be used in its place.
-  void ReplaceNode(NodeType *Old, NodeType *New) {
+  void ReplaceNode(NodeRef Old, NodeRef New) {
     assert(nodeVisitNumbers.count(Old) && "Old not in scc_iterator?");
     nodeVisitNumbers[New] = nodeVisitNumbers[Old];
     nodeVisitNumbers.erase(Old);
@@ -139,7 +138,7 @@ public:
 };
 
 template <class GraphT, class GT>
-void scc_iterator<GraphT, GT>::DFSVisitOne(NodeType *N) {
+void scc_iterator<GraphT, GT>::DFSVisitOne(NodeRef N) {
   ++visitNum;
   nodeVisitNumbers[N] = visitNum;
   SCCNodeStack.push_back(N);
@@ -155,8 +154,8 @@ void scc_iterator<GraphT, GT>::DFSVisitC
   assert(!VisitStack.empty());
   while (VisitStack.back().NextChild != GT::child_end(VisitStack.back().Node)) {
     // TOS has at least one more child so continue DFS
-    NodeType *childN = *VisitStack.back().NextChild++;
-    typename DenseMap<NodeType *, unsigned>::iterator Visited =
+    NodeRef childN = *VisitStack.back().NextChild++;
+    typename DenseMap<NodeRef, unsigned>::iterator Visited =
         nodeVisitNumbers.find(childN);
     if (Visited == nodeVisitNumbers.end()) {
       // this node has never been seen.
@@ -176,7 +175,7 @@ template <class GraphT, class GT> void s
     DFSVisitChildren();
 
     // Pop the leaf on top of the VisitStack.
-    NodeType *visitingN = VisitStack.back().Node;
+    NodeRef visitingN = VisitStack.back().Node;
     unsigned minVisitNum = VisitStack.back().MinVisited;
     assert(VisitStack.back().NextChild == GT::child_end(visitingN));
     VisitStack.pop_back();
@@ -212,7 +211,7 @@ bool scc_iterator<GraphT, GT>::hasLoop()
     assert(!CurrentSCC.empty() && "Dereferencing END SCC iterator!");
     if (CurrentSCC.size() > 1)
       return true;
-    NodeType *N = CurrentSCC.front();
+    NodeRef N = CurrentSCC.front();
     for (ChildItTy CI = GT::child_begin(N), CE = GT::child_end(N); CI != CE;
          ++CI)
       if (*CI == N)

Modified: projects/clang390-import/contrib/llvm/include/llvm/ADT/STLExtras.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/ADT/STLExtras.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/ADT/STLExtras.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -26,10 +26,18 @@
 #include <memory>
 #include <utility> // for std::pair
 
+#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Compiler.h"
 
 namespace llvm {
+namespace detail {
+
+template <typename RangeT>
+using IterOfRange = decltype(std::begin(std::declval<RangeT>()));
+
+} // End detail namespace
 
 //===----------------------------------------------------------------------===//
 //     Extra additions to <functional>
@@ -235,6 +243,90 @@ auto reverse(
                     llvm::make_reverse_iterator(std::begin(C)));
 }
 
+/// An iterator adaptor that filters the elements of given inner iterators.
+///
+/// The predicate parameter should be a callable object that accepts the wrapped
+/// iterator's reference type and returns a bool. When incrementing or
+/// decrementing the iterator, it will call the predicate on each element and
+/// skip any where it returns false.
+///
+/// \code
+///   int A[] = { 1, 2, 3, 4 };
+///   auto R = make_filter_range(A, [](int N) { return N % 2 == 1; });
+///   // R contains { 1, 3 }.
+/// \endcode
+template <typename WrappedIteratorT, typename PredicateT>
+class filter_iterator
+    : public iterator_adaptor_base<
+          filter_iterator<WrappedIteratorT, PredicateT>, WrappedIteratorT,
+          typename std::common_type<
+              std::forward_iterator_tag,
+              typename std::iterator_traits<
+                  WrappedIteratorT>::iterator_category>::type> {
+  using BaseT = iterator_adaptor_base<
+      filter_iterator<WrappedIteratorT, PredicateT>, WrappedIteratorT,
+      typename std::common_type<
+          std::forward_iterator_tag,
+          typename std::iterator_traits<WrappedIteratorT>::iterator_category>::
+          type>;
+
+  struct PayloadType {
+    WrappedIteratorT End;
+    PredicateT Pred;
+  };
+
+  Optional<PayloadType> Payload;
+
+  void findNextValid() {
+    assert(Payload && "Payload should be engaged when findNextValid is called");
+    while (this->I != Payload->End && !Payload->Pred(*this->I))
+      BaseT::operator++();
+  }
+
+  // Construct the begin iterator. The begin iterator requires to know where end
+  // is, so that it can properly stop when it hits end.
+  filter_iterator(WrappedIteratorT Begin, WrappedIteratorT End, PredicateT Pred)
+      : BaseT(std::move(Begin)),
+        Payload(PayloadType{std::move(End), std::move(Pred)}) {
+    findNextValid();
+  }
+
+  // Construct the end iterator. It's not incrementable, so Payload doesn't
+  // have to be engaged.
+  filter_iterator(WrappedIteratorT End) : BaseT(End) {}
+
+public:
+  using BaseT::operator++;
+
+  filter_iterator &operator++() {
+    BaseT::operator++();
+    findNextValid();
+    return *this;
+  }
+
+  template <typename RT, typename PT>
+  friend iterator_range<filter_iterator<detail::IterOfRange<RT>, PT>>
+  make_filter_range(RT &&, PT);
+};
+
+/// Convenience function that takes a range of elements and a predicate,
+/// and return a new filter_iterator range.
+///
+/// FIXME: Currently if RangeT && is a rvalue reference to a temporary, the
+/// lifetime of that temporary is not kept by the returned range object, and the
+/// temporary is going to be dropped on the floor after the make_iterator_range
+/// full expression that contains this function call.
+template <typename RangeT, typename PredicateT>
+iterator_range<filter_iterator<detail::IterOfRange<RangeT>, PredicateT>>
+make_filter_range(RangeT &&Range, PredicateT Pred) {
+  using FilterIteratorT =
+      filter_iterator<detail::IterOfRange<RangeT>, PredicateT>;
+  return make_range(FilterIteratorT(std::begin(std::forward<RangeT>(Range)),
+                                    std::end(std::forward<RangeT>(Range)),
+                                    std::move(Pred)),
+                    FilterIteratorT(std::end(std::forward<RangeT>(Range))));
+}
+
 //===----------------------------------------------------------------------===//
 //     Extra additions to <utility>
 //===----------------------------------------------------------------------===//

Modified: projects/clang390-import/contrib/llvm/include/llvm/ADT/Triple.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/ADT/Triple.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/ADT/Triple.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -174,6 +174,7 @@ public:
     UnknownEnvironment,
 
     GNU,
+    GNUABI64,
     GNUEABI,
     GNUEABIHF,
     GNUX32,
@@ -476,8 +477,9 @@ public:
 
   bool isGNUEnvironment() const {
     EnvironmentType Env = getEnvironment();
-    return Env == Triple::GNU || Env == Triple::GNUEABI ||
-           Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
+    return Env == Triple::GNU || Env == Triple::GNUABI64 ||
+           Env == Triple::GNUEABI || Env == Triple::GNUEABIHF ||
+           Env == Triple::GNUX32;
   }
 
   /// Checks if the environment could be MSVC.

Modified: projects/clang390-import/contrib/llvm/include/llvm/ADT/iterator.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/ADT/iterator.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/ADT/iterator.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -155,7 +155,14 @@ template <
     typename T = typename std::iterator_traits<WrappedIteratorT>::value_type,
     typename DifferenceTypeT =
         typename std::iterator_traits<WrappedIteratorT>::difference_type,
-    typename PointerT = T *, typename ReferenceT = T &,
+    typename PointerT = typename std::conditional<
+        std::is_same<T, typename std::iterator_traits<
+                            WrappedIteratorT>::value_type>::value,
+        typename std::iterator_traits<WrappedIteratorT>::pointer, T *>::type,
+    typename ReferenceT = typename std::conditional<
+        std::is_same<T, typename std::iterator_traits<
+                            WrappedIteratorT>::value_type>::value,
+        typename std::iterator_traits<WrappedIteratorT>::reference, T &>::type,
     // Don't provide these, they are mostly to act as aliases below.
     typename WrappedTraitsT = std::iterator_traits<WrappedIteratorT>>
 class iterator_adaptor_base
@@ -168,15 +175,7 @@ protected:
 
   iterator_adaptor_base() = default;
 
-  template <typename U>
-  explicit iterator_adaptor_base(
-      U &&u,
-      typename std::enable_if<
-          !std::is_base_of<typename std::remove_cv<
-                               typename std::remove_reference<U>::type>::type,
-                           DerivedT>::value,
-          int>::type = 0)
-      : I(std::forward<U &&>(u)) {}
+  explicit iterator_adaptor_base(WrappedIteratorT u) : I(std::move(u)) {}
 
   const WrappedIteratorT &wrapped() const { return I; }
 

Modified: projects/clang390-import/contrib/llvm/include/llvm/Analysis/CallGraph.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/Analysis/CallGraph.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/Analysis/CallGraph.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -410,6 +410,7 @@ public:
 // traversals.
 template <> struct GraphTraits<CallGraphNode *> {
   typedef CallGraphNode NodeType;
+  typedef CallGraphNode *NodeRef;
 
   typedef CallGraphNode::CallRecord CGNPairTy;
   typedef std::pointer_to_unary_function<CGNPairTy, CallGraphNode *>
@@ -431,6 +432,7 @@ template <> struct GraphTraits<CallGraph
 
 template <> struct GraphTraits<const CallGraphNode *> {
   typedef const CallGraphNode NodeType;
+  typedef const CallGraphNode *NodeRef;
 
   typedef CallGraphNode::CallRecord CGNPairTy;
   typedef std::pointer_to_unary_function<CGNPairTy, const CallGraphNode *>

Modified: projects/clang390-import/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/Analysis/ScalarEvolutionExpander.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -196,6 +196,13 @@ namespace llvm {
     /// block.
     Value *expandCodeFor(const SCEV *SH, Type *Ty, Instruction *I);
 
+    /// \brief Insert code to directly compute the specified SCEV expression
+    /// into the program.  The inserted code is inserted into the SCEVExpander's
+    /// current insertion point. If a type is specified, the result will be
+    /// expanded to have that type, with a cast if necessary.
+    Value *expandCodeFor(const SCEV *SH, Type *Ty = nullptr);
+
+
     /// \brief Generates a code sequence that evaluates this predicate.
     /// The inserted instructions will be at position \p Loc.
     /// The result will be of type i1 and will have a value of 0 when the
@@ -253,6 +260,15 @@ namespace llvm {
 
     void enableLSRMode() { LSRMode = true; }
 
+    /// \brief Set the current insertion point. This is useful if multiple calls
+    /// to expandCodeFor() are going to be made with the same insert point and
+    /// the insert point may be moved during one of the expansions (e.g. if the
+    /// insert point is not a block terminator).
+    void setInsertPoint(Instruction *IP) {
+      assert(IP);
+      Builder.SetInsertPoint(IP);
+    }
+
     /// \brief Clear the current insertion point. This is useful if the
     /// instruction that had been serving as the insertion point may have been
     /// deleted.
@@ -313,12 +329,6 @@ namespace llvm {
 
     Value *expand(const SCEV *S);
 
-    /// \brief Insert code to directly compute the specified SCEV expression
-    /// into the program.  The inserted code is inserted into the SCEVExpander's
-    /// current insertion point. If a type is specified, the result will be
-    /// expanded to have that type, with a cast if necessary.
-    Value *expandCodeFor(const SCEV *SH, Type *Ty = nullptr);
-
     /// \brief Determine the most "relevant" loop for the given SCEV.
     const Loop *getRelevantLoop(const SCEV *);
 

Modified: projects/clang390-import/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -740,6 +740,7 @@ struct MBB2NumberFunctor :
 
 template <> struct GraphTraits<MachineBasicBlock *> {
   typedef MachineBasicBlock NodeType;
+  typedef MachineBasicBlock *NodeRef;
   typedef MachineBasicBlock::succ_iterator ChildIteratorType;
 
   static NodeType *getEntryNode(MachineBasicBlock *BB) { return BB; }
@@ -753,6 +754,7 @@ template <> struct GraphTraits<MachineBa
 
 template <> struct GraphTraits<const MachineBasicBlock *> {
   typedef const MachineBasicBlock NodeType;
+  typedef const MachineBasicBlock *NodeRef;
   typedef MachineBasicBlock::const_succ_iterator ChildIteratorType;
 
   static NodeType *getEntryNode(const MachineBasicBlock *BB) { return BB; }
@@ -772,6 +774,7 @@ template <> struct GraphTraits<const Mac
 //
 template <> struct GraphTraits<Inverse<MachineBasicBlock*> > {
   typedef MachineBasicBlock NodeType;
+  typedef MachineBasicBlock *NodeRef;
   typedef MachineBasicBlock::pred_iterator ChildIteratorType;
   static NodeType *getEntryNode(Inverse<MachineBasicBlock *> G) {
     return G.Graph;
@@ -786,6 +789,7 @@ template <> struct GraphTraits<Inverse<M
 
 template <> struct GraphTraits<Inverse<const MachineBasicBlock*> > {
   typedef const MachineBasicBlock NodeType;
+  typedef const MachineBasicBlock *NodeRef;
   typedef MachineBasicBlock::const_pred_iterator ChildIteratorType;
   static NodeType *getEntryNode(Inverse<const MachineBasicBlock*> G) {
     return G.Graph;

Modified: projects/clang390-import/contrib/llvm/include/llvm/IR/Attributes.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/IR/Attributes.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/IR/Attributes.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -210,6 +210,7 @@ public:
 private:
   friend class AttrBuilder;
   friend class AttributeSetImpl;
+  friend class AttributeSetNode;
   template <typename Ty> friend struct DenseMapInfo;
 
   /// \brief The attributes that we are managing. This can be null to represent

Modified: projects/clang390-import/contrib/llvm/include/llvm/IR/CFG.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/IR/CFG.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/IR/CFG.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -155,6 +155,7 @@ struct isPodLike<TerminatorInst::SuccIte
 
 template <> struct GraphTraits<BasicBlock*> {
   typedef BasicBlock NodeType;
+  typedef BasicBlock *NodeRef;
   typedef succ_iterator ChildIteratorType;
 
   static NodeType *getEntryNode(BasicBlock *BB) { return BB; }
@@ -168,6 +169,7 @@ template <> struct GraphTraits<BasicBloc
 
 template <> struct GraphTraits<const BasicBlock*> {
   typedef const BasicBlock NodeType;
+  typedef const BasicBlock *NodeRef;
   typedef succ_const_iterator ChildIteratorType;
 
   static NodeType *getEntryNode(const BasicBlock *BB) { return BB; }
@@ -187,6 +189,7 @@ template <> struct GraphTraits<const Bas
 //
 template <> struct GraphTraits<Inverse<BasicBlock*> > {
   typedef BasicBlock NodeType;
+  typedef BasicBlock *NodeRef;
   typedef pred_iterator ChildIteratorType;
   static NodeType *getEntryNode(Inverse<BasicBlock *> G) { return G.Graph; }
   static inline ChildIteratorType child_begin(NodeType *N) {
@@ -199,6 +202,7 @@ template <> struct GraphTraits<Inverse<B
 
 template <> struct GraphTraits<Inverse<const BasicBlock*> > {
   typedef const BasicBlock NodeType;
+  typedef const BasicBlock *NodeRef;
   typedef const_pred_iterator ChildIteratorType;
   static NodeType *getEntryNode(Inverse<const BasicBlock*> G) {
     return G.Graph;

Modified: projects/clang390-import/contrib/llvm/include/llvm/IR/IntrinsicsX86.td
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/IR/IntrinsicsX86.td	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/IR/IntrinsicsX86.td	Wed Aug 17 19:41:29 2016	(r304310)
@@ -479,6 +479,8 @@ let TargetPrefix = "x86" in {  // All in
               Intrinsic<[llvm_v4f32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
   def int_x86_sse2_cvtps2dq : GCCBuiltin<"__builtin_ia32_cvtps2dq">,
               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
+  def int_x86_sse2_cvttps2dq : GCCBuiltin<"__builtin_ia32_cvttps2dq">,
+              Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
   def int_x86_sse2_cvtsd2si : GCCBuiltin<"__builtin_ia32_cvtsd2si">,
               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
   def int_x86_sse2_cvtsd2si64 : GCCBuiltin<"__builtin_ia32_cvtsd2si64">,
@@ -1512,8 +1514,12 @@ let TargetPrefix = "x86" in {  // All in
         Intrinsic<[llvm_v4f32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   def int_x86_avx_cvt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvtps2dq256">,
         Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
+  def int_x86_avx_cvtt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvttpd2dq256">,
+        Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   def int_x86_avx_cvt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvtpd2dq256">,
         Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
+  def int_x86_avx_cvtt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvttps2dq256">,
+        Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
 }
 
 // Vector bit test

Modified: projects/clang390-import/contrib/llvm/include/llvm/Target/TargetLowering.h
==============================================================================
--- projects/clang390-import/contrib/llvm/include/llvm/Target/TargetLowering.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/include/llvm/Target/TargetLowering.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -2349,6 +2349,10 @@ public:
   /// from getBooleanContents().
   bool isConstFalseVal(const SDNode *N) const;
 
+  /// Return a constant of type VT that contains a true value that respects
+  /// getBooleanContents()
+  SDValue getConstTrueVal(SelectionDAG &DAG, EVT VT, const SDLoc &DL) const;
+
   /// Return if \p N is a True value when extended to \p VT.
   bool isExtendedTrueVal(const ConstantSDNode *N, EVT VT, bool Signed) const;
 

Modified: projects/clang390-import/contrib/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -623,6 +623,7 @@ template <> struct GraphTraits<Irreducib
   typedef bfi_detail::IrreducibleGraph GraphT;
 
   typedef const GraphT::IrrNode NodeType;
+  typedef const GraphT::IrrNode *NodeRef;
   typedef GraphT::IrrNode::iterator ChildIteratorType;
 
   static const NodeType *getEntryNode(const GraphT &G) {

Modified: projects/clang390-import/contrib/llvm/lib/Analysis/ConstantFolding.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/Analysis/ConstantFolding.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/Analysis/ConstantFolding.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -1424,8 +1424,8 @@ Constant *ConstantFoldBinaryFP(double (*
 /// integer type Ty is used to select how many bits are available for the
 /// result. Returns null if the conversion cannot be performed, otherwise
 /// returns the Constant value resulting from the conversion.
-Constant *ConstantFoldConvertToInt(const APFloat &Val, bool roundTowardZero,
-                                   Type *Ty) {
+Constant *ConstantFoldSSEConvertToInt(const APFloat &Val, bool roundTowardZero,
+                                      Type *Ty) {
   // All of these conversion intrinsics form an integer of at most 64bits.
   unsigned ResultWidth = Ty->getIntegerBitWidth();
   assert(ResultWidth <= 64 &&
@@ -1438,7 +1438,8 @@ Constant *ConstantFoldConvertToInt(const
   APFloat::opStatus status = Val.convertToInteger(&UIntVal, ResultWidth,
                                                   /*isSigned=*/true, mode,
                                                   &isExact);
-  if (status != APFloat::opOK && status != APFloat::opInexact)
+  if (status != APFloat::opOK &&
+      (!roundTowardZero || status != APFloat::opInexact))
     return nullptr;
   return ConstantInt::get(Ty, UIntVal, /*isSigned=*/true);
 }
@@ -1676,17 +1677,17 @@ Constant *ConstantFoldScalarCall(StringR
       case Intrinsic::x86_sse2_cvtsd2si:
       case Intrinsic::x86_sse2_cvtsd2si64:
         if (ConstantFP *FPOp =
-              dyn_cast_or_null<ConstantFP>(Op->getAggregateElement(0U)))
-          return ConstantFoldConvertToInt(FPOp->getValueAPF(),
-                                          /*roundTowardZero=*/false, Ty);
+                dyn_cast_or_null<ConstantFP>(Op->getAggregateElement(0U)))
+          return ConstantFoldSSEConvertToInt(FPOp->getValueAPF(),
+                                             /*roundTowardZero=*/false, Ty);
       case Intrinsic::x86_sse_cvttss2si:
       case Intrinsic::x86_sse_cvttss2si64:
       case Intrinsic::x86_sse2_cvttsd2si:
       case Intrinsic::x86_sse2_cvttsd2si64:
         if (ConstantFP *FPOp =
-              dyn_cast_or_null<ConstantFP>(Op->getAggregateElement(0U)))
-          return ConstantFoldConvertToInt(FPOp->getValueAPF(),
-                                          /*roundTowardZero=*/true, Ty);
+                dyn_cast_or_null<ConstantFP>(Op->getAggregateElement(0U)))
+          return ConstantFoldSSEConvertToInt(FPOp->getValueAPF(),
+                                             /*roundTowardZero=*/true, Ty);
       }
     }
 

Modified: projects/clang390-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -3400,7 +3400,10 @@ static Value *SimplifySelectInst(Value *
     return TrueVal;
 
   if (const auto *ICI = dyn_cast<ICmpInst>(CondVal)) {
-    unsigned BitWidth = Q.DL.getTypeSizeInBits(TrueVal->getType());
+    // FIXME: This code is nearly duplicated in InstCombine. Using/refactoring
+    // decomposeBitTestICmp() might help.
+    unsigned BitWidth =
+        Q.DL.getTypeSizeInBits(TrueVal->getType()->getScalarType());
     ICmpInst::Predicate Pred = ICI->getPredicate();
     Value *CmpLHS = ICI->getOperand(0);
     Value *CmpRHS = ICI->getOperand(1);
@@ -4274,7 +4277,8 @@ static bool replaceAndRecursivelySimplif
 
     // Gracefully handle edge cases where the instruction is not wired into any
     // parent block.
-    if (I->getParent())
+    if (I->getParent() && !I->isEHPad() && !isa<TerminatorInst>(I) &&
+        !I->mayHaveSideEffects())
       I->eraseFromParent();
   } else {
     Worklist.insert(I);
@@ -4302,7 +4306,8 @@ static bool replaceAndRecursivelySimplif
 
     // Gracefully handle edge cases where the instruction is not wired into any
     // parent block.
-    if (I->getParent())
+    if (I->getParent() && !I->isEHPad() && !isa<TerminatorInst>(I) &&
+        !I->mayHaveSideEffects())
       I->eraseFromParent();
   }
   return Simplified;

Modified: projects/clang390-import/contrib/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/Analysis/LoopUnrollAnalyzer.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -115,13 +115,19 @@ bool UnrolledInstAnalyzer::visitLoad(Loa
   // We might have a vector load from an array. FIXME: for now we just bail
   // out in this case, but we should be able to resolve and simplify such
   // loads.
-  if(CDS->getElementType() != I.getType())
+  if (CDS->getElementType() != I.getType())
     return false;
 
-  int ElemSize = CDS->getElementType()->getPrimitiveSizeInBits() / 8U;
-  if (SimplifiedAddrOp->getValue().getActiveBits() >= 64)
+  unsigned ElemSize = CDS->getElementType()->getPrimitiveSizeInBits() / 8U;
+  if (SimplifiedAddrOp->getValue().getActiveBits() > 64)
     return false;
-  int64_t Index = SimplifiedAddrOp->getSExtValue() / ElemSize;
+  int64_t SimplifiedAddrOpV = SimplifiedAddrOp->getSExtValue();
+  if (SimplifiedAddrOpV < 0) {
+    // FIXME: For now we conservatively ignore out of bound accesses, but
+    // we're allowed to perform the optimization in this case.
+    return false;
+  }
+  uint64_t Index = static_cast<uint64_t>(SimplifiedAddrOpV) / ElemSize;
   if (Index >= CDS->getNumElements()) {
     // FIXME: For now we conservatively ignore out of bound accesses, but
     // we're allowed to perform the optimization in this case.

Modified: projects/clang390-import/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/Analysis/ScalarEvolutionExpander.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -1610,8 +1610,7 @@ Value *SCEVExpander::visitUMaxExpr(const
 
 Value *SCEVExpander::expandCodeFor(const SCEV *SH, Type *Ty,
                                    Instruction *IP) {
-  assert(IP);
-  Builder.SetInsertPoint(IP);
+  setInsertPoint(IP);
   return expandCodeFor(SH, Ty);
 }
 

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -214,10 +214,7 @@ TypeIndex CodeViewDebug::getScopeIndex(c
 }
 
 TypeIndex CodeViewDebug::getFuncIdForSubprogram(const DISubprogram *SP) {
-  // It's possible to ask for the FuncId of a function which doesn't have a
-  // subprogram: inlining a function with debug info into a function with none.
-  if (!SP)
-    return TypeIndex::None();
+  assert(SP);
 
   // Check if we've already translated this subprogram.
   auto I = TypeIndices.find({SP, nullptr});
@@ -621,11 +618,12 @@ void CodeViewDebug::emitDebugInfoForFunc
 
   std::string FuncName;
   auto *SP = GV->getSubprogram();
+  assert(SP);
   setCurrentSubprogram(SP);
 
   // If we have a display name, build the fully qualified name by walking the
   // chain of scopes.
-  if (SP != nullptr && !SP->getDisplayName().empty())
+  if (!SP->getDisplayName().empty())
     FuncName =
         getFullyQualifiedName(SP->getScope().resolve(), SP->getDisplayName());
 
@@ -864,7 +862,7 @@ void CodeViewDebug::collectVariableInfo(
 void CodeViewDebug::beginFunction(const MachineFunction *MF) {
   assert(!CurFn && "Can't process two functions at once!");
 
-  if (!Asm || !MMI->hasDebugInfo())
+  if (!Asm || !MMI->hasDebugInfo() || !MF->getFunction()->getSubprogram())
     return;
 
   DebugHandlerBase::beginFunction(MF);
@@ -1939,7 +1937,8 @@ void CodeViewDebug::beginInstruction(con
   DebugHandlerBase::beginInstruction(MI);
 
   // Ignore DBG_VALUE locations and function prologue.
-  if (!Asm || MI->isDebugValue() || MI->getFlag(MachineInstr::FrameSetup))
+  if (!Asm || !CurFn || MI->isDebugValue() ||
+      MI->getFlag(MachineInstr::FrameSetup))
     return;
   DebugLoc DL = MI->getDebugLoc();
   if (DL == PrevInstLoc || !DL)

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/BranchFolding.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -996,6 +996,24 @@ bool BranchFolder::TailMergeBlocks(Machi
     MachineBasicBlock *IBB = &*I;
     MachineBasicBlock *PredBB = &*std::prev(I);
     MergePotentials.clear();
+    MachineLoop *ML;
+
+    // Bail if merging after placement and IBB is the loop header because
+    // -- If merging predecessors that belong to the same loop as IBB, the
+    // common tail of merged predecessors may become the loop top if block
+    // placement is called again and the predecessors may branch to this common
+    // tail and require more branches. This can be relaxed if
+    // MachineBlockPlacement::findBestLoopTop is more flexible.
+    // --If merging predecessors that do not belong to the same loop as IBB, the
+    // loop info of IBB's loop and the other loops may be affected. Calling the
+    // block placement again may make big change to the layout and eliminate the
+    // reason to do tail merging here.
+    if (AfterBlockPlacement && MLI) {
+      ML = MLI->getLoopFor(IBB);
+      if (ML && IBB == ML->getHeader())
+        continue;
+    }
+
     for (MachineBasicBlock *PBB : I->predecessors()) {
       if (MergePotentials.size() == TailMergeThreshold)
         break;
@@ -1015,16 +1033,12 @@ bool BranchFolder::TailMergeBlocks(Machi
       if (PBB->hasEHPadSuccessor())
         continue;
 
-      // Bail out if the loop header (IBB) is not the top of the loop chain
-      // after the block placement.  Otherwise, the common tail of IBB's
-      // predecessors may become the loop top if block placement is called again
-      // and the predecessors may branch to this common tail.
-      // FIXME: Relaxed this check if the algorithm of finding loop top is
-      // changed in MBP.
+      // After block placement, only consider predecessors that belong to the
+      // same loop as IBB.  The reason is the same as above when skipping loop
+      // header.
       if (AfterBlockPlacement && MLI)
-        if (MachineLoop *ML = MLI->getLoopFor(IBB))
-          if (IBB == ML->getHeader() && ML == MLI->getLoopFor(PBB))
-            continue;
+        if (ML != MLI->getLoopFor(PBB))
+          continue;
 
       MachineBasicBlock *TBB = nullptr, *FBB = nullptr;
       SmallVector<MachineOperand, 4> Cond;

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStack.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStack.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStack.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -530,7 +530,7 @@ Value *SafeStack::moveStaticAllocasToUns
     unsigned Align =
         std::max(DL->getPrefTypeAlignment(Ty), StackGuardSlot->getAlignment());
     SSL.addObject(StackGuardSlot, getStaticAllocaAllocationSize(StackGuardSlot),
-                  Align, SSC.getLiveRange(StackGuardSlot));
+                  Align, SSC.getFullLiveRange());
   }
 
   for (Argument *Arg : ByValArguments) {

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackColoring.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackColoring.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackColoring.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -25,7 +25,9 @@ static cl::opt<bool> ClColoring("safe-st
                                 cl::Hidden, cl::init(true));
 
 const StackColoring::LiveRange &StackColoring::getLiveRange(AllocaInst *AI) {
-  return LiveRanges[AllocaNumbering[AI]];
+  const auto IT = AllocaNumbering.find(AI);
+  assert(IT != AllocaNumbering.end());
+  return LiveRanges[IT->second];
 }
 
 bool StackColoring::readMarker(Instruction *I, bool *IsStart) {

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackLayout.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackLayout.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/SafeStackLayout.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -100,7 +100,8 @@ void StackLayout::layoutObject(StackObje
   }
 
   // Split starting and ending regions if necessary.
-  for (StackRegion &R : Regions) {
+  for (unsigned i = 0; i < Regions.size(); ++i) {
+    StackRegion &R = Regions[i];
     if (Start > R.Start && Start < R.End) {
       StackRegion R0 = R;
       R.Start = R0.End = Start;

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -6198,13 +6198,27 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SD
       }
     }
 
-    // sext(setcc x, y, cc) -> (select (setcc x, y, cc), -1, 0)
-    unsigned ElementWidth = VT.getScalarType().getSizeInBits();
+    // sext(setcc x, y, cc) -> (select (setcc x, y, cc), T, 0)
+    // Here, T can be 1 or -1, depending on the type of the setcc and
+    // getBooleanContents().
+    unsigned SetCCWidth = N0.getValueType().getScalarSizeInBits();
+
     SDLoc DL(N);
-    SDValue NegOne =
-      DAG.getConstant(APInt::getAllOnesValue(ElementWidth), DL, VT);
+    // To determine the "true" side of the select, we need to know the high bit
+    // of the value returned by the setcc if it evaluates to true.
+    // If the type of the setcc is i1, then the true case of the select is just
+    // sext(i1 1), that is, -1.
+    // If the type of the setcc is larger (say, i8) then the value of the high
+    // bit depends on getBooleanContents(). So, ask TLI for a real "true" value
+    // of the appropriate width.
+    SDValue ExtTrueVal =
+        (SetCCWidth == 1)
+            ? DAG.getConstant(APInt::getAllOnesValue(VT.getScalarSizeInBits()),
+                              DL, VT)
+            : TLI.getConstTrueVal(DAG, VT, DL);
+
     if (SDValue SCC = SimplifySelectCC(
-            DL, N0.getOperand(0), N0.getOperand(1), NegOne,
+            DL, N0.getOperand(0), N0.getOperand(1), ExtTrueVal,
             DAG.getConstant(0, DL, VT),
             cast<CondCodeSDNode>(N0.getOperand(2))->get(), true))
       return SCC;
@@ -6215,10 +6229,10 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SD
           TLI.isOperationLegal(ISD::SETCC, N0.getOperand(0).getValueType())) {
         SDLoc DL(N);
         ISD::CondCode CC = cast<CondCodeSDNode>(N0.getOperand(2))->get();
-        SDValue SetCC = DAG.getSetCC(DL, SetCCVT,
-                                     N0.getOperand(0), N0.getOperand(1), CC);
-        return DAG.getSelect(DL, VT, SetCC,
-                             NegOne, DAG.getConstant(0, DL, VT));
+        SDValue SetCC =
+            DAG.getSetCC(DL, SetCCVT, N0.getOperand(0), N0.getOperand(1), CC);
+        return DAG.getSelect(DL, VT, SetCC, ExtTrueVal,
+                             DAG.getConstant(0, DL, VT));
       }
     }
   }

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -6639,19 +6639,26 @@ void SelectionDAG::TransferDbgValues(SDV
   SDNode *FromNode = From.getNode();
   SDNode *ToNode = To.getNode();
   ArrayRef<SDDbgValue *> DVs = GetDbgValues(FromNode);
+  SmallVector<SDDbgValue *, 2> ClonedDVs;
   for (ArrayRef<SDDbgValue *>::iterator I = DVs.begin(), E = DVs.end();
        I != E; ++I) {
     SDDbgValue *Dbg = *I;
     // Only add Dbgvalues attached to same ResNo.
     if (Dbg->getKind() == SDDbgValue::SDNODE &&
-        Dbg->getResNo() == From.getResNo()) {
+        Dbg->getSDNode() == From.getNode() &&
+        Dbg->getResNo() == From.getResNo() && !Dbg->isInvalidated()) {
+      assert(FromNode != ToNode &&
+             "Should not transfer Debug Values intranode");
       SDDbgValue *Clone =
           getDbgValue(Dbg->getVariable(), Dbg->getExpression(), ToNode,
                       To.getResNo(), Dbg->isIndirect(), Dbg->getOffset(),
                       Dbg->getDebugLoc(), Dbg->getOrder());
-      AddDbgValue(Clone, ToNode, false);
+      ClonedDVs.push_back(Clone);
+      Dbg->setIsInvalidated();
     }
   }
+  for (SDDbgValue *I : ClonedDVs)
+    AddDbgValue(I, ToNode, false);
 }
 
 //===----------------------------------------------------------------------===//

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -1234,6 +1234,16 @@ bool TargetLowering::isConstTrueVal(cons
   llvm_unreachable("Invalid boolean contents");
 }
 
+SDValue TargetLowering::getConstTrueVal(SelectionDAG &DAG, EVT VT,
+                                        const SDLoc &DL) const {
+  unsigned ElementWidth = VT.getScalarSizeInBits();
+  APInt TrueInt =
+      getBooleanContents(VT) == TargetLowering::ZeroOrOneBooleanContent
+          ? APInt(ElementWidth, 1)
+          : APInt::getAllOnesValue(ElementWidth);
+  return DAG.getConstant(TrueInt, DL, VT);
+}
+
 bool TargetLowering::isConstFalseVal(const SDNode *N) const {
   if (!N)
     return false;

Modified: projects/clang390-import/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/CodeGen/TwoAddressInstructionPass.cpp	Wed Aug 17 19:41:29 2016	(r304310)
@@ -29,7 +29,7 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/CodeGen/LiveIntervalAnalysis.h"
@@ -539,6 +539,16 @@ regsAreCompatible(unsigned RegA, unsigne
   return TRI->regsOverlap(RegA, RegB);
 }
 
+// Returns true if Reg is equal or aliased to at least one register in Set.
+static bool regOverlapsSet(const SmallVectorImpl<unsigned> &Set, unsigned Reg,
+                           const TargetRegisterInfo *TRI) {
+  for (unsigned R : Set)
+    if (TRI->regsOverlap(R, Reg))
+      return true;
+
+  return false;
+}
+
 /// Return true if it's potentially profitable to commute the two-address
 /// instruction that's being processed.
 bool
@@ -864,9 +874,9 @@ rescheduleMIBelowKill(MachineBasicBlock:
     // FIXME: Needs more sophisticated heuristics.
     return false;
 
-  SmallSet<unsigned, 2> Uses;
-  SmallSet<unsigned, 2> Kills;
-  SmallSet<unsigned, 2> Defs;
+  SmallVector<unsigned, 2> Uses;
+  SmallVector<unsigned, 2> Kills;
+  SmallVector<unsigned, 2> Defs;
   for (const MachineOperand &MO : MI->operands()) {
     if (!MO.isReg())
       continue;
@@ -874,12 +884,12 @@ rescheduleMIBelowKill(MachineBasicBlock:
     if (!MOReg)
       continue;
     if (MO.isDef())
-      Defs.insert(MOReg);
+      Defs.push_back(MOReg);
     else {
-      Uses.insert(MOReg);
+      Uses.push_back(MOReg);
       if (MOReg != Reg && (MO.isKill() ||
                            (LIS && isPlainlyKilled(MI, MOReg, LIS))))
-        Kills.insert(MOReg);
+        Kills.push_back(MOReg);
     }
   }
 
@@ -888,8 +898,9 @@ rescheduleMIBelowKill(MachineBasicBlock:
   MachineBasicBlock::iterator AfterMI = std::next(Begin);
 
   MachineBasicBlock::iterator End = AfterMI;
-  while (End->isCopy() && Defs.count(End->getOperand(1).getReg())) {
-    Defs.insert(End->getOperand(0).getReg());
+  while (End->isCopy() &&
+         regOverlapsSet(Defs, End->getOperand(1).getReg(), TRI)) {
+    Defs.push_back(End->getOperand(0).getReg());
     ++End;
   }
 
@@ -915,21 +926,21 @@ rescheduleMIBelowKill(MachineBasicBlock:
       if (!MOReg)
         continue;
       if (MO.isDef()) {
-        if (Uses.count(MOReg))
+        if (regOverlapsSet(Uses, MOReg, TRI))
           // Physical register use would be clobbered.
           return false;
-        if (!MO.isDead() && Defs.count(MOReg))
+        if (!MO.isDead() && regOverlapsSet(Defs, MOReg, TRI))
           // May clobber a physical register def.
           // FIXME: This may be too conservative. It's ok if the instruction
           // is sunken completely below the use.
           return false;
       } else {
-        if (Defs.count(MOReg))
+        if (regOverlapsSet(Defs, MOReg, TRI))
           return false;
         bool isKill =
             MO.isKill() || (LIS && isPlainlyKilled(&OtherMI, MOReg, LIS));
-        if (MOReg != Reg &&
-            ((isKill && Uses.count(MOReg)) || Kills.count(MOReg)))
+        if (MOReg != Reg && ((isKill && regOverlapsSet(Uses, MOReg, TRI)) ||
+                             regOverlapsSet(Kills, MOReg, TRI)))
           // Don't want to extend other live ranges and update kills.
           return false;
         if (MOReg == Reg && !isKill)

Modified: projects/clang390-import/contrib/llvm/lib/IR/AttributeImpl.h
==============================================================================
--- projects/clang390-import/contrib/llvm/lib/IR/AttributeImpl.h	Wed Aug 17 19:38:11 2016	(r304309)
+++ projects/clang390-import/contrib/llvm/lib/IR/AttributeImpl.h	Wed Aug 17 19:41:29 2016	(r304310)
@@ -19,8 +19,8 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/IR/Attributes.h"
+#include "AttributeSetNode.h"
 #include "llvm/Support/DataTypes.h"
-#include "llvm/Support/TrailingObjects.h"
 #include <climits>
 #include <string>

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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