Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Sep 2018 18:50:41 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r338597 - in projects/clang700-import: contrib/compiler-rt/lib/sanitizer_common contrib/libc++/include contrib/llvm/lib/MC/MCParser contrib/llvm/lib/Support/Unix contrib/llvm/lib/Target...
Message-ID:  <201809111850.w8BIofXU099138@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Tue Sep 11 18:50:40 2018
New Revision: 338597
URL: https://svnweb.freebsd.org/changeset/base/338597

Log:
  Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch
  r341916, resolve conflicts, and bump version numbers.
  
  PR:		230240, 230355

Modified:
  projects/clang700-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
  projects/clang700-import/contrib/libc++/include/memory
  projects/clang700-import/contrib/libc++/include/regex
  projects/clang700-import/contrib/llvm/lib/MC/MCParser/AsmParser.cpp
  projects/clang700-import/contrib/llvm/lib/Support/Unix/Path.inc
  projects/clang700-import/contrib/llvm/lib/Support/Unix/Process.inc
  projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPU.h
  projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
  projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
  projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
  projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp
  projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrFormats.td
  projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td
  projects/clang700-import/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h
  projects/clang700-import/contrib/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
  projects/clang700-import/contrib/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
  projects/clang700-import/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
  projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopSink.cpp
  projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/SROA.cpp
  projects/clang700-import/contrib/llvm/lib/Transforms/Utils/CloneFunction.cpp
  projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
  projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.cpp
  projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.h
  projects/clang700-import/contrib/llvm/tools/lld/docs/ReleaseNotes.rst
  projects/clang700-import/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
  projects/clang700-import/lib/clang/include/clang/Basic/Version.inc
  projects/clang700-import/lib/clang/include/lld/Common/Version.inc
  projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h
Directory Properties:
  projects/clang700-import/contrib/compiler-rt/   (props changed)
  projects/clang700-import/contrib/libc++/   (props changed)
  projects/clang700-import/contrib/llvm/   (props changed)
  projects/clang700-import/contrib/llvm/tools/clang/   (props changed)
  projects/clang700-import/contrib/llvm/tools/lld/   (props changed)
  projects/clang700-import/contrib/llvm/tools/lldb/   (props changed)

Modified: projects/clang700-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
==============================================================================
--- projects/clang700-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc	Tue Sep 11 18:50:40 2018	(r338597)
@@ -1037,7 +1037,11 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len);
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
 
-#if SANITIZER_LINUX && (!defined(__ANDROID__) || __ANDROID_API__ >= 21)
+#ifndef __GLIBC_PREREQ
+#define __GLIBC_PREREQ(x, y) 0
+#endif
+
+#if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
 CHECK_TYPE_SIZE(mmsghdr);
 CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
 CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
@@ -1078,9 +1082,6 @@ COMPILER_CHECK(sizeof(__sanitizer_sigaction) == sizeof
 // Can't write checks for sa_handler and sa_sigaction due to them being
 // preprocessor macros.
 CHECK_STRUCT_SIZE_AND_OFFSET(sigaction, sa_mask);
-#ifndef __GLIBC_PREREQ
-#define __GLIBC_PREREQ(x, y) 0
-#endif
 #if !defined(__s390x__) || __GLIBC_PREREQ (2, 20)
 // On s390x glibc 2.19 and earlier sa_flags was unsigned long, and sa_resv
 // didn't exist.

Modified: projects/clang700-import/contrib/libc++/include/memory
==============================================================================
--- projects/clang700-import/contrib/libc++/include/memory	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/libc++/include/memory	Tue Sep 11 18:50:40 2018	(r338597)
@@ -1989,10 +1989,10 @@ class _LIBCPP_TEMPLATE_VIS raw_storage_iterator (publi
     _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
-        {::new(&*__x_) _Tp(__element); return *this;}
+        {::new(_VSTD::addressof(*__x_)) _Tp(__element); return *this;}
 #if _LIBCPP_STD_VER >= 14
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
-        {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
+        {::new(_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;}
 #endif
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
     _LIBCPP_INLINE_VISIBILITY raw_storage_iterator  operator++(int)
@@ -3682,7 +3682,7 @@ class __shared_ptr_emplace (private)
     virtual void __on_zero_shared_weak() _NOEXCEPT;
 public:
     _LIBCPP_INLINE_VISIBILITY
-    _Tp* get() _NOEXCEPT {return &__data_.second();}
+    _Tp* get() _NOEXCEPT {return _VSTD::addressof(__data_.second());}
 };
 
 template <class _Tp, class _Alloc>

Modified: projects/clang700-import/contrib/libc++/include/regex
==============================================================================
--- projects/clang700-import/contrib/libc++/include/regex	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/libc++/include/regex	Tue Sep 11 18:50:40 2018	(r338597)
@@ -2414,20 +2414,17 @@ __bracket_expression<_CharT, _Traits>::__exec(__state&
                 goto __exit;
             }
         }
-        // set of "__found" chars =
+        // When there's at least one of __neg_chars_ and __neg_mask_, the set
+        // of "__found" chars is
         //   union(complement(union(__neg_chars_, __neg_mask_)),
         //         other cases...)
         //
-        // __neg_chars_ and __neg_mask_'d better be handled together, as there
-        // are no short circuit opportunities.
-        //
-        // In addition, when __neg_mask_/__neg_chars_ is empty, they should be
-        // treated as all ones/all chars.
+        // It doesn't make sense to check this when there are no __neg_chars_
+        // and no __neg_mask_.
+        if (!(__neg_mask_ == 0 && __neg_chars_.empty()))
         {
-          const bool __in_neg_mask = (__neg_mask_ == 0) ||
-              __traits_.isctype(__ch, __neg_mask_);
+            const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
           const bool __in_neg_chars =
-              __neg_chars_.empty() ||
               std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
               __neg_chars_.end();
           if (!(__in_neg_mask || __in_neg_chars))

Modified: projects/clang700-import/contrib/llvm/lib/MC/MCParser/AsmParser.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/MC/MCParser/AsmParser.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/MC/MCParser/AsmParser.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -3348,17 +3348,17 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc)
     }
   }
 
-  // In case there is a -g option as well as debug info from directive .file,
-  // we turn off the -g option, directly use the existing debug info instead.
-  // Also reset any implicit ".file 0" for the assembler source.
-  if (Ctx.getGenDwarfForAssembly()) {
-    Ctx.getMCDwarfLineTable(0).resetRootFile();
-    Ctx.setGenDwarfForAssembly(false);
-  }
-
   if (FileNumber == -1)
     getStreamer().EmitFileDirective(Filename);
   else {
+    // In case there is a -g option as well as debug info from directive .file,
+    // we turn off the -g option, directly use the existing debug info instead.
+    // Also reset any implicit ".file 0" for the assembler source.
+    if (Ctx.getGenDwarfForAssembly()) {
+      Ctx.getMCDwarfLineTable(0).resetRootFile();
+      Ctx.setGenDwarfForAssembly(false);
+    }
+
     MD5::MD5Result *CKMem = nullptr;
     if (HasMD5) {
       CKMem = (MD5::MD5Result *)Ctx.allocate(sizeof(MD5::MD5Result), 1);

Modified: projects/clang700-import/contrib/llvm/lib/Support/Unix/Path.inc
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Support/Unix/Path.inc	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Support/Unix/Path.inc	Tue Sep 11 18:50:40 2018	(r338597)
@@ -769,8 +769,10 @@ std::error_code openFile(const Twine &Name, int &Resul
 
   SmallString<128> Storage;
   StringRef P = Name.toNullTerminatedStringRef(Storage);
-  if ((ResultFD = sys::RetryAfterSignal(-1, ::open, P.begin(), OpenFlags, Mode)) <
-      0)
+  // Call ::open in a lambda to avoid overload resolution in RetryAfterSignal
+  // when open is overloaded, such as in Bionic.
+  auto Open = [&]() { return ::open(P.begin(), OpenFlags, Mode); };
+  if ((ResultFD = sys::RetryAfterSignal(-1, Open)) < 0)
     return std::error_code(errno, std::generic_category());
 #ifndef O_CLOEXEC
   if (!(Flags & OF_ChildInherit)) {

Modified: projects/clang700-import/contrib/llvm/lib/Support/Unix/Process.inc
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Support/Unix/Process.inc	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Support/Unix/Process.inc	Tue Sep 11 18:50:40 2018	(r338597)
@@ -211,7 +211,10 @@ std::error_code Process::FixupStandardFileDescriptors(
     assert(errno == EBADF && "expected errno to have EBADF at this point!");
 
     if (NullFD < 0) {
-      if ((NullFD = RetryAfterSignal(-1, ::open, "/dev/null", O_RDWR)) < 0)
+      // Call ::open in a lambda to avoid overload resolution in
+      // RetryAfterSignal when open is overloaded, such as in Bionic.
+      auto Open = [&]() { return ::open("/dev/null", O_RDWR); };
+      if ((NullFD = RetryAfterSignal(-1, Open)) < 0)
         return std::error_code(errno, std::generic_category());
     }
 

Modified: projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPU.h
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPU.h	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPU.h	Tue Sep 11 18:50:40 2018	(r338597)
@@ -229,7 +229,7 @@ struct AMDGPUAS {
 
   enum : unsigned {
     // The maximum value for flat, generic, local, private, constant and region.
-    MAX_COMMON_ADDRESS = 5,
+    MAX_AMDGPU_ADDRESS = 6,
 
     GLOBAL_ADDRESS = 1,   ///< Address space for global memory (RAT0, VTX0).
     CONSTANT_ADDRESS = 4, ///< Address space for constant memory (VTX2)

Modified: projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -50,47 +50,51 @@ void AMDGPUAAWrapperPass::getAnalysisUsage(AnalysisUsa
 AMDGPUAAResult::ASAliasRulesTy::ASAliasRulesTy(AMDGPUAS AS_, Triple::ArchType Arch_)
   : Arch(Arch_), AS(AS_) {
   // These arrarys are indexed by address space value
-  // enum elements 0 ... to 5
-  static const AliasResult ASAliasRulesPrivIsZero[6][6] = {
-  /*             Private    Global    Constant  Group     Flat      Region*/
-  /* Private  */ {MayAlias, NoAlias , NoAlias , NoAlias , MayAlias, NoAlias},
-  /* Global   */ {NoAlias , MayAlias, NoAlias , NoAlias , MayAlias, NoAlias},
-  /* Constant */ {NoAlias , NoAlias , MayAlias, NoAlias , MayAlias, NoAlias},
-  /* Group    */ {NoAlias , NoAlias , NoAlias , MayAlias, MayAlias, NoAlias},
-  /* Flat     */ {MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias},
-  /* Region   */ {NoAlias , NoAlias , NoAlias , NoAlias , MayAlias, MayAlias}
+  // enum elements 0 ... to 6
+  static const AliasResult ASAliasRulesPrivIsZero[7][7] = {
+  /*                    Private    Global    Constant  Group     Flat      Region    Constant 32-bit */
+  /* Private  */        {MayAlias, NoAlias , NoAlias , NoAlias , MayAlias, NoAlias , NoAlias},
+  /* Global   */        {NoAlias , MayAlias, MayAlias, NoAlias , MayAlias, NoAlias , MayAlias},
+  /* Constant */        {NoAlias , MayAlias, MayAlias, NoAlias , MayAlias, NoAlias , MayAlias},
+  /* Group    */        {NoAlias , NoAlias , NoAlias , MayAlias, MayAlias, NoAlias , NoAlias},
+  /* Flat     */        {MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias},
+  /* Region   */        {NoAlias , NoAlias , NoAlias , NoAlias , MayAlias, MayAlias, NoAlias},
+  /* Constant 32-bit */ {NoAlias , MayAlias, MayAlias, NoAlias , MayAlias, NoAlias , MayAlias}
   };
-  static const AliasResult ASAliasRulesGenIsZero[6][6] = {
-  /*             Flat       Global    Region    Group     Constant  Private */
-  /* Flat     */ {MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias},
-  /* Global   */ {MayAlias, MayAlias, NoAlias , NoAlias , NoAlias , NoAlias},
-  /* Constant */ {MayAlias, NoAlias , MayAlias, NoAlias , NoAlias,  NoAlias},
-  /* Group    */ {MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , NoAlias},
-  /* Region   */ {MayAlias, NoAlias , NoAlias , NoAlias,  MayAlias, NoAlias},
-  /* Private  */ {MayAlias, NoAlias , NoAlias , NoAlias , NoAlias , MayAlias}
+  static const AliasResult ASAliasRulesGenIsZero[7][7] = {
+  /*                    Flat       Global    Region    Group     Constant  Private   Constant 32-bit */
+  /* Flat     */        {MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias, MayAlias},
+  /* Global   */        {MayAlias, MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , MayAlias},
+  /* Region   */        {MayAlias, NoAlias , NoAlias , NoAlias,  MayAlias, NoAlias , MayAlias},
+  /* Group    */        {MayAlias, NoAlias , NoAlias , MayAlias, NoAlias , NoAlias , NoAlias},
+  /* Constant */        {MayAlias, MayAlias, MayAlias, NoAlias , NoAlias,  NoAlias , MayAlias},
+  /* Private  */        {MayAlias, NoAlias , NoAlias , NoAlias , NoAlias , MayAlias, NoAlias},
+  /* Constant 32-bit */ {MayAlias, MayAlias, MayAlias, NoAlias , MayAlias, NoAlias , NoAlias}
   };
-  assert(AS.MAX_COMMON_ADDRESS <= 5);
+  static_assert(AMDGPUAS::MAX_AMDGPU_ADDRESS <= 6, "Addr space out of range");
   if (AS.FLAT_ADDRESS == 0) {
-    assert(AS.GLOBAL_ADDRESS   == 1 &&
-           AS.REGION_ADDRESS   == 2 &&
-           AS.LOCAL_ADDRESS    == 3 &&
-           AS.CONSTANT_ADDRESS == 4 &&
-           AS.PRIVATE_ADDRESS  == 5);
+    assert(AS.GLOBAL_ADDRESS         == 1 &&
+           AS.REGION_ADDRESS         == 2 &&
+           AS.LOCAL_ADDRESS          == 3 &&
+           AS.CONSTANT_ADDRESS       == 4 &&
+           AS.PRIVATE_ADDRESS        == 5 &&
+           AS.CONSTANT_ADDRESS_32BIT == 6);
     ASAliasRules = &ASAliasRulesGenIsZero;
   } else {
-    assert(AS.PRIVATE_ADDRESS  == 0 &&
-           AS.GLOBAL_ADDRESS   == 1 &&
-           AS.CONSTANT_ADDRESS == 2 &&
-           AS.LOCAL_ADDRESS    == 3 &&
-           AS.FLAT_ADDRESS     == 4 &&
-           AS.REGION_ADDRESS   == 5);
+    assert(AS.PRIVATE_ADDRESS        == 0 &&
+           AS.GLOBAL_ADDRESS         == 1 &&
+           AS.CONSTANT_ADDRESS       == 2 &&
+           AS.LOCAL_ADDRESS          == 3 &&
+           AS.FLAT_ADDRESS           == 4 &&
+           AS.REGION_ADDRESS         == 5 &&
+           AS.CONSTANT_ADDRESS_32BIT == 6);
     ASAliasRules = &ASAliasRulesPrivIsZero;
   }
 }
 
 AliasResult AMDGPUAAResult::ASAliasRulesTy::getAliasResult(unsigned AS1,
     unsigned AS2) const {
-  if (AS1 > AS.MAX_COMMON_ADDRESS || AS2 > AS.MAX_COMMON_ADDRESS) {
+  if (AS1 > AS.MAX_AMDGPU_ADDRESS || AS2 > AS.MAX_AMDGPU_ADDRESS) {
     if (Arch == Triple::amdgcn)
       report_fatal_error("Pointer address space out of range");
     return AS1 == AS2 ? MayAlias : NoAlias;

Modified: projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.h	Tue Sep 11 18:50:40 2018	(r338597)
@@ -63,7 +63,7 @@ class AMDGPUAAResult : public AAResultBase<AMDGPUAARes
   private:
     Triple::ArchType Arch;
     AMDGPUAS AS;
-    const AliasResult (*ASAliasRules)[6][6];
+    const AliasResult (*ASAliasRules)[7][7];
   } ASAliasRules;
 };
 

Modified: projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -1451,7 +1451,11 @@ bool AMDGPUDAGToDAGISel::SelectSMRD(SDValue Addr, SDVa
                                      SDValue &Offset, bool &Imm) const {
   SDLoc SL(Addr);
 
-  if (CurDAG->isBaseWithConstantOffset(Addr)) {
+  // A 32-bit (address + offset) should not cause unsigned 32-bit integer
+  // wraparound, because s_load instructions perform the addition in 64 bits.
+  if ((Addr.getValueType() != MVT::i32 ||
+       Addr->getFlags().hasNoUnsignedWrap()) &&
+      CurDAG->isBaseWithConstantOffset(Addr)) {
     SDValue N0 = Addr.getOperand(0);
     SDValue N1 = Addr.getOperand(1);
 

Modified: projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -1514,6 +1514,7 @@ static unsigned estimateRSStackSizeLimit(MachineFuncti
           break;
         case ARMII::AddrMode5:
         case ARMII::AddrModeT2_i8s4:
+        case ARMII::AddrModeT2_ldrex:
           Limit = std::min(Limit, ((1U << 8) - 1) * 4);
           break;
         case ARMII::AddrModeT2_i12:

Modified: projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrFormats.td
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrFormats.td	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrFormats.td	Tue Sep 11 18:50:40 2018	(r338597)
@@ -109,6 +109,7 @@ def AddrModeT2_pc   : AddrMode<14>;
 def AddrModeT2_i8s4 : AddrMode<15>;
 def AddrMode_i12    : AddrMode<16>;
 def AddrMode5FP16   : AddrMode<17>;
+def AddrModeT2_ldrex : AddrMode<18>;
 
 // Load / store index mode.
 class IndexMode<bits<2> val> {

Modified: projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td	Tue Sep 11 18:50:40 2018	(r338597)
@@ -3267,7 +3267,7 @@ def t2LDREXH : T2I_ldrex<0b0101, (outs rGPR:$Rt), (ins
                          [(set rGPR:$Rt, (ldrex_2 addr_offset_none:$addr))]>,
                Requires<[IsThumb, HasV8MBaseline]>;
 def t2LDREX  : Thumb2I<(outs rGPR:$Rt), (ins t2addrmode_imm0_1020s4:$addr),
-                       AddrModeNone, 4, NoItinerary,
+                       AddrModeT2_ldrex, 4, NoItinerary,
                        "ldrex", "\t$Rt, $addr", "",
                      [(set rGPR:$Rt, (ldrex_4 t2addrmode_imm0_1020s4:$addr))]>,
                Requires<[IsThumb, HasV8MBaseline]> {
@@ -3346,7 +3346,7 @@ def t2STREXH : T2I_strex<0b0101, (outs rGPR:$Rd),
 
 def t2STREX  : Thumb2I<(outs rGPR:$Rd), (ins rGPR:$Rt,
                              t2addrmode_imm0_1020s4:$addr),
-                  AddrModeNone, 4, NoItinerary,
+                  AddrModeT2_ldrex, 4, NoItinerary,
                   "strex", "\t$Rd, $Rt, $addr", "",
                   [(set rGPR:$Rd,
                         (strex_4 rGPR:$Rt, t2addrmode_imm0_1020s4:$addr))]>,

Modified: projects/clang700-import/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h	Tue Sep 11 18:50:40 2018	(r338597)
@@ -201,7 +201,8 @@ namespace ARMII {
     AddrModeT2_pc   = 14, // +/- i12 for pc relative data
     AddrModeT2_i8s4 = 15, // i8 * 4
     AddrMode_i12    = 16,
-    AddrMode5FP16   = 17  // i8 * 2
+    AddrMode5FP16   = 17,  // i8 * 2
+    AddrModeT2_ldrex = 18, // i8 * 4, with unscaled offset in MCInst
   };
 
   inline static const char *AddrModeToString(AddrMode addrmode) {
@@ -224,6 +225,7 @@ namespace ARMII {
     case AddrModeT2_pc:   return "AddrModeT2_pc";
     case AddrModeT2_i8s4: return "AddrModeT2_i8s4";
     case AddrMode_i12:    return "AddrMode_i12";
+    case AddrModeT2_ldrex:return "AddrModeT2_ldrex";
     }
   }
 

Modified: projects/clang700-import/contrib/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -621,6 +621,11 @@ bool llvm::rewriteT2FrameIndex(MachineInstr &MI, unsig
       // MCInst operand expects already scaled value.
       Scale = 1;
       assert((Offset & 3) == 0 && "Can't encode this offset!");
+    } else if (AddrMode == ARMII::AddrModeT2_ldrex) {
+      Offset += MI.getOperand(FrameRegIdx + 1).getImm() * 4;
+      NumBits = 8; // 8 bits scaled by 4
+      Scale = 4;
+      assert((Offset & 3) == 0 && "Can't encode this offset!");
     } else {
       llvm_unreachable("Unsupported addressing mode!");
     }

Modified: projects/clang700-import/contrib/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -10,6 +10,8 @@
 #include "MCTargetDesc/BPFMCTargetDesc.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCAsmBackend.h"
+#include "llvm/MC/MCAssembler.h"
+#include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCFixup.h"
 #include "llvm/MC/MCObjectWriter.h"
 #include "llvm/Support/EndianStream.h"
@@ -71,7 +73,12 @@ void BPFAsmBackend::applyFixup(const MCAssembler &Asm,
                                bool IsResolved,
                                const MCSubtargetInfo *STI) const {
   if (Fixup.getKind() == FK_SecRel_4 || Fixup.getKind() == FK_SecRel_8) {
-    assert(Value == 0);
+    if (Value) {
+      MCContext &Ctx = Asm.getContext();
+      Ctx.reportError(Fixup.getLoc(),
+                      "Unsupported relocation: try to compile with -O2 or above, "
+                      "or check your static variable usage");
+    }
   } else if (Fixup.getKind() == FK_Data_4) {
     support::endian::write<uint32_t>(&Data[Fixup.getOffset()], Value, Endian);
   } else if (Fixup.getKind() == FK_Data_8) {

Modified: projects/clang700-import/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -1054,7 +1054,7 @@ static bool CheckBaseRegAndIndexRegAndScale(unsigned B
   // RIP/EIP-relative addressing is only supported in 64-bit mode.
   if (!Is64BitMode && BaseReg != 0 &&
       (BaseReg == X86::RIP || BaseReg == X86::EIP)) {
-    ErrMsg = "RIP-relative addressing requires 64-bit mode";
+    ErrMsg = "IP-relative addressing requires 64-bit mode";
     return true;
   }
 
@@ -1099,7 +1099,7 @@ bool X86AsmParser::ParseRegister(unsigned &RegNo,
     // checked.
     // FIXME: Check AH, CH, DH, BH cannot be used in an instruction requiring a
     // REX prefix.
-    if (RegNo == X86::RIZ || RegNo == X86::RIP || RegNo == X86::EIP ||
+    if (RegNo == X86::RIZ || RegNo == X86::RIP ||
         X86MCRegisterClasses[X86::GR64RegClassID].contains(RegNo) ||
         X86II::isX86_64NonExtLowByteReg(RegNo) ||
         X86II::isX86_64ExtendedReg(RegNo))

Modified: projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopSink.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopSink.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopSink.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -152,6 +152,14 @@ findBBsToSinkInto(const Loop &L, const SmallPtrSetImpl
     }
   }
 
+  // Can't sink into blocks that have no valid insertion point.
+  for (BasicBlock *BB : BBsToSinkInto) {
+    if (BB->getFirstInsertionPt() == BB->end()) {
+      BBsToSinkInto.clear();
+      break;
+    }
+  }
+
   // If the total frequency of BBsToSinkInto is larger than preheader frequency,
   // do not sink.
   if (adjustedSumFreq(BBsToSinkInto, BFI) >

Modified: projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/SROA.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/SROA.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/SROA.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -3046,6 +3046,42 @@ class llvm::sroa::AllocaSliceRewriter (private)
     return true;
   }
 
+  void fixLoadStoreAlign(Instruction &Root) {
+    // This algorithm implements the same visitor loop as
+    // hasUnsafePHIOrSelectUse, and fixes the alignment of each load
+    // or store found.
+    SmallPtrSet<Instruction *, 4> Visited;
+    SmallVector<Instruction *, 4> Uses;
+    Visited.insert(&Root);
+    Uses.push_back(&Root);
+    do {
+      Instruction *I = Uses.pop_back_val();
+
+      if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
+        unsigned LoadAlign = LI->getAlignment();
+        if (!LoadAlign)
+          LoadAlign = DL.getABITypeAlignment(LI->getType());
+        LI->setAlignment(std::min(LoadAlign, getSliceAlign()));
+        continue;
+      }
+      if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
+        unsigned StoreAlign = SI->getAlignment();
+        if (!StoreAlign) {
+          Value *Op = SI->getOperand(0);
+          StoreAlign = DL.getABITypeAlignment(Op->getType());
+        }
+        SI->setAlignment(std::min(StoreAlign, getSliceAlign()));
+        continue;
+      }
+
+      assert(isa<BitCastInst>(I) || isa<PHINode>(I) ||
+             isa<SelectInst>(I) || isa<GetElementPtrInst>(I));
+      for (User *U : I->users())
+        if (Visited.insert(cast<Instruction>(U)).second)
+          Uses.push_back(cast<Instruction>(U));
+    } while (!Uses.empty());
+  }
+
   bool visitPHINode(PHINode &PN) {
     LLVM_DEBUG(dbgs() << "    original: " << PN << "\n");
     assert(BeginOffset >= NewAllocaBeginOffset && "PHIs are unsplittable");
@@ -3069,6 +3105,9 @@ class llvm::sroa::AllocaSliceRewriter (private)
     LLVM_DEBUG(dbgs() << "          to: " << PN << "\n");
     deleteIfTriviallyDead(OldPtr);
 
+    // Fix the alignment of any loads or stores using this PHI node.
+    fixLoadStoreAlign(PN);
+
     // PHIs can't be promoted on their own, but often can be speculated. We
     // check the speculation outside of the rewriter so that we see the
     // fully-rewritten alloca.
@@ -3092,6 +3131,9 @@ class llvm::sroa::AllocaSliceRewriter (private)
 
     LLVM_DEBUG(dbgs() << "          to: " << SI << "\n");
     deleteIfTriviallyDead(OldPtr);
+
+    // Fix the alignment of any loads or stores using this select.
+    fixLoadStoreAlign(SI);
 
     // Selects can't be promoted on their own, but often can be speculated. We
     // check the speculation outside of the rewriter so that we see the

Modified: projects/clang700-import/contrib/llvm/lib/Transforms/Utils/CloneFunction.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Transforms/Utils/CloneFunction.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Transforms/Utils/CloneFunction.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -636,6 +636,22 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc
   Function::iterator Begin = cast<BasicBlock>(VMap[StartingBB])->getIterator();
   Function::iterator I = Begin;
   while (I != NewFunc->end()) {
+    // We need to simplify conditional branches and switches with a constant
+    // operand. We try to prune these out when cloning, but if the
+    // simplification required looking through PHI nodes, those are only
+    // available after forming the full basic block. That may leave some here,
+    // and we still want to prune the dead code as early as possible.
+    //
+    // Do the folding before we check if the block is dead since we want code
+    // like
+    //  bb:
+    //    br i1 undef, label %bb, label %bb
+    // to be simplified to
+    //  bb:
+    //    br label %bb
+    // before we call I->getSinglePredecessor().
+    ConstantFoldTerminator(&*I);
+
     // Check if this block has become dead during inlining or other
     // simplifications. Note that the first block will appear dead, as it has
     // not yet been wired up properly.
@@ -645,13 +661,6 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc
       DeleteDeadBlock(DeadBB);
       continue;
     }
-
-    // We need to simplify conditional branches and switches with a constant
-    // operand. We try to prune these out when cloning, but if the
-    // simplification required looking through PHI nodes, those are only
-    // available after forming the full basic block. That may leave some here,
-    // and we still want to prune the dead code as early as possible.
-    ConstantFoldTerminator(&*I);
 
     BranchInst *BI = dyn_cast<BranchInst>(I->getTerminator());
     if (!BI || BI->isConditional()) { ++I; continue; }

Modified: projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -4510,6 +4510,13 @@ void LoopVectorizationCostModel::collectLoopUniforms(u
     for (auto OV : I->operand_values()) {
       if (isOutOfScope(OV))
         continue;
+      // First order recurrence Phi's should typically be considered
+      // non-uniform.
+      auto *OP = dyn_cast<PHINode>(OV);
+      if (OP && Legal->isFirstOrderRecurrence(OP))
+        continue;
+      // If all the users of the operand are uniform, then add the
+      // operand into the uniform worklist.
       auto *OI = cast<Instruction>(OV);
       if (llvm::all_of(OI->users(), [&](User *U) -> bool {
             auto *J = cast<Instruction>(U);

Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -4912,8 +4912,7 @@ ObjCRuntime Clang::AddObjCRuntimeArgs(const ArgList &a
     }
     if ((runtime.getKind() == ObjCRuntime::GNUstep) &&
         (runtime.getVersion() >= VersionTuple(2, 0)))
-      if (!getToolChain().getTriple().isOSBinFormatELF() &&
-          !getToolChain().getTriple().isOSBinFormatCOFF()) {
+      if (!getToolChain().getTriple().isOSBinFormatELF()) {
         getToolChain().getDriver().Diag(
             diag::err_drv_gnustep_objc_runtime_incompatible_binary)
           << runtime.getVersion().getMajor();

Modified: projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.cpp
==============================================================================
--- projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.cpp	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.cpp	Tue Sep 11 18:50:40 2018	(r338597)
@@ -116,6 +116,19 @@ static std::future<MBErrPair> createFutureForFile(std:
   });
 }
 
+// Symbol names are mangled by prepending "_" on x86.
+static StringRef mangle(StringRef Sym) {
+  assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN);
+  if (Config->Machine == I386)
+    return Saver.save("_" + Sym);
+  return Sym;
+}
+
+static bool findUnderscoreMangle(StringRef Sym) {
+  StringRef Entry = Symtab->findMangle(mangle(Sym));
+  return !Entry.empty() && !isa<Undefined>(Symtab->find(Entry));
+}
+
 MemoryBufferRef LinkerDriver::takeBuffer(std::unique_ptr<MemoryBuffer> MB) {
   MemoryBufferRef MBRef = *MB;
   make<std::unique_ptr<MemoryBuffer>>(std::move(MB)); // take ownership
@@ -407,54 +420,38 @@ Symbol *LinkerDriver::addUndefined(StringRef Name) {
   return B;
 }
 
-// Symbol names are mangled by appending "_" prefix on x86.
-StringRef LinkerDriver::mangle(StringRef Sym) {
-  assert(Config->Machine != IMAGE_FILE_MACHINE_UNKNOWN);
-  if (Config->Machine == I386)
-    return Saver.save("_" + Sym);
-  return Sym;
-}
-
 // Windows specific -- find default entry point name.
 //
 // There are four different entry point functions for Windows executables,
 // each of which corresponds to a user-defined "main" function. This function
 // infers an entry point from a user-defined "main" function.
 StringRef LinkerDriver::findDefaultEntry() {
+  assert(Config->Subsystem != IMAGE_SUBSYSTEM_UNKNOWN &&
+         "must handle /subsystem before calling this");
+
   // As a special case, if /nodefaultlib is given, we directly look for an
   // entry point. This is because, if no default library is linked, users
   // need to define an entry point instead of a "main".
-  if (Config->NoDefaultLibAll) {
-    for (StringRef S : {"mainCRTStartup", "wmainCRTStartup",
-                        "WinMainCRTStartup", "wWinMainCRTStartup"}) {
-      StringRef Entry = Symtab->findMangle(S);
-      if (!Entry.empty() && !isa<Undefined>(Symtab->find(Entry)))
-        return mangle(S);
-    }
-    return "";
+  bool FindMain = !Config->NoDefaultLibAll;
+  if (Config->Subsystem == IMAGE_SUBSYSTEM_WINDOWS_GUI) {
+    if (findUnderscoreMangle(FindMain ? "WinMain" : "WinMainCRTStartup"))
+      return mangle("WinMainCRTStartup");
+    if (findUnderscoreMangle(FindMain ? "wWinMain" : "wWinMainCRTStartup"))
+      return mangle("wWinMainCRTStartup");
   }
-
-  // User-defined main functions and their corresponding entry points.
-  static const char *Entries[][2] = {
-      {"main", "mainCRTStartup"},
-      {"wmain", "wmainCRTStartup"},
-      {"WinMain", "WinMainCRTStartup"},
-      {"wWinMain", "wWinMainCRTStartup"},
-  };
-  for (auto E : Entries) {
-    StringRef Entry = Symtab->findMangle(mangle(E[0]));
-    if (!Entry.empty() && !isa<Undefined>(Symtab->find(Entry)))
-      return mangle(E[1]);
-  }
+  if (findUnderscoreMangle(FindMain ? "main" : "mainCRTStartup"))
+    return mangle("mainCRTStartup");
+  if (findUnderscoreMangle(FindMain ? "wmain" : "wmainCRTStartup"))
+    return mangle("wmainCRTStartup");
   return "";
 }
 
 WindowsSubsystem LinkerDriver::inferSubsystem() {
   if (Config->DLL)
     return IMAGE_SUBSYSTEM_WINDOWS_GUI;
-  if (Symtab->findUnderscore("main") || Symtab->findUnderscore("wmain"))
+  if (findUnderscoreMangle("main") || findUnderscoreMangle("wmain"))
     return IMAGE_SUBSYSTEM_WINDOWS_CUI;
-  if (Symtab->findUnderscore("WinMain") || Symtab->findUnderscore("wWinMain"))
+  if (findUnderscoreMangle("WinMain") || findUnderscoreMangle("wWinMain"))
     return IMAGE_SUBSYSTEM_WINDOWS_GUI;
   return IMAGE_SUBSYSTEM_UNKNOWN;
 }
@@ -1335,25 +1332,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr
     error("/dynamicbase:no is not compatible with " +
           machineToStr(Config->Machine));
 
-  // Handle /entry and /dll
-  if (auto *Arg = Args.getLastArg(OPT_entry)) {
-    Config->Entry = addUndefined(mangle(Arg->getValue()));
-  } else if (!Config->Entry && !Config->NoEntry) {
-    if (Args.hasArg(OPT_dll)) {
-      StringRef S = (Config->Machine == I386) ? "__DllMainCRTStartup@12"
-                                              : "_DllMainCRTStartup";
-      Config->Entry = addUndefined(S);
-    } else {
-      // Windows specific -- If entry point name is not given, we need to
-      // infer that from user-defined entry name.
-      StringRef S = findDefaultEntry();
-      if (S.empty())
-        fatal("entry point must be defined");
-      Config->Entry = addUndefined(S);
-      log("Entry name inferred: " + S);
-    }
-  }
-
   // Handle /export
   for (auto *Arg : Args.filtered(OPT_export)) {
     Export E = parseExport(Arg->getValue());
@@ -1379,6 +1357,34 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr
     return;
   }
 
+  // Windows specific -- if no /subsystem is given, we need to infer
+  // that from entry point name.  Must happen before /entry handling,
+  // and after the early return when just writing an import library.
+  if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) {
+    Config->Subsystem = inferSubsystem();
+    if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
+      fatal("subsystem must be defined");
+  }
+
+  // Handle /entry and /dll
+  if (auto *Arg = Args.getLastArg(OPT_entry)) {
+    Config->Entry = addUndefined(mangle(Arg->getValue()));
+  } else if (!Config->Entry && !Config->NoEntry) {
+    if (Args.hasArg(OPT_dll)) {
+      StringRef S = (Config->Machine == I386) ? "__DllMainCRTStartup@12"
+                                              : "_DllMainCRTStartup";
+      Config->Entry = addUndefined(S);
+    } else {
+      // Windows specific -- If entry point name is not given, we need to
+      // infer that from user-defined entry name.
+      StringRef S = findDefaultEntry();
+      if (S.empty())
+        fatal("entry point must be defined");
+      Config->Entry = addUndefined(S);
+      log("Entry name inferred: " + S);
+    }
+  }
+
   // Handle /delayload
   for (auto *Arg : Args.filtered(OPT_delayload)) {
     Config->DelayLoads.insert(StringRef(Arg->getValue()).lower());
@@ -1490,14 +1496,6 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr
   Symtab->reportRemainingUndefines();
   if (errorCount())
     return;
-
-  // Windows specific -- if no /subsystem is given, we need to infer
-  // that from entry point name.
-  if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN) {
-    Config->Subsystem = inferSubsystem();
-    if (Config->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
-      fatal("subsystem must be defined");
-  }
 
   // Handle /safeseh.
   if (Args.hasFlag(OPT_safeseh, OPT_safeseh_no, false)) {

Modified: projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.h
==============================================================================
--- projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.h	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.h	Tue Sep 11 18:50:40 2018	(r338597)
@@ -103,7 +103,6 @@ class LinkerDriver { (private)
   std::set<std::string> VisitedLibs;
 
   Symbol *addUndefined(StringRef Sym);
-  StringRef mangle(StringRef Sym);
 
   // Windows specific -- "main" is not the only main function in Windows.
   // You can choose one from these four -- {w,}{WinMain,main}.

Modified: projects/clang700-import/contrib/llvm/tools/lld/docs/ReleaseNotes.rst
==============================================================================
--- projects/clang700-import/contrib/llvm/tools/lld/docs/ReleaseNotes.rst	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/tools/lld/docs/ReleaseNotes.rst	Tue Sep 11 18:50:40 2018	(r338597)
@@ -5,35 +5,82 @@ LLD 7.0.0 Release Notes
 .. contents::
     :local:
 
-.. warning::
-   These are in-progress notes for the upcoming LLVM 7.0.0 release.
-   Release notes for previous releases can be found on
-   `the Download Page <http://releases.llvm.org/download.html>`_.
-
 Introduction
 ============
 
-This document contains the release notes for the lld linker, release 7.0.0.
-Here we describe the status of lld, including major improvements
-from the previous release. All lld releases may be downloaded
-from the `LLVM releases web site <http://llvm.org/releases/>`_.
+lld is a high-performance linker that supports ELF (Unix), COFF (Windows),
+Mach-O (macOS), MinGW and WebAssembly. lld is command-line-compatible with GNU
+linkers and Microsoft link.exe, and is significantly faster than these system
+default linkers.
 
+lld 7 for ELF and COFF are production-ready. lld/ELF can build the entire
+FreeBSD/AMD64 and will be the default linker of the next version of the
+operating system. lld/COFF is being used to build popular large programs such as
+the Chrome web browser. Mach-O, MinGW and WebAssembly supports are still
+experimental.
+
 Non-comprehensive list of changes in this release
 =================================================
 
 ELF Improvements
 ----------------
 
-* lld is now able to overcome MIPS GOT entries number limitation
-  and generate multi-GOT if necessary.
+* Fixed a lot of long-tail compatibility issues with GNU linkers.
 
-* lld is now able to produce MIPS position-independent executable (PIE).
+* Added ``-z retpolineplt`` to emit a PLT entry that doesn't contain an indirect
+  jump instruction to mitigate Spectre v2 vulnerability.
 
+* Added experimental support for `SHT_RELR sections
+  <https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg>`_ to create a
+  compact dynamic relocation table.
+
+* Added support for `split stacks <https://gcc.gnu.org/wiki/SplitStacks>`_.
+
+* Added support for address significance table (section with type
+  SHT_LLVM_ADDRSIG) to improve Identical Code Folding (ICF). Combined with the
+  ``-faddrsig`` compiler option added to Clang 7, lld's ``--icf=all`` can now
+  safely merge functions and data to generate smaller outputs than before.
+
+* Improved ``--gdb-index`` so that it is faster (`r336790
+  <https://reviews.llvm.org/rL336790>`_) and uses less memory (`r336672
+  <https://reviews.llvm.org/rL336672>`_).
+
+* Reduced memory usage of ``--compress-debug-sections`` (`r338913
+  <https://reviews.llvm.org/rL338913>`_).
+
+* Added linker script OVERLAY support (`r335714 <https://reviews.llvm.org/rL335714>`_).
+
+* Added ``--warn-backref`` to make it easy to identify command line option order
+  that doesn't work with GNU linkers (`r329636 <https://reviews.llvm.org/rL329636>`_)
+
+* Added ld.lld.1 man page (`r324512 <https://reviews.llvm.org/rL324512>`_).
+
+* Added support for multi-GOT.
+
+* Added support for MIPS position-independent executable (PIE).
+
 * Fixed MIPS TLS GOT entries for local symbols in shared libraries.
 
-* Fixed calculation of MIPS GP relative relocations
-  in case of relocatable output.
+* Fixed calculation of MIPS GP relative relocations in case of relocatable
+  output.
 
+* Added support for PPCv2 ABI.
+
+* Removed an incomplete support of PPCv1 ABI.
+
+* Added support for Qualcomm Hexagon ISA.
+
+* Added the following flags: ``--apply-dynamic-relocs``, ``--check-sections``,
+  ``--cref``, ``--just-symbols``, ``--keep-unique``,
+  ``--no-allow-multiple-definition``, ``--no-apply-dynamic-relocs``,
+  ``--no-check-sections``, ``--no-gnu-unique, ``--no-pic-executable``,
+  ``--no-undefined-version``, ``--no-warn-common``, ``--pack-dyn-relocs=relr``,
+  ``--pop-state``, ``--print-icf-sections``, ``--push-state``,
+  ``--thinlto-index-only``, ``--thinlto-object-suffix-replace``,
+  ``--thinlto-prefix-replace``, ``--warn-backref``, ``-z combreloc``, ``-z
+  copyreloc``, ``-z initfirst``, ``-z keep-text-section-prefix``, ``-z lazy``,
+  ``-z noexecstack``, ``-z relro``, ``-z retpolineplt``, ``-z text``
+
 COFF Improvements
 -----------------
 
@@ -45,7 +92,11 @@ COFF Improvements
 
 * Improved compatibility of output binaries with GNU binutils objcopy/strip.
 
-MachO Improvements
-------------------
+* Sped up PDB file creation.
 
-* Item 1.
+* Changed section layout to improve compatibility with link.exe.
+
+* Added the following flags: ``--color-diagnostics={always,never,auto}``,
+  ``--no-color-diagnostics``, ``/brepro``, ``/debug:full``, ``/debug:ghash``,
+  ``/guard:cf``, ``/guard:longjmp``, ``/guard:nolongjmp``, ``/integritycheck``,
+  ``/order``, ``/pdbsourcepath``, ``/timestamp``

Modified: projects/clang700-import/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h
==============================================================================
--- projects/clang700-import/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/MachONormalizedFileBinaryUtils.h	Tue Sep 11 18:50:40 2018	(r338597)
@@ -186,11 +186,10 @@ packRelocation(const Relocation &r, bool swap, bool is
 }
 
 inline StringRef getString16(const char s[16]) {
-  StringRef x = s;
-  if ( x.size() > 16 )
-    return x.substr(0, 16);
-  else
-    return x;
+  // The StringRef(const char *) constructor passes the const char * to
+  // strlen(), so we can't use this constructor here, because if there is no
+  // null terminator in s, then strlen() will read past the end of the array.
+  return StringRef(s, strnlen(s, 16));
 }
 
 inline void setString16(StringRef str, char s[16]) {

Modified: projects/clang700-import/lib/clang/include/clang/Basic/Version.inc
==============================================================================
--- projects/clang700-import/lib/clang/include/clang/Basic/Version.inc	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/lib/clang/include/clang/Basic/Version.inc	Tue Sep 11 18:50:40 2018	(r338597)
@@ -8,4 +8,4 @@
 
 #define	CLANG_VENDOR			"FreeBSD "
 
-#define	SVN_REVISION			"340910"
+#define	SVN_REVISION			"341916"

Modified: projects/clang700-import/lib/clang/include/lld/Common/Version.inc
==============================================================================
--- projects/clang700-import/lib/clang/include/lld/Common/Version.inc	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/lib/clang/include/lld/Common/Version.inc	Tue Sep 11 18:50:40 2018	(r338597)
@@ -7,4 +7,4 @@
 
 #define LLD_REPOSITORY_STRING "FreeBSD"
 // <Upstream revision at import>-<Local identifier in __FreeBSD_version style>
-#define LLD_REVISION_STRING "340910-1200005"
+#define LLD_REVISION_STRING "341916-1200005"

Modified: projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h
==============================================================================
--- projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h	Tue Sep 11 18:41:00 2018	(r338596)
+++ projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h	Tue Sep 11 18:50:40 2018	(r338597)
@@ -1,2 +1,2 @@
 /* $FreeBSD$ */
-#define LLVM_REVISION "svn-r340910"
+#define LLVM_REVISION "svn-r341916"



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