svn commit: r311818 - in vendor/llvm/dist: cmake cmake/modules include/llvm/Analysis include/llvm/CodeGen include/llvm/DebugInfo/MSF include/llvm/ExecutionEngine/Orc include/llvm/IR include/llvm/Su...

Dimitry Andric dim at FreeBSD.org
Mon Jan 9 21:23:12 UTC 2017


Author: dim
Date: Mon Jan  9 21:23:09 2017
New Revision: 311818
URL: https://svnweb.freebsd.org/changeset/base/311818

Log:
  Vendor import of llvm trunk r291476:
  https://llvm.org/svn/llvm-project/llvm/trunk@291476

Added:
  vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp   (contents, props changed)
  vendor/llvm/dist/test/Analysis/ScalarEvolution/invalidation.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/r600-legalize-umax-bug.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/store-private.ll
  vendor/llvm/dist/test/CodeGen/AVR/intrinsics/
  vendor/llvm/dist/test/CodeGen/AVR/intrinsics/read_register.ll
  vendor/llvm/dist/test/CodeGen/WebAssembly/function-bitcasts.ll
  vendor/llvm/dist/test/CodeGen/WebAssembly/unsupported-function-bitcasts.ll
  vendor/llvm/dist/test/CodeGen/X86/fmaddsub-combine.ll
  vendor/llvm/dist/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_local_branch.s   (contents, props changed)
  vendor/llvm/dist/test/ThinLTO/X86/Inputs/funcimport-tbaa.ll
  vendor/llvm/dist/test/ThinLTO/X86/Inputs/local_name_conflict1.ll
  vendor/llvm/dist/test/ThinLTO/X86/Inputs/local_name_conflict2.ll
  vendor/llvm/dist/test/ThinLTO/X86/funcimport-tbaa.ll
  vendor/llvm/dist/test/ThinLTO/X86/local_name_conflict.ll
  vendor/llvm/dist/test/Transforms/InstSimplify/div.ll
  vendor/llvm/dist/test/Transforms/NewGVN/basic-cyclic-opt.ll
  vendor/llvm/dist/test/Transforms/NewGVN/cyclic-phi-handling.ll
  vendor/llvm/dist/test/Transforms/NewGVN/memory-handling.ll
  vendor/llvm/dist/test/Transforms/NewGVN/pr31501.ll
  vendor/llvm/dist/test/Transforms/NewGVN/pr31573.ll
  vendor/llvm/dist/test/tools/llvm-opt-report/Inputs/dm.c   (contents, props changed)
  vendor/llvm/dist/test/tools/llvm-opt-report/Inputs/dm.yaml
  vendor/llvm/dist/test/tools/llvm-opt-report/func-dm.test
Modified:
  vendor/llvm/dist/cmake/config-ix.cmake
  vendor/llvm/dist/cmake/modules/AddLLVM.cmake
  vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h
  vendor/llvm/dist/include/llvm/Analysis/TargetLibraryInfo.h
  vendor/llvm/dist/include/llvm/CodeGen/MachineBasicBlock.h
  vendor/llvm/dist/include/llvm/CodeGen/MachineFrameInfo.h
  vendor/llvm/dist/include/llvm/DebugInfo/MSF/StreamArray.h
  vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
  vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RPCUtils.h
  vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
  vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndexYAML.h
  vendor/llvm/dist/include/llvm/IR/PassManager.h
  vendor/llvm/dist/include/llvm/IR/User.h
  vendor/llvm/dist/include/llvm/Support/Path.h
  vendor/llvm/dist/include/llvm/Transforms/IPO.h
  vendor/llvm/dist/include/llvm/Transforms/IPO/PassManagerBuilder.h
  vendor/llvm/dist/lib/Analysis/InstructionSimplify.cpp
  vendor/llvm/dist/lib/Analysis/LoopInfo.cpp
  vendor/llvm/dist/lib/Analysis/MemoryDependenceAnalysis.cpp
  vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp
  vendor/llvm/dist/lib/Analysis/ValueTracking.cpp
  vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp
  vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  vendor/llvm/dist/lib/CodeGen/StackSlotColoring.cpp
  vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
  vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
  vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp
  vendor/llvm/dist/lib/Object/MachOObjectFile.cpp
  vendor/llvm/dist/lib/Object/ModuleSummaryIndexObjectFile.cpp
  vendor/llvm/dist/lib/Support/CommandLine.cpp
  vendor/llvm/dist/lib/Support/Path.cpp
  vendor/llvm/dist/lib/Support/TarWriter.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/R600ISelLowering.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/R600Instructions.td
  vendor/llvm/dist/lib/Target/AMDGPU/SIISelLowering.cpp
  vendor/llvm/dist/lib/Target/AMDGPU/SIISelLowering.h
  vendor/llvm/dist/lib/Target/AVR/AVRISelDAGToDAG.cpp
  vendor/llvm/dist/lib/Target/AVR/AVRISelLowering.cpp
  vendor/llvm/dist/lib/Target/AVR/AVRISelLowering.h
  vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.cpp
  vendor/llvm/dist/lib/Target/BPF/Disassembler/BPFDisassembler.cpp
  vendor/llvm/dist/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
  vendor/llvm/dist/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
  vendor/llvm/dist/lib/Target/BPF/MCTargetDesc/BPFMCCodeEmitter.cpp
  vendor/llvm/dist/lib/Target/BPF/MCTargetDesc/BPFMCTargetDesc.cpp
  vendor/llvm/dist/lib/Target/TargetMachineC.cpp
  vendor/llvm/dist/lib/Target/WebAssembly/CMakeLists.txt
  vendor/llvm/dist/lib/Target/WebAssembly/WebAssembly.h
  vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrInteger.td
  vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
  vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp
  vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td
  vendor/llvm/dist/lib/Target/X86/X86InstrInfo.cpp
  vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td
  vendor/llvm/dist/lib/Target/X86/X86TargetTransformInfo.cpp
  vendor/llvm/dist/lib/Transforms/IPO/LowerTypeTests.cpp
  vendor/llvm/dist/lib/Transforms/IPO/PassManagerBuilder.cpp
  vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCompares.cpp
  vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/IndVarSimplify.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/LoopLoadElimination.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/LoopUnswitch.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp
  vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp
  vendor/llvm/dist/lib/Transforms/Utils/FunctionImportUtils.cpp
  vendor/llvm/dist/lib/Transforms/Utils/SimplifyLibCalls.cpp
  vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp
  vendor/llvm/dist/test/Analysis/CostModel/X86/shuffle-reverse.ll
  vendor/llvm/dist/test/Analysis/CostModel/X86/testshiftlshr.ll
  vendor/llvm/dist/test/Analysis/CostModel/X86/testshiftshl.ll
  vendor/llvm/dist/test/Analysis/CostModel/X86/vshift-ashr-cost.ll
  vendor/llvm/dist/test/Analysis/CostModel/X86/vshift-lshr-cost.ll
  vendor/llvm/dist/test/Analysis/CostModel/X86/vshift-shl-cost.ll
  vendor/llvm/dist/test/Analysis/ValueTracking/assume.ll
  vendor/llvm/dist/test/Bindings/Go/lit.local.cfg
  vendor/llvm/dist/test/Bindings/OCaml/lit.local.cfg
  vendor/llvm/dist/test/CMakeLists.txt
  vendor/llvm/dist/test/CodeGen/AMDGPU/load-constant-i16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/load-global-i16.ll
  vendor/llvm/dist/test/CodeGen/AMDGPU/min.ll
  vendor/llvm/dist/test/CodeGen/X86/avx2-arith.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-bugfix-23634.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-calling-conv.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-cvt.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-ext.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-insert-extract.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-mask-op.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-mov.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-regcall-NoMask.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-vbroadcast.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512-vec-cmp.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512bw-mov.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512bw-vec-cmp.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512bwvl-mov.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512bwvl-vec-cmp.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512vl-mov.ll
  vendor/llvm/dist/test/CodeGen/X86/avx512vl-vec-cmp.ll
  vendor/llvm/dist/test/CodeGen/X86/cmov.ll
  vendor/llvm/dist/test/CodeGen/X86/fma-fneg-combine.ll
  vendor/llvm/dist/test/CodeGen/X86/sse-fsignum.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-compare-results.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-sext.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-ashr-128.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-ashr-256.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-ashr-512.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-lshr-128.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-lshr-256.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-lshr-512.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-shl-128.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-shl-256.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shift-shl-512.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-512-v64.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-masked.ll
  vendor/llvm/dist/test/CodeGen/X86/vector-shuffle-v1.ll
  vendor/llvm/dist/test/ExecutionEngine/Interpreter/lit.local.cfg
  vendor/llvm/dist/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_BE-relocations.s
  vendor/llvm/dist/test/ExecutionEngine/RuntimeDyld/AArch64/ELF_ARM64_relocations.s
  vendor/llvm/dist/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll
  vendor/llvm/dist/test/JitListener/lit.local.cfg
  vendor/llvm/dist/test/Transforms/GVN/invariant.group.ll
  vendor/llvm/dist/test/Transforms/InstCombine/assume.ll
  vendor/llvm/dist/test/Transforms/InstCombine/assume2.ll
  vendor/llvm/dist/test/Transforms/InstCombine/fabs.ll
  vendor/llvm/dist/test/Transforms/InstCombine/fast-math.ll
  vendor/llvm/dist/test/Transforms/InstCombine/urem-simplify-bug.ll
  vendor/llvm/dist/test/Transforms/InstSimplify/rem.ll
  vendor/llvm/dist/test/Transforms/LICM/hoisting.ll
  vendor/llvm/dist/test/Transforms/LoopLoadElim/forward.ll
  vendor/llvm/dist/test/Transforms/LoopVectorize/iv_outside_user.ll
  vendor/llvm/dist/test/Transforms/NewGVN/invariant.group.ll
  vendor/llvm/dist/test/lit.cfg
  vendor/llvm/dist/test/lit.site.cfg.in
  vendor/llvm/dist/test/tools/llvm-config/system-libs.test
  vendor/llvm/dist/test/tools/llvm-config/system-libs.windows.test
  vendor/llvm/dist/tools/llvm-config/llvm-config.cpp
  vendor/llvm/dist/tools/llvm-objdump/MachODump.cpp
  vendor/llvm/dist/tools/llvm-opt-report/OptReport.cpp
  vendor/llvm/dist/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp
  vendor/llvm/dist/unittests/IR/UserTest.cpp
  vendor/llvm/dist/utils/unittest/CMakeLists.txt
  vendor/llvm/dist/utils/update_test_checks.py

Modified: vendor/llvm/dist/cmake/config-ix.cmake
==============================================================================
--- vendor/llvm/dist/cmake/config-ix.cmake	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/cmake/config-ix.cmake	Mon Jan  9 21:23:09 2017	(r311818)
@@ -316,9 +316,9 @@ else()
   endif()
 endif()
 
-check_cxx_compiler_flag("-Wno-variadic-macros" SUPPORTS_NO_VARIADIC_MACROS_FLAG)
-check_cxx_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments"
-                        SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG)
+check_cxx_compiler_flag("-Wvariadic-macros" SUPPORTS_VARIADIC_MACROS_FLAG)
+check_cxx_compiler_flag("-Wgnu-zero-variadic-macro-arguments"
+                        SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG)
 
 set(USE_NO_MAYBE_UNINITIALIZED 0)
 set(USE_NO_UNINITIALIZED 0)
@@ -462,13 +462,6 @@ if( MSVC )
   if(LLVM_ENABLE_DIA_SDK AND NOT HAVE_DIA_SDK)
     message(FATAL_ERROR "DIA SDK not found. If you have both VS 2012 and 2013 installed, you may need to uninstall the former and re-install the latter afterwards.")
   endif()
-
-  # Normalize to 0/1 for lit.site.cfg
-  if(LLVM_ENABLE_DIA_SDK)
-    set(LLVM_ENABLE_DIA_SDK 1)
-  else()
-    set(LLVM_ENABLE_DIA_SDK 0)
-  endif()
 else()
   set(LLVM_ENABLE_DIA_SDK 0)
 endif( MSVC )

Modified: vendor/llvm/dist/cmake/modules/AddLLVM.cmake
==============================================================================
--- vendor/llvm/dist/cmake/modules/AddLLVM.cmake	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/cmake/modules/AddLLVM.cmake	Mon Jan  9 21:23:09 2017	(r311818)
@@ -1011,11 +1011,11 @@ function(add_unittest test_suite test_na
     list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_PTHREAD=0)
   endif ()
 
-  if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
+  if (SUPPORTS_VARIADIC_MACROS_FLAG)
     list(APPEND LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
   endif ()
   # Some parts of gtest rely on this GNU extension, don't warn on it.
-  if(SUPPORTS_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG)
+  if(SUPPORTS_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS_FLAG)
     list(APPEND LLVM_COMPILE_FLAGS "-Wno-gnu-zero-variadic-macro-arguments")
   endif()
 
@@ -1067,6 +1067,19 @@ function(llvm_add_go_executable binary p
   endif()
 endfunction()
 
+# This function canonicalize the CMake variables passed by names
+# from CMake boolean to 0/1 suitable for passing into Python or C++,
+# in place.
+function(llvm_canonicalize_cmake_booleans)
+  foreach(var ${ARGN})
+    if(${var})
+      set(${var} 1 PARENT_SCOPE)
+    else()
+      set(${var} 0 PARENT_SCOPE)
+    endif()
+  endforeach()
+endfunction(llvm_canonicalize_cmake_booleans)
+
 # This function provides an automatic way to 'configure'-like generate a file
 # based on a set of common and custom variables, specifically targeting the
 # variables needed for the 'lit.site.cfg' files. This function bundles the

Modified: vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -1491,6 +1491,8 @@ public:
 
   void print(raw_ostream &OS) const;
   void verify() const;
+  bool invalidate(Function &F, const PreservedAnalyses &PA,
+                  FunctionAnalysisManager::Invalidator &Inv);
 
   /// Collect parametric terms occurring in step expressions (first step of
   /// delinearization).

Modified: vendor/llvm/dist/include/llvm/Analysis/TargetLibraryInfo.h
==============================================================================
--- vendor/llvm/dist/include/llvm/Analysis/TargetLibraryInfo.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/Analysis/TargetLibraryInfo.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -290,7 +290,7 @@ public:
   }
 
   /// Returns extension attribute kind to be used for i32 parameters
-  /// correpsonding to C-level int or unsigned int.  May be zeroext, signext,
+  /// corresponding to C-level int or unsigned int.  May be zeroext, signext,
   /// or none.
   Attribute::AttrKind getExtAttrForI32Param(bool Signed = true) const {
     if (Impl->ShouldExtI32Param)
@@ -301,7 +301,7 @@ public:
   }
 
   /// Returns extension attribute kind to be used for i32 return values
-  /// correpsonding to C-level int or unsigned int.  May be zeroext, signext,
+  /// corresponding to C-level int or unsigned int.  May be zeroext, signext,
   /// or none.
   Attribute::AttrKind getExtAttrForI32Return(bool Signed = true) const {
     if (Impl->ShouldExtI32Return)

Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineBasicBlock.h
==============================================================================
--- vendor/llvm/dist/include/llvm/CodeGen/MachineBasicBlock.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/CodeGen/MachineBasicBlock.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -308,6 +308,16 @@ public:
   // Iteration support for live in sets.  These sets are kept in sorted
   // order by their register number.
   typedef LiveInVector::const_iterator livein_iterator;
+#ifndef NDEBUG
+  /// Unlike livein_begin, this method does not check that the liveness
+  /// information is accurate. Still for debug purposes it may be useful
+  /// to have iterators that won't assert if the liveness information
+  /// is not current.
+  livein_iterator livein_begin_dbg() const { return LiveIns.begin(); }
+  iterator_range<livein_iterator> liveins_dbg() const {
+    return make_range(livein_begin_dbg(), livein_end());
+  }
+#endif
   livein_iterator livein_begin() const;
   livein_iterator livein_end()   const { return LiveIns.end(); }
   bool            livein_empty() const { return LiveIns.empty(); }

Modified: vendor/llvm/dist/include/llvm/CodeGen/MachineFrameInfo.h
==============================================================================
--- vendor/llvm/dist/include/llvm/CodeGen/MachineFrameInfo.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/CodeGen/MachineFrameInfo.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -148,8 +148,7 @@ class MachineFrameInfo {
   /// grouping overaligned allocas into a "secondary stack frame" and
   /// then only use a single alloca to allocate this frame and only a
   /// single virtual register to access it. Currently, without such an
-  /// optimization, each such alloca gets it's own dynamic
-  /// realignment.
+  /// optimization, each such alloca gets its own dynamic realignment.
   bool StackRealignable;
 
   /// Whether the function has the \c alignstack attribute.

Modified: vendor/llvm/dist/include/llvm/DebugInfo/MSF/StreamArray.h
==============================================================================
--- vendor/llvm/dist/include/llvm/DebugInfo/MSF/StreamArray.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/DebugInfo/MSF/StreamArray.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -11,6 +11,7 @@
 #define LLVM_DEBUGINFO_MSF_STREAMARRAY_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/DebugInfo/MSF/StreamRef.h"
 #include "llvm/Support/Error.h"
 #include <cassert>
@@ -107,7 +108,10 @@ private:
   Extractor E;
 };
 
-template <typename ValueType, typename Extractor> class VarStreamArrayIterator {
+template <typename ValueType, typename Extractor>
+class VarStreamArrayIterator
+    : public iterator_facade_base<VarStreamArrayIterator<ValueType, Extractor>,
+                                  std::forward_iterator_tag, ValueType> {
   typedef VarStreamArrayIterator<ValueType, Extractor> IterType;
   typedef VarStreamArray<ValueType, Extractor> ArrayType;
 
@@ -144,41 +148,39 @@ public:
     return false;
   }
 
-  bool operator!=(const IterType &R) { return !(*this == R); }
-
   const ValueType &operator*() const {
     assert(Array && !HasError);
     return ThisValue;
   }
 
-  IterType &operator++() {
-    // We are done with the current record, discard it so that we are
-    // positioned at the next record.
-    IterRef = IterRef.drop_front(ThisLen);
-    if (IterRef.getLength() == 0) {
-      // There is nothing after the current record, we must make this an end
-      // iterator.
-      moveToEnd();
-    } else {
-      // There is some data after the current record.
-      auto EC = Extract(IterRef, ThisLen, ThisValue);
-      if (EC) {
-        consumeError(std::move(EC));
-        markError();
-      } else if (ThisLen == 0) {
-        // An empty record? Make this an end iterator.
+  IterType &operator+=(std::ptrdiff_t N) {
+    while (N > 0) {
+      // We are done with the current record, discard it so that we are
+      // positioned at the next record.
+      IterRef = IterRef.drop_front(ThisLen);
+      if (IterRef.getLength() == 0) {
+        // There is nothing after the current record, we must make this an end
+        // iterator.
         moveToEnd();
+        return *this;
+      } else {
+        // There is some data after the current record.
+        auto EC = Extract(IterRef, ThisLen, ThisValue);
+        if (EC) {
+          consumeError(std::move(EC));
+          markError();
+          return *this;
+        } else if (ThisLen == 0) {
+          // An empty record? Make this an end iterator.
+          moveToEnd();
+          return *this;
+        }
       }
+      --N;
     }
     return *this;
   }
 
-  IterType operator++(int) {
-    IterType Original = *this;
-    ++*this;
-    return Original;
-  }
-
 private:
   void moveToEnd() {
     Array = nullptr;
@@ -211,6 +213,16 @@ public:
     assert(Stream.getLength() % sizeof(T) == 0);
   }
 
+  bool operator==(const FixedStreamArray<T> &Other) const {
+    return Stream == Other.Stream;
+  }
+
+  bool operator!=(const FixedStreamArray<T> &Other) const {
+    return !(*this == Other);
+  }
+
+  FixedStreamArray &operator=(const FixedStreamArray &) = default;
+
   const T &operator[](uint32_t Index) const {
     assert(Index < size());
     uint32_t Off = Index * sizeof(T);
@@ -226,6 +238,8 @@ public:
 
   uint32_t size() const { return Stream.getLength() / sizeof(T); }
 
+  bool empty() const { return size() == 0; }
+
   FixedStreamArrayIterator<T> begin() const {
     return FixedStreamArrayIterator<T>(*this, 0);
   }
@@ -240,36 +254,53 @@ private:
   ReadableStreamRef Stream;
 };
 
-template <typename T> class FixedStreamArrayIterator {
+template <typename T>
+class FixedStreamArrayIterator
+    : public iterator_facade_base<FixedStreamArrayIterator<T>,
+                                  std::random_access_iterator_tag, T> {
+
 public:
   FixedStreamArrayIterator(const FixedStreamArray<T> &Array, uint32_t Index)
       : Array(Array), Index(Index) {}
 
-  bool operator==(const FixedStreamArrayIterator<T> &R) {
-    assert(&Array == &R.Array);
-    return Index == R.Index;
+  FixedStreamArrayIterator<T> &
+  operator=(const FixedStreamArrayIterator<T> &Other) {
+    Array = Other.Array;
+    Index = Other.Index;
+    return *this;
   }
 
-  bool operator!=(const FixedStreamArrayIterator<T> &R) {
-    return !(*this == R);
+  const T &operator*() const { return Array[Index]; }
+
+  bool operator==(const FixedStreamArrayIterator<T> &R) const {
+    assert(Array == R.Array);
+    return (Index == R.Index) && (Array == R.Array);
   }
 
-  const T &operator*() const { return Array[Index]; }
+  FixedStreamArrayIterator<T> &operator+=(std::ptrdiff_t N) {
+    Index += N;
+    return *this;
+  }
 
-  FixedStreamArrayIterator<T> &operator++() {
-    assert(Index < Array.size());
-    ++Index;
+  FixedStreamArrayIterator<T> &operator-=(std::ptrdiff_t N) {
+    assert(Index >= N);
+    Index -= N;
     return *this;
   }
 
-  FixedStreamArrayIterator<T> operator++(int) {
-    FixedStreamArrayIterator<T> Original = *this;
-    ++*this;
-    return Original;
+  std::ptrdiff_t operator-(const FixedStreamArrayIterator<T> &R) const {
+    assert(Array == R.Array);
+    assert(Index >= R.Index);
+    return Index - R.Index;
+  }
+
+  bool operator<(const FixedStreamArrayIterator<T> &RHS) const {
+    assert(Array == RHS.Array);
+    return Index < RHS.Index;
   }
 
 private:
-  const FixedStreamArray<T> &Array;
+  FixedStreamArray<T> Array;
   uint32_t Index;
 };
 

Modified: vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h
==============================================================================
--- vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetRPCAPI.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -83,7 +83,7 @@ public:
 namespace remote {
 
 class OrcRemoteTargetRPCAPI
-    : public rpc::SingleThreadedRPC<rpc::RawByteChannel> {
+    : public rpc::SingleThreadedRPCEndpoint<rpc::RawByteChannel> {
 protected:
   class ResourceIdMgr {
   public:
@@ -108,7 +108,7 @@ protected:
 public:
   // FIXME: Remove constructors once MSVC supports synthesizing move-ops.
   OrcRemoteTargetRPCAPI(rpc::RawByteChannel &C)
-      : rpc::SingleThreadedRPC<rpc::RawByteChannel>(C, true) {}
+      : rpc::SingleThreadedRPCEndpoint<rpc::RawByteChannel>(C, true) {}
 
   class CallIntVoid
       : public rpc::Function<CallIntVoid, int32_t(JITTargetAddress Addr)> {

Modified: vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RPCUtils.h
==============================================================================
--- vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RPCUtils.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RPCUtils.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -702,7 +702,7 @@ public:
 /// sync.
 template <typename ImplT, typename ChannelT, typename FunctionIdT,
           typename SequenceNumberT>
-class RPCBase {
+class RPCEndpointBase {
 protected:
   class OrcRPCInvalid : public Function<OrcRPCInvalid, void()> {
   public:
@@ -747,7 +747,7 @@ protected:
 
 public:
   /// Construct an RPC instance on a channel.
-  RPCBase(ChannelT &C, bool LazyAutoNegotiation)
+  RPCEndpointBase(ChannelT &C, bool LazyAutoNegotiation)
       : C(C), LazyAutoNegotiation(LazyAutoNegotiation) {
     // Hold ResponseId in a special variable, since we expect Response to be
     // called relatively frequently, and want to avoid the map lookup.
@@ -788,15 +788,21 @@ public:
       return FnIdOrErr.takeError();
     }
 
-    // Allocate a sequence number.
-    auto SeqNo = SequenceNumberMgr.getSequenceNumber();
-    assert(!PendingResponses.count(SeqNo) &&
-           "Sequence number already allocated");
+    SequenceNumberT SeqNo; // initialized in locked scope below.
+    {
+      // Lock the pending responses map and sequence number manager.
+      std::lock_guard<std::mutex> Lock(ResponsesMutex);
+
+      // Allocate a sequence number.
+      SeqNo = SequenceNumberMgr.getSequenceNumber();
+      assert(!PendingResponses.count(SeqNo) &&
+             "Sequence number already allocated");
 
-    // Install the user handler.
-    PendingResponses[SeqNo] =
+      // Install the user handler.
+      PendingResponses[SeqNo] =
         detail::createResponseHandler<ChannelT, typename Func::ReturnType>(
             std::move(Handler));
+    }
 
     // Open the function call message.
     if (auto Err = C.startSendMessage(FnId, SeqNo)) {
@@ -863,11 +869,33 @@ public:
     return detail::ReadArgs<ArgTs...>(Args...);
   }
 
+  /// Abandon all outstanding result handlers.
+  ///
+  /// This will call all currently registered result handlers to receive an
+  /// "abandoned" error as their argument. This is used internally by the RPC
+  /// in error situations, but can also be called directly by clients who are
+  /// disconnecting from the remote and don't or can't expect responses to their
+  /// outstanding calls. (Especially for outstanding blocking calls, calling
+  /// this function may be necessary to avoid dead threads).
+  void abandonPendingResponses() {
+    // Lock the pending responses map and sequence number manager.
+    std::lock_guard<std::mutex> Lock(ResponsesMutex);
+
+    for (auto &KV : PendingResponses)
+      KV.second->abandon();
+    PendingResponses.clear();
+    SequenceNumberMgr.reset();
+  }
+
 protected:
   // The LaunchPolicy type allows a launch policy to be specified when adding
   // a function handler. See addHandlerImpl.
   using LaunchPolicy = std::function<Error(std::function<Error()>)>;
 
+  FunctionIdT getInvalidFunctionId() const {
+    return FnIdAllocator.getInvalidId();
+  }
+
   /// Add the given handler to the handler map and make it available for
   /// autonegotiation and execution.
   template <typename Func, typename HandlerT>
@@ -884,28 +912,32 @@ protected:
         wrapHandler<Func>(std::move(Handler), std::move(Launch));
   }
 
-  // Abandon all outstanding results.
-  void abandonPendingResponses() {
-    for (auto &KV : PendingResponses)
-      KV.second->abandon();
-    PendingResponses.clear();
-    SequenceNumberMgr.reset();
-  }
-
   Error handleResponse(SequenceNumberT SeqNo) {
-    auto I = PendingResponses.find(SeqNo);
-    if (I == PendingResponses.end()) {
-      abandonPendingResponses();
-      return orcError(OrcErrorCode::UnexpectedRPCResponse);
+    using Handler = typename decltype(PendingResponses)::mapped_type;
+    Handler PRHandler;
+
+    {
+      // Lock the pending responses map and sequence number manager.
+      std::unique_lock<std::mutex> Lock(ResponsesMutex);
+      auto I = PendingResponses.find(SeqNo);
+
+      if (I != PendingResponses.end()) {
+        PRHandler = std::move(I->second);
+        PendingResponses.erase(I);
+        SequenceNumberMgr.releaseSequenceNumber(SeqNo);
+      } else {
+        // Unlock the pending results map to prevent recursive lock.
+        Lock.unlock();
+        abandonPendingResponses();
+        return orcError(OrcErrorCode::UnexpectedRPCResponse);
+      }
     }
 
-    auto PRHandler = std::move(I->second);
-    PendingResponses.erase(I);
-    SequenceNumberMgr.releaseSequenceNumber(SeqNo);
+    assert(PRHandler &&
+           "If we didn't find a response handler we should have bailed out");
 
     if (auto Err = PRHandler->handleResponse(C)) {
       abandonPendingResponses();
-      SequenceNumberMgr.reset();
       return Err;
     }
 
@@ -915,7 +947,7 @@ protected:
   FunctionIdT handleNegotiate(const std::string &Name) {
     auto I = LocalFunctionIds.find(Name);
     if (I == LocalFunctionIds.end())
-      return FnIdAllocator.getInvalidId();
+      return getInvalidFunctionId();
     return I->second;
   }
 
@@ -938,7 +970,7 @@ protected:
 
         // If autonegotiation indicates that the remote end doesn't support this
         // function, return an unknown function error.
-        if (RemoteId == FnIdAllocator.getInvalidId())
+        if (RemoteId == getInvalidFunctionId())
           return orcError(OrcErrorCode::UnknownRPCFunction);
 
         // Autonegotiation succeeded and returned a valid id. Update the map and
@@ -1012,6 +1044,7 @@ protected:
 
   std::map<FunctionIdT, WrappedHandlerFn> Handlers;
 
+  std::mutex ResponsesMutex;
   detail::SequenceNumberManager<SequenceNumberT> SequenceNumberMgr;
   std::map<SequenceNumberT, std::unique_ptr<detail::ResponseHandler<ChannelT>>>
       PendingResponses;
@@ -1021,17 +1054,18 @@ protected:
 
 template <typename ChannelT, typename FunctionIdT = uint32_t,
           typename SequenceNumberT = uint32_t>
-class MultiThreadedRPC
-    : public detail::RPCBase<
-          MultiThreadedRPC<ChannelT, FunctionIdT, SequenceNumberT>, ChannelT,
-          FunctionIdT, SequenceNumberT> {
+class MultiThreadedRPCEndpoint
+    : public detail::RPCEndpointBase<
+          MultiThreadedRPCEndpoint<ChannelT, FunctionIdT, SequenceNumberT>,
+          ChannelT, FunctionIdT, SequenceNumberT> {
 private:
   using BaseClass =
-      detail::RPCBase<MultiThreadedRPC<ChannelT, FunctionIdT, SequenceNumberT>,
-                      ChannelT, FunctionIdT, SequenceNumberT>;
+      detail::RPCEndpointBase<
+        MultiThreadedRPCEndpoint<ChannelT, FunctionIdT, SequenceNumberT>,
+        ChannelT, FunctionIdT, SequenceNumberT>;
 
 public:
-  MultiThreadedRPC(ChannelT &C, bool LazyAutoNegotiation)
+  MultiThreadedRPCEndpoint(ChannelT &C, bool LazyAutoNegotiation)
       : BaseClass(C, LazyAutoNegotiation) {}
 
   /// The LaunchPolicy type allows a launch policy to be specified when adding
@@ -1061,30 +1095,41 @@ public:
                                                std::move(Launch));
   }
 
+  /// Add a class-method as a handler.
+  template <typename Func, typename ClassT, typename RetT, typename... ArgTs>
+  void addHandler(ClassT &Object, RetT (ClassT::*Method)(ArgTs...),
+                  LaunchPolicy Launch = LaunchPolicy()) {
+    addHandler<Func>(
+      detail::MemberFnWrapper<ClassT, RetT, ArgTs...>(Object, Method),
+      Launch);
+  }
+
   /// Negotiate a function id for Func with the other end of the channel.
-  template <typename Func> Error negotiateFunction() {
+  template <typename Func> Error negotiateFunction(bool Retry = false) {
     using OrcRPCNegotiate = typename BaseClass::OrcRPCNegotiate;
 
+    // Check if we already have a function id...
+    auto I = this->RemoteFunctionIds.find(Func::getPrototype());
+    if (I != this->RemoteFunctionIds.end()) {
+      // If it's valid there's nothing left to do.
+      if (I->second != this->getInvalidFunctionId())
+        return Error::success();
+      // If it's invalid and we can't re-attempt negotiation, throw an error.
+      if (!Retry)
+        return orcError(OrcErrorCode::UnknownRPCFunction);
+    }
+
+    // We don't have a function id for Func yet, call the remote to try to
+    // negotiate one.
     if (auto RemoteIdOrErr = callB<OrcRPCNegotiate>(Func::getPrototype())) {
       this->RemoteFunctionIds[Func::getPrototype()] = *RemoteIdOrErr;
+      if (*RemoteIdOrErr == this->getInvalidFunctionId())
+        return orcError(OrcErrorCode::UnknownRPCFunction);
       return Error::success();
     } else
       return RemoteIdOrErr.takeError();
   }
 
-  /// Convenience method for negotiating multiple functions at once.
-  template <typename Func> Error negotiateFunctions() {
-    return negotiateFunction<Func>();
-  }
-
-  /// Convenience method for negotiating multiple functions at once.
-  template <typename Func1, typename Func2, typename... Funcs>
-  Error negotiateFunctions() {
-    if (auto Err = negotiateFunction<Func1>())
-      return Err;
-    return negotiateFunctions<Func2, Funcs...>();
-  }
-
   /// Return type for non-blocking call primitives.
   template <typename Func>
   using NonBlockingCallResult = typename detail::ResultTraits<
@@ -1169,19 +1214,20 @@ public:
 
 template <typename ChannelT, typename FunctionIdT = uint32_t,
           typename SequenceNumberT = uint32_t>
-class SingleThreadedRPC
-    : public detail::RPCBase<
-          SingleThreadedRPC<ChannelT, FunctionIdT, SequenceNumberT>, ChannelT,
-          FunctionIdT, SequenceNumberT> {
+class SingleThreadedRPCEndpoint
+    : public detail::RPCEndpointBase<
+          SingleThreadedRPCEndpoint<ChannelT, FunctionIdT, SequenceNumberT>,
+          ChannelT, FunctionIdT, SequenceNumberT> {
 private:
   using BaseClass =
-      detail::RPCBase<SingleThreadedRPC<ChannelT, FunctionIdT, SequenceNumberT>,
-                      ChannelT, FunctionIdT, SequenceNumberT>;
+      detail::RPCEndpointBase<
+        SingleThreadedRPCEndpoint<ChannelT, FunctionIdT, SequenceNumberT>,
+        ChannelT, FunctionIdT, SequenceNumberT>;
 
   using LaunchPolicy = typename BaseClass::LaunchPolicy;
 
 public:
-  SingleThreadedRPC(ChannelT &C, bool LazyAutoNegotiation)
+  SingleThreadedRPCEndpoint(ChannelT &C, bool LazyAutoNegotiation)
       : BaseClass(C, LazyAutoNegotiation) {}
 
   template <typename Func, typename HandlerT>
@@ -1197,29 +1243,31 @@ public:
   }
 
   /// Negotiate a function id for Func with the other end of the channel.
-  template <typename Func> Error negotiateFunction() {
+  template <typename Func> Error negotiateFunction(bool Retry = false) {
     using OrcRPCNegotiate = typename BaseClass::OrcRPCNegotiate;
 
+    // Check if we already have a function id...
+    auto I = this->RemoteFunctionIds.find(Func::getPrototype());
+    if (I != this->RemoteFunctionIds.end()) {
+      // If it's valid there's nothing left to do.
+      if (I->second != this->getInvalidFunctionId())
+        return Error::success();
+      // If it's invalid and we can't re-attempt negotiation, throw an error.
+      if (!Retry)
+        return orcError(OrcErrorCode::UnknownRPCFunction);
+    }
+
+    // We don't have a function id for Func yet, call the remote to try to
+    // negotiate one.
     if (auto RemoteIdOrErr = callB<OrcRPCNegotiate>(Func::getPrototype())) {
       this->RemoteFunctionIds[Func::getPrototype()] = *RemoteIdOrErr;
+      if (*RemoteIdOrErr == this->getInvalidFunctionId())
+        return orcError(OrcErrorCode::UnknownRPCFunction);
       return Error::success();
     } else
       return RemoteIdOrErr.takeError();
   }
 
-  /// Convenience method for negotiating multiple functions at once.
-  template <typename Func> Error negotiateFunctions() {
-    return negotiateFunction<Func>();
-  }
-
-  /// Convenience method for negotiating multiple functions at once.
-  template <typename Func1, typename Func2, typename... Funcs>
-  Error negotiateFunctions() {
-    if (auto Err = negotiateFunction<Func1>())
-      return Err;
-    return negotiateFunctions<Func2, Funcs...>();
-  }
-
   template <typename Func, typename... ArgTs,
             typename AltRetT = typename Func::ReturnType>
   typename detail::ResultTraits<AltRetT>::ErrorReturnType
@@ -1332,6 +1380,68 @@ private:
   uint32_t NumOutstandingCalls;
 };
 
+/// @brief Convenience class for grouping RPC Functions into APIs that can be
+///        negotiated as a block.
+///
+template <typename... Funcs>
+class APICalls {
+public:
+
+  /// @brief Test whether this API contains Function F.
+  template <typename F>
+  class Contains {
+  public:
+    static const bool value = false;
+  };
+
+  /// @brief Negotiate all functions in this API.
+  template <typename RPCEndpoint>
+  static Error negotiate(RPCEndpoint &R) {
+    return Error::success();
+  }
+};
+
+template <typename Func, typename... Funcs>
+class APICalls<Func, Funcs...> {
+public:
+
+  template <typename F>
+  class Contains {
+  public:
+    static const bool value = std::is_same<F, Func>::value |
+                              APICalls<Funcs...>::template Contains<F>::value;
+  };
+
+  template <typename RPCEndpoint>
+  static Error negotiate(RPCEndpoint &R) {
+    if (auto Err = R.template negotiateFunction<Func>())
+      return Err;
+    return APICalls<Funcs...>::negotiate(R);
+  }
+
+};
+
+template <typename... InnerFuncs, typename... Funcs>
+class APICalls<APICalls<InnerFuncs...>, Funcs...> {
+public:
+
+  template <typename F>
+  class Contains {
+  public:
+    static const bool value =
+      APICalls<InnerFuncs...>::template Contains<F>::value |
+      APICalls<Funcs...>::template Contains<F>::value;
+  };
+
+  template <typename RPCEndpoint>
+  static Error negotiate(RPCEndpoint &R) {
+    if (auto Err = APICalls<InnerFuncs...>::negotiate(R))
+      return Err;
+    return APICalls<Funcs...>::negotiate(R);
+  }
+
+};
+
 } // end namespace rpc
 } // end namespace orc
 } // end namespace llvm

Modified: vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RawByteChannel.h
==============================================================================
--- vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RawByteChannel.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RawByteChannel.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -48,9 +48,7 @@ public:
   template <typename FunctionIdT, typename SequenceIdT>
   Error startSendMessage(const FunctionIdT &FnId, const SequenceIdT &SeqNo) {
     writeLock.lock();
-    if (auto Err = serializeSeq(*this, FnId, SeqNo))
-      return Err;
-    return Error::success();
+    return serializeSeq(*this, FnId, SeqNo);
   }
 
   /// Notify the channel that we're ending a message send.

Modified: vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndexYAML.h
==============================================================================
--- vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndexYAML.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndexYAML.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -28,14 +28,14 @@ template <> struct ScalarEnumerationTrai
 
 template <> struct MappingTraits<TypeTestResolution> {
   static void mapping(IO &io, TypeTestResolution &res) {
-    io.mapRequired("Kind", res.TheKind);
-    io.mapRequired("SizeBitWidth", res.SizeBitWidth);
+    io.mapOptional("Kind", res.TheKind);
+    io.mapOptional("SizeBitWidth", res.SizeBitWidth);
   }
 };
 
 template <> struct MappingTraits<TypeIdSummary> {
   static void mapping(IO &io, TypeIdSummary& summary) {
-    io.mapRequired("TTRes", summary.TTRes);
+    io.mapOptional("TTRes", summary.TTRes);
   }
 };
 
@@ -53,7 +53,7 @@ namespace yaml {
 
 template <> struct MappingTraits<FunctionSummaryYaml> {
   static void mapping(IO &io, FunctionSummaryYaml& summary) {
-    io.mapRequired("TypeTests", summary.TypeTests);
+    io.mapOptional("TypeTests", summary.TypeTests);
   }
 };
 
@@ -100,8 +100,8 @@ template <> struct CustomMappingTraits<G
 
 template <> struct MappingTraits<ModuleSummaryIndex> {
   static void mapping(IO &io, ModuleSummaryIndex& index) {
-    io.mapRequired("GlobalValueMap", index.GlobalValueMap);
-    io.mapRequired("TypeIdMap", index.TypeIdMap);
+    io.mapOptional("GlobalValueMap", index.GlobalValueMap);
+    io.mapOptional("TypeIdMap", index.TypeIdMap);
   }
 };
 

Modified: vendor/llvm/dist/include/llvm/IR/PassManager.h
==============================================================================
--- vendor/llvm/dist/include/llvm/IR/PassManager.h	Mon Jan  9 20:51:51 2017	(r311817)
+++ vendor/llvm/dist/include/llvm/IR/PassManager.h	Mon Jan  9 21:23:09 2017	(r311818)
@@ -879,18 +879,22 @@ extern template class AnalysisManager<Fu
 /// \brief Convenience typedef for the Function analysis manager.
 typedef AnalysisManager<Function> FunctionAnalysisManager;
 
-/// \brief A module analysis which acts as a proxy for a function analysis
-/// manager.
+/// \brief An analysis over an "outer" IR unit that provides access to an
+/// analysis manager over an "inner" IR unit.  The inner unit must be contained
+/// in the outer unit.
+///
+/// Fore example, InnerAnalysisManagerProxy<FunctionAnalysisManager, Module> is
+/// an analysis over Modules (the "outer" unit) that provides access to a
+/// Function analysis manager.  The FunctionAnalysisManager is the "inner"
+/// manager being proxied, and Functions are the "inner" unit.  The inner/outer
+/// relationship is valid because each Function is contained in one Module.
+///
+/// If you're (transitively) within a pass manager for an IR unit U that
+/// contains IR unit V, you should never use an analysis manager over V, except
+/// via one of these proxies.
 ///
-/// This primarily proxies invalidation information from the module analysis
-/// manager and module pass manager to a function analysis manager. You should
-/// never use a function analysis manager from within (transitively) a module
-/// pass manager unless your parent module pass has received a proxy result
-/// object for it.
-///
-/// Note that the proxy's result is a move-only object and represents ownership
-/// of the validity of the analyses in the \c FunctionAnalysisManager it
-/// provides.
+/// Note that the proxy's result is a move-only RAII object.  The validity of
+/// the analyses in the inner analysis manager is tied to its lifetime.
 template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
 class InnerAnalysisManagerProxy
     : public AnalysisInfoMixin<
@@ -926,23 +930,16 @@ public:
     /// \brief Accessor for the analysis manager.
     AnalysisManagerT &getManager() { return *InnerAM; }
 
-    /// \brief Handler for invalidation of the outer IR unit.
+    /// \brief Handler for invalidation of the outer IR unit, \c IRUnitT.
     ///
-    /// If this analysis itself is preserved, then we assume that the set of \c
-    /// IR units that the inner analysis manager controls hasn't changed and
-    /// thus we don't need to invalidate *all* cached data associated with any
-    /// \c IRUnitT* in the \c AnalysisManagerT.
+    /// If the proxy analysis itself is not preserved, we assume that the set of
+    /// inner IR objects contained in IRUnit may have changed.  In this case,
+    /// we have to call \c clear() on the inner analysis manager, as it may now
+    /// have stale pointers to its inner IR objects.
     ///
-    /// Regardless of whether this analysis is marked as preserved, all of the
-    /// analyses in the \c AnalysisManagerT are potentially invalidated (for
-    /// the relevant inner set of their IR units) based on the set of preserved
-    /// analyses.
-    ///
-    /// Because this needs to understand the mapping from one IR unit to an
-    /// inner IR unit, this method isn't defined in the primary template.
-    /// Instead, each specialization of this template will need to provide an
-    /// explicit specialization of this method to handle that particular pair
-    /// of IR unit and inner AnalysisManagerT.
+    /// Regardless of whether the proxy analysis is marked as preserved, all of
+    /// the analyses in the inner analysis manager are potentially invalidated
+    /// based on the set of preserved analyses.
     bool invalidate(
         IRUnitT &IR, const PreservedAnalyses &PA,
         typename AnalysisManager<IRUnitT, ExtraArgTs...>::Invalidator &Inv);
@@ -956,13 +953,9 @@ public:
 
   /// \brief Run the analysis pass and create our proxy result object.
   ///
-  /// This doesn't do any interesting work, it is primarily used to insert our
-  /// proxy result object into the module analysis cache so that we can proxy
-  /// invalidation to the function analysis manager.
-  ///
-  /// In debug builds, it will also assert that the analysis manager is empty
-  /// as no queries should arrive at the function analysis manager prior to
-  /// this analysis being requested.
+  /// This doesn't do any interesting work; it is primarily used to insert our
+  /// proxy result object into the outer analysis cache so that we can proxy
+  /// invalidation to the inner analysis manager.
   Result run(IRUnitT &IR, AnalysisManager<IRUnitT, ExtraArgTs...> &AM,
              ExtraArgTs...) {
     return Result(*InnerAM);
@@ -996,22 +989,24 @@ bool FunctionAnalysisManagerModuleProxy:
 extern template class InnerAnalysisManagerProxy<FunctionAnalysisManager,
                                                 Module>;
 
-/// \brief A function analysis which acts as a proxy for a module analysis
-/// manager.
-///
-/// This primarily provides an accessor to a parent module analysis manager to
-/// function passes. Only the const interface of the module analysis manager is
-/// provided to indicate that once inside of a function analysis pass you
-/// cannot request a module analysis to actually run. Instead, the user must
-/// rely on the \c getCachedResult API.
-///
-/// The invalidation provided by this proxy involves tracking when an
-/// invalidation event in the outer analysis manager needs to trigger an
-/// invalidation of a particular analysis on this IR unit.
-///
-/// Because outer analyses aren't invalidated while these IR units are being
-/// precessed, we have to register and handle these as deferred invalidation
-/// events.
+/// \brief An analysis over an "inner" IR unit that provides access to an
+/// analysis manager over a "outer" IR unit.  The inner unit must be contained
+/// in the outer unit.
+///
+/// For example OuterAnalysisManagerProxy<ModuleAnalysisManager, Function> is an
+/// analysis over Functions (the "inner" unit) which provides access to a Module
+/// analysis manager.  The ModuleAnalysisManager is the "outer" manager being
+/// proxied, and Modules are the "outer" IR unit.  The inner/outer relationship
+/// is valid because each Function is contained in one Module.
+///
+/// This proxy only exposes the const interface of the outer analysis manager,
+/// to indicate that you cannot cause an outer analysis to run from within an
+/// inner pass.  Instead, you must rely on the \c getCachedResult API.
+///
+/// This proxy doesn't manage invalidation in any way -- that is handled by the
+/// recursive return path of each layer of the pass manager.  A consequence of
+/// this is the outer analyses may be stale.  We invalidate the outer analyses
+/// only when we're done running passes over the inner IR units.
 template <typename AnalysisManagerT, typename IRUnitT, typename... ExtraArgTs>
 class OuterAnalysisManagerProxy
     : public AnalysisInfoMixin<
@@ -1024,7 +1019,7 @@ public:
 
     const AnalysisManagerT &getManager() const { return *AM; }
 
-    /// \brief Handle invalidation by ignoring it, this pass is immutable.
+    /// \brief Handle invalidation by ignoring it; this pass is immutable.
     bool invalidate(
         IRUnitT &, const PreservedAnalyses &,
         typename AnalysisManager<IRUnitT, ExtraArgTs...>::Invalidator &) {
@@ -1089,18 +1084,15 @@ AnalysisKey
 
 extern template class OuterAnalysisManagerProxy<ModuleAnalysisManager,
                                                 Function>;
-/// Provide the \c ModuleAnalysisManager to \c Fucntion proxy.
+/// Provide the \c ModuleAnalysisManager to \c Function proxy.
 typedef OuterAnalysisManagerProxy<ModuleAnalysisManager, Function>
     ModuleAnalysisManagerFunctionProxy;
 
 /// \brief Trivial adaptor that maps from a module to its functions.
 ///
 /// Designed to allow composition of a FunctionPass(Manager) and
-/// a ModulePassManager. Note that if this pass is constructed with a pointer
-/// to a \c ModuleAnalysisManager it will run the
-/// \c FunctionAnalysisManagerModuleProxy analysis prior to running the function
-/// pass over the module to enable a \c FunctionAnalysisManager to be used
-/// within this run safely.
+/// a ModulePassManager, by running the FunctionPass(Manager) over every
+/// function in the module.
 ///
 /// Function passes run within this adaptor can rely on having exclusive access
 /// to the function they are run over. They should not read or modify any other
@@ -1115,6 +1107,10 @@ typedef OuterAnalysisManagerProxy<Module
 /// module.
 /// FIXME: Make the above true for all of LLVM's actual passes, some still
 /// violate this principle.
+///
+/// Note that although function passes can access module analyses, module
+/// analyses are not invalidated while the function passes are running, so they
+/// may be stale.  Function analyses will not be stale.
 template <typename FunctionPassT>
 class ModuleToFunctionPassAdaptor
     : public PassInfoMixin<ModuleToFunctionPassAdaptor<FunctionPassT>> {
@@ -1124,7 +1120,6 @@ public:
 
   /// \brief Runs the function pass across every function in the module.
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
-    // Setup the function analysis manager from its proxy.
     FunctionAnalysisManager &FAM =
         AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
 
@@ -1145,10 +1140,11 @@ public:
       PA.intersect(std::move(PassPA));
     }
 
-    // By definition we preserve the proxy. We also preserve all analyses on
-    // Function units. This precludes *any* invalidation of function analyses
-    // by the proxy, but that's OK because we've taken care to invalidate
-    // analyses in the function analysis manager incrementally above.
+    // The FunctionAnalysisManagerModuleProxy is preserved because (we assume)
+    // the function passes we ran didn't add or remove any functions.
+    //
+    // We also preserve all analyses on Functions, because we did all the
+    // invalidation we needed to do above.
     PA.preserveSet<AllAnalysesOn<Function>>();
     PA.preserve<FunctionAnalysisManagerModuleProxy>();
     return PA;
@@ -1166,7 +1162,7 @@ createModuleToFunctionPassAdaptor(Functi
   return ModuleToFunctionPassAdaptor<FunctionPassT>(std::move(Pass));
 }
 
-/// \brief A template utility pass to force an analysis result to be available.
+/// \brief A utility pass template to force an analysis result to be available.
 ///
 /// If there are extra arguments at the pass's run level there may also be
 /// extra arguments to the analysis manager's \c getResult routine. We can't
@@ -1196,17 +1192,14 @@ struct RequireAnalysisPass
   }
 };
 
-/// \brief A template utility pass to force an analysis result to be
-/// invalidated.
-///
-/// This is a no-op pass which simply forces a specific analysis result to be
-/// invalidated when it is run.
+/// \brief A no-op pass template which simply forces a specific analysis result
+/// to be invalidated.
 template <typename AnalysisT>
 struct InvalidateAnalysisPass
     : PassInfoMixin<InvalidateAnalysisPass<AnalysisT>> {
   /// \brief Run this pass over some unit of IR.
   ///
-  /// This pass can be run over any unit of IR and use any analysis manager
+  /// This pass can be run over any unit of IR and use any analysis manager,
   /// provided they satisfy the basic API requirements. When this pass is
   /// created, these methods can be instantiated to satisfy whatever the
   /// context requires.
@@ -1218,10 +1211,10 @@ struct InvalidateAnalysisPass
   }
 };
 
-/// \brief A utility pass that does nothing but preserves no analyses.
+/// \brief A utility pass that does nothing, but preserves no analyses.
 ///
-/// As a consequence fo not preserving any analyses, this pass will force all
-/// analysis passes to be re-run to produce fresh results if any are needed.
+/// Because this preserves no analyses, any analysis passes queried after this
+/// pass runs will recompute fresh results.
 struct InvalidateAllAnalysesPass : PassInfoMixin<InvalidateAllAnalysesPass> {
   /// \brief Run this pass over some unit of IR.
   template <typename IRUnitT, typename AnalysisManagerT, typename... ExtraArgTs>

Modified: vendor/llvm/dist/include/llvm/IR/User.h
==============================================================================
--- vendor/llvm/dist/include/llvm/IR/User.h	Mon Jan  9 20:51:51 2017	(r311817)

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


More information about the svn-src-all mailing list