From owner-svn-src-all@freebsd.org Sun Jul 30 18:01:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6CCD5DBF8CB; Sun, 30 Jul 2017 18:01:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 090BD7C316; Sun, 30 Jul 2017 18:01:38 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6UI1ccA072891; Sun, 30 Jul 2017 18:01:38 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6UI1YXl072853; Sun, 30 Jul 2017 18:01:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201707301801.v6UI1YXl072853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 30 Jul 2017 18:01:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321723 - in head: contrib/llvm/include/llvm/CodeGen/GlobalISel contrib/llvm/include/llvm/Support contrib/llvm/include/llvm/Transforms/Utils contrib/llvm/lib/CodeGen contrib/llvm/lib/Co... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/llvm/include/llvm/CodeGen/GlobalISel contrib/llvm/include/llvm/Support contrib/llvm/include/llvm/Transforms/Utils contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/SelectionDAG contri... X-SVN-Commit-Revision: 321723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2017 18:01:39 -0000 Author: dim Date: Sun Jul 30 18:01:34 2017 New Revision: 321723 URL: https://svnweb.freebsd.org/changeset/base/321723 Log: Upgrade our copies of clang, llvm, lld and lldb to r309439 from the upstream release_50 branch. This is just after upstream's 5.0.0-rc1. MFC after: 2 months X-MFC-with: r321369 Modified: head/contrib/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h head/contrib/llvm/include/llvm/Support/CommandLine.h head/contrib/llvm/include/llvm/Support/TargetRegistry.h head/contrib/llvm/include/llvm/Transforms/Utils/LoopUtils.h head/contrib/llvm/lib/CodeGen/InlineSpiller.cpp head/contrib/llvm/lib/CodeGen/RegAllocBase.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp head/contrib/llvm/lib/Option/OptTable.cpp head/contrib/llvm/lib/Support/CommandLine.cpp head/contrib/llvm/lib/Support/ErrorHandling.cpp head/contrib/llvm/lib/Support/TargetRegistry.cpp head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp head/contrib/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp head/contrib/llvm/lib/Target/AMDGPU/SIRegisterInfo.td head/contrib/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp head/contrib/llvm/lib/Target/SystemZ/SystemZScheduleZ14.td head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp head/contrib/llvm/lib/Transforms/Utils/LoopUtils.cpp head/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp head/contrib/llvm/tools/clang/include/clang/AST/Type.h head/contrib/llvm/tools/clang/lib/AST/StmtProfile.cpp head/contrib/llvm/tools/clang/lib/AST/Type.cpp head/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp head/contrib/llvm/tools/clang/lib/Basic/Version.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp head/contrib/llvm/tools/clang/lib/Driver/Driver.cpp head/contrib/llvm/tools/clang/lib/Headers/unwind.h head/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp head/contrib/llvm/tools/clang/tools/clang-format/ClangFormat.cpp head/contrib/llvm/tools/lld/COFF/Config.h head/contrib/llvm/tools/lld/COFF/Driver.cpp head/contrib/llvm/tools/lld/ELF/InputFiles.cpp head/contrib/llvm/tools/lld/ELF/InputFiles.h head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp head/contrib/llvm/tools/lld/lib/ReaderWriter/MachO/ObjCPass.cpp head/contrib/llvm/tools/lldb/include/lldb/API/SBAttachInfo.h head/contrib/llvm/tools/lldb/include/lldb/API/SBBreakpoint.h head/contrib/llvm/tools/lldb/include/lldb/API/SBProcess.h head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/clang/Config/config.h head/lib/clang/include/lld/Config/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h head/lib/clang/libllvm/Makefile Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) Modified: head/contrib/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/include/llvm/CodeGen/GlobalISel/InstructionSelector.h Sun Jul 30 18:01:34 2017 (r321723) @@ -40,7 +40,8 @@ class TargetRegisterInfo; /// This is convenient because std::bitset does not have a constructor /// with an initializer list of set bits. /// -/// Each InstructionSelector subclass should define a PredicateBitset class with: +/// Each InstructionSelector subclass should define a PredicateBitset class +/// with: /// const unsigned MAX_SUBTARGET_PREDICATES = 192; /// using PredicateBitset = PredicateBitsetImpl; /// and updating the constant to suit the target. Tablegen provides a suitable @@ -102,7 +103,8 @@ enum { /// - OpIdx - Operand index /// - Expected integer GIM_CheckConstantInt, - /// Check the operand is a specific literal integer (i.e. MO.isImm() or MO.isCImm() is true). + /// Check the operand is a specific literal integer (i.e. MO.isImm() or + /// MO.isCImm() is true). /// - InsnID - Instruction ID /// - OpIdx - Operand index /// - Expected integer Modified: head/contrib/llvm/include/llvm/Support/CommandLine.h ============================================================================== --- head/contrib/llvm/include/llvm/Support/CommandLine.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/include/llvm/Support/CommandLine.h Sun Jul 30 18:01:34 2017 (r321723) @@ -66,15 +66,12 @@ bool ParseCommandLineOptions(int argc, const char *con void ParseEnvironmentOptions(const char *progName, const char *envvar, const char *Overview = ""); -// Function pointer type for printing version information. -using VersionPrinterTy = std::function; - ///===---------------------------------------------------------------------===// /// SetVersionPrinter - Override the default (LLVM specific) version printer /// used to print out the version when --version is given /// on the command line. This allows other systems using the /// CommandLine utilities to print their own version string. -void SetVersionPrinter(VersionPrinterTy func); +void SetVersionPrinter(void (*func)()); ///===---------------------------------------------------------------------===// /// AddExtraVersionPrinter - Add an extra printer to use in addition to the @@ -83,7 +80,7 @@ void SetVersionPrinter(VersionPrinterTy func); /// which will be called after the basic LLVM version /// printing is complete. Each can then add additional /// information specific to the tool. -void AddExtraVersionPrinter(VersionPrinterTy func); +void AddExtraVersionPrinter(void (*func)()); // PrintOptionValues - Print option values. // With -print-options print the difference between option values and defaults. Modified: head/contrib/llvm/include/llvm/Support/TargetRegistry.h ============================================================================== --- head/contrib/llvm/include/llvm/Support/TargetRegistry.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/include/llvm/Support/TargetRegistry.h Sun Jul 30 18:01:34 2017 (r321723) @@ -599,7 +599,7 @@ struct TargetRegistry { /// printRegisteredTargetsForVersion - Print the registered targets /// appropriately for inclusion in a tool's version output. - static void printRegisteredTargetsForVersion(raw_ostream &OS); + static void printRegisteredTargetsForVersion(); /// @name Registry Access /// @{ Modified: head/contrib/llvm/include/llvm/Transforms/Utils/LoopUtils.h ============================================================================== --- head/contrib/llvm/include/llvm/Transforms/Utils/LoopUtils.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/include/llvm/Transforms/Utils/LoopUtils.h Sun Jul 30 18:01:34 2017 (r321723) @@ -531,8 +531,10 @@ Value *createTargetReduction(IRBuilder<> &B, const Tar /// Get the intersection (logical and) of all of the potential IR flags /// of each scalar operation (VL) that will be converted into a vector (I). +/// If OpValue is non-null, we only consider operations similar to OpValue +/// when intersecting. /// Flag set: NSW, NUW, exact, and all of fast-math. -void propagateIRFlags(Value *I, ArrayRef VL); +void propagateIRFlags(Value *I, ArrayRef VL, Value *OpValue = nullptr); } // end namespace llvm Modified: head/contrib/llvm/lib/CodeGen/InlineSpiller.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/InlineSpiller.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/CodeGen/InlineSpiller.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -643,8 +643,11 @@ void InlineSpiller::reMaterializeAll() { Edit->eraseVirtReg(Reg); continue; } - assert((LIS.hasInterval(Reg) && !LIS.getInterval(Reg).empty()) && - "Reg with empty interval has reference"); + + assert(LIS.hasInterval(Reg) && + (!LIS.getInterval(Reg).empty() || !MRI.reg_nodbg_empty(Reg)) && + "Empty and not used live-range?!"); + RegsToSpill[ResultPos++] = Reg; } RegsToSpill.erase(RegsToSpill.begin() + ResultPos, RegsToSpill.end()); Modified: head/contrib/llvm/lib/CodeGen/RegAllocBase.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/RegAllocBase.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/CodeGen/RegAllocBase.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -133,18 +133,19 @@ void RegAllocBase::allocatePhysRegs() { if (AvailablePhysReg) Matrix->assign(*VirtReg, AvailablePhysReg); - for (VirtRegVec::iterator I = SplitVRegs.begin(), E = SplitVRegs.end(); - I != E; ++I) { - LiveInterval *SplitVirtReg = &LIS->getInterval(*I); + for (unsigned Reg : SplitVRegs) { + assert(LIS->hasInterval(Reg)); + + LiveInterval *SplitVirtReg = &LIS->getInterval(Reg); assert(!VRM->hasPhys(SplitVirtReg->reg) && "Register already assigned"); if (MRI->reg_nodbg_empty(SplitVirtReg->reg)) { + assert(SplitVirtReg->empty() && "Non-empty but used interval"); DEBUG(dbgs() << "not queueing unused " << *SplitVirtReg << '\n'); aboutToRemoveInterval(*SplitVirtReg); LIS->removeInterval(SplitVirtReg->reg); continue; } DEBUG(dbgs() << "queuing new interval: " << *SplitVirtReg << "\n"); - assert(!SplitVirtReg->empty() && "expecting non-empty interval"); assert(TargetRegisterInfo::isVirtualRegister(SplitVirtReg->reg) && "expect split value in virtual register"); enqueue(SplitVirtReg); Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -2965,7 +2965,12 @@ static inline bool isSETCCorConvertedSETCC(SDValue N) else if (N.getOpcode() == ISD::SIGN_EXTEND) N = N.getOperand(0); - return (N.getOpcode() == ISD::SETCC); + if (isLogicalMaskOp(N.getOpcode())) + return isSETCCorConvertedSETCC(N.getOperand(0)) && + isSETCCorConvertedSETCC(N.getOperand(1)); + + return (N.getOpcode() == ISD::SETCC || + ISD::isBuildVectorOfConstantSDNodes(N.getNode())); } #endif @@ -2973,28 +2978,20 @@ static inline bool isSETCCorConvertedSETCC(SDValue N) // to ToMaskVT if needed with vector extension or truncation. SDValue DAGTypeLegalizer::convertMask(SDValue InMask, EVT MaskVT, EVT ToMaskVT) { - LLVMContext &Ctx = *DAG.getContext(); - // Currently a SETCC or a AND/OR/XOR with two SETCCs are handled. - unsigned InMaskOpc = InMask->getOpcode(); - // FIXME: This code seems to be too restrictive, we might consider // generalizing it or dropping it. - assert((InMaskOpc == ISD::SETCC || - ISD::isBuildVectorOfConstantSDNodes(InMask.getNode()) || - (isLogicalMaskOp(InMaskOpc) && - isSETCCorConvertedSETCC(InMask->getOperand(0)) && - isSETCCorConvertedSETCC(InMask->getOperand(1)))) && - "Unexpected mask argument."); + assert(isSETCCorConvertedSETCC(InMask) && "Unexpected mask argument."); // Make a new Mask node, with a legal result VT. SmallVector Ops; for (unsigned i = 0; i < InMask->getNumOperands(); ++i) Ops.push_back(InMask->getOperand(i)); - SDValue Mask = DAG.getNode(InMaskOpc, SDLoc(InMask), MaskVT, Ops); + SDValue Mask = DAG.getNode(InMask->getOpcode(), SDLoc(InMask), MaskVT, Ops); // If MaskVT has smaller or bigger elements than ToMaskVT, a vector sign // extend or truncate is needed. + LLVMContext &Ctx = *DAG.getContext(); unsigned MaskScalarBits = MaskVT.getScalarSizeInBits(); unsigned ToMaskScalBits = ToMaskVT.getScalarSizeInBits(); if (MaskScalarBits < ToMaskScalBits) { Modified: head/contrib/llvm/lib/Option/OptTable.cpp ============================================================================== --- head/contrib/llvm/lib/Option/OptTable.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Option/OptTable.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -235,7 +235,9 @@ OptTable::findByPrefix(StringRef Cur, unsigned short D continue; for (int I = 0; In.Prefixes[I]; I++) { - std::string S = std::string(In.Prefixes[I]) + std::string(In.Name); + std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; + if (In.HelpText) + S += In.HelpText; if (StringRef(S).startswith(Cur)) Ret.push_back(S); } Modified: head/contrib/llvm/lib/Support/CommandLine.cpp ============================================================================== --- head/contrib/llvm/lib/Support/CommandLine.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Support/CommandLine.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -2039,9 +2039,9 @@ void CommandLineParser::printOptionValues() { Opts[i].second->printOptionValue(MaxArgLen, PrintAllOptions); } -static VersionPrinterTy OverrideVersionPrinter = nullptr; +static void (*OverrideVersionPrinter)() = nullptr; -static std::vector *ExtraVersionPrinters = nullptr; +static std::vector *ExtraVersionPrinters = nullptr; namespace { class VersionPrinter { @@ -2081,7 +2081,7 @@ class VersionPrinter { (public) return; if (OverrideVersionPrinter != nullptr) { - OverrideVersionPrinter(outs()); + (*OverrideVersionPrinter)(); exit(0); } print(); @@ -2090,8 +2090,10 @@ class VersionPrinter { (public) // information. if (ExtraVersionPrinters != nullptr) { outs() << '\n'; - for (auto I : *ExtraVersionPrinters) - I(outs()); + for (std::vector::iterator I = ExtraVersionPrinters->begin(), + E = ExtraVersionPrinters->end(); + I != E; ++I) + (*I)(); } exit(0); @@ -2129,11 +2131,11 @@ void cl::PrintHelpMessage(bool Hidden, bool Categorize /// Utility function for printing version number. void cl::PrintVersionMessage() { VersionPrinterInstance.print(); } -void cl::SetVersionPrinter(VersionPrinterTy func) { OverrideVersionPrinter = func; } +void cl::SetVersionPrinter(void (*func)()) { OverrideVersionPrinter = func; } -void cl::AddExtraVersionPrinter(VersionPrinterTy func) { +void cl::AddExtraVersionPrinter(void (*func)()) { if (!ExtraVersionPrinters) - ExtraVersionPrinters = new std::vector; + ExtraVersionPrinters = new std::vector; ExtraVersionPrinters->push_back(func); } Modified: head/contrib/llvm/lib/Support/ErrorHandling.cpp ============================================================================== --- head/contrib/llvm/lib/Support/ErrorHandling.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Support/ErrorHandling.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -169,7 +169,8 @@ void llvm::report_bad_alloc_error(const char *Reason, // Don't call the normal error handler. It may allocate memory. Directly write // an OOM to stderr and abort. char OOMMessage[] = "LLVM ERROR: out of memory\n"; - (void)::write(2, OOMMessage, strlen(OOMMessage)); + ssize_t written = ::write(2, OOMMessage, strlen(OOMMessage)); + (void)written; abort(); #endif } Modified: head/contrib/llvm/lib/Support/TargetRegistry.cpp ============================================================================== --- head/contrib/llvm/lib/Support/TargetRegistry.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Support/TargetRegistry.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -114,7 +114,7 @@ static int TargetArraySortFn(const std::pairfirst.compare(RHS->first); } -void TargetRegistry::printRegisteredTargetsForVersion(raw_ostream &OS) { +void TargetRegistry::printRegisteredTargetsForVersion() { std::vector > Targets; size_t Width = 0; for (const auto &T : TargetRegistry::targets()) { @@ -123,6 +123,7 @@ void TargetRegistry::printRegisteredTargetsForVersion( } array_pod_sort(Targets.begin(), Targets.end(), TargetArraySortFn); + raw_ostream &OS = outs(); OS << " Registered Targets:\n"; for (unsigned i = 0, e = Targets.size(); i != e; ++i) { OS << " " << Targets[i].first; Modified: head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -2889,9 +2889,12 @@ void AArch64TargetLowering::saveVarArgRegisters(CCStat unsigned GPRSaveSize = 8 * (NumGPRArgRegs - FirstVariadicGPR); int GPRIdx = 0; if (GPRSaveSize != 0) { - if (IsWin64) + if (IsWin64) { GPRIdx = MFI.CreateFixedObject(GPRSaveSize, -(int)GPRSaveSize, false); - else + if (GPRSaveSize & 15) + // The extra size here, if triggered, will always be 8. + MFI.CreateFixedObject(16 - (GPRSaveSize & 15), -(int)alignTo(GPRSaveSize, 16), false); + } else GPRIdx = MFI.CreateStackObject(GPRSaveSize, 8, false); SDValue FIN = DAG.getFrameIndex(GPRIdx, PtrVT); Modified: head/contrib/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Target/AMDGPU/InstPrinter/AMDGPUInstPrinter.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -297,6 +297,11 @@ void AMDGPUInstPrinter::printRegOperand(unsigned RegNo case AMDGPU::FLAT_SCR_HI: O << "flat_scratch_hi"; return; + case AMDGPU::FP_REG: + case AMDGPU::SP_REG: + case AMDGPU::SCRATCH_WAVE_OFFSET_REG: + case AMDGPU::PRIVATE_RSRC_REG: + llvm_unreachable("pseudo-register should not ever be emitted"); default: break; } Modified: head/contrib/llvm/lib/Target/AMDGPU/SIRegisterInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/AMDGPU/SIRegisterInfo.td Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Target/AMDGPU/SIRegisterInfo.td Sun Jul 30 18:01:34 2017 (r321723) @@ -274,8 +274,7 @@ def VGPR_512 : RegisterTuples<[sub0, sub1, sub2, sub3, def SReg_32_XM0_XEXEC : RegisterClass<"AMDGPU", [i32, f32, i16, f16, v2i16, v2f16], 32, (add SGPR_32, VCC_LO, VCC_HI, FLAT_SCR_LO, FLAT_SCR_HI, TTMP_32, TMA_LO, TMA_HI, TBA_LO, TBA_HI, SRC_SHARED_BASE, SRC_SHARED_LIMIT, - SRC_PRIVATE_BASE, SRC_PRIVATE_LIMIT, - FP_REG, SP_REG, SCRATCH_WAVE_OFFSET_REG)> { + SRC_PRIVATE_BASE, SRC_PRIVATE_LIMIT)> { let AllocationPriority = 7; } Modified: head/contrib/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -61,14 +61,6 @@ static unsigned adjustFixupValue(unsigned Kind, uint64 case Sparc::fixup_sparc_lo10: return Value & 0x3ff; - case Sparc::fixup_sparc_tls_ldo_hix22: - case Sparc::fixup_sparc_tls_le_hix22: - return (~Value >> 10) & 0x3fffff; - - case Sparc::fixup_sparc_tls_ldo_lox10: - case Sparc::fixup_sparc_tls_le_lox10: - return (~(~Value & 0x3ff)) & 0x1fff; - case Sparc::fixup_sparc_h44: return (Value >> 22) & 0x3fffff; @@ -83,6 +75,13 @@ static unsigned adjustFixupValue(unsigned Kind, uint64 case Sparc::fixup_sparc_hm: return (Value >> 32) & 0x3ff; + + case Sparc::fixup_sparc_tls_ldo_hix22: + case Sparc::fixup_sparc_tls_le_hix22: + case Sparc::fixup_sparc_tls_ldo_lox10: + case Sparc::fixup_sparc_tls_le_lox10: + assert(Value == 0 && "Sparc TLS relocs expect zero Value"); + return 0; case Sparc::fixup_sparc_tls_gd_add: case Sparc::fixup_sparc_tls_gd_call: Modified: head/contrib/llvm/lib/Target/SystemZ/SystemZScheduleZ14.td ============================================================================== --- head/contrib/llvm/lib/Target/SystemZ/SystemZScheduleZ14.td Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Target/SystemZ/SystemZScheduleZ14.td Sun Jul 30 18:01:34 2017 (r321723) @@ -455,10 +455,10 @@ def : InstRW<[FXa, LSU, Lat8], (instregex "MH(Y)?$")>; def : InstRW<[FXa2, Lat6, GroupAlone], (instregex "M(L)?R$")>; def : InstRW<[FXa2, LSU, Lat10, GroupAlone], (instregex "M(FY|L)?$")>; def : InstRW<[FXa, LSU, Lat8], (instregex "MGH$")>; -def : InstRW<[FXa, LSU, Lat12, GroupAlone], (instregex "MG$")>; -def : InstRW<[FXa, Lat8, GroupAlone], (instregex "MGRK$")>; -def : InstRW<[FXa, LSU, Lat9, GroupAlone], (instregex "MSC$")>; -def : InstRW<[FXa, LSU, Lat11, GroupAlone], (instregex "MSGC$")>; +def : InstRW<[FXa, FXa, LSU, Lat12, GroupAlone], (instregex "MG$")>; +def : InstRW<[FXa, FXa, Lat8, GroupAlone], (instregex "MGRK$")>; +def : InstRW<[FXa, LSU, Lat9], (instregex "MSC$")>; +def : InstRW<[FXa, LSU, Lat11], (instregex "MSGC$")>; def : InstRW<[FXa, Lat5], (instregex "MSRKC$")>; def : InstRW<[FXa, Lat7], (instregex "MSGRKC$")>; @@ -620,7 +620,7 @@ def : InstRW<[FXa, Lat30], (instregex "(PCC|PPNO|PRNO) def : InstRW<[LSU], (instregex "LGG$")>; def : InstRW<[LSU, Lat5], (instregex "LLGFSG$")>; -def : InstRW<[LSU, Lat30, GroupAlone], (instregex "(L|ST)GSC$")>; +def : InstRW<[LSU, Lat30], (instregex "(L|ST)GSC$")>; //===----------------------------------------------------------------------===// // Decimal arithmetic @@ -708,7 +708,7 @@ def : InstRW<[FXb, LSU, Lat5], (instregex "NTSTG$")>; // Processor assist //===----------------------------------------------------------------------===// -def : InstRW<[FXb], (instregex "PPA$")>; +def : InstRW<[FXb, GroupAlone], (instregex "PPA$")>; //===----------------------------------------------------------------------===// // Miscellaneous Instructions. @@ -1276,9 +1276,9 @@ def : InstRW<[VecXsPm], (instregex "VESRL(B|F|G|H)?$") def : InstRW<[VecXsPm], (instregex "VESRLV(B|F|G|H)?$")>; def : InstRW<[VecXsPm], (instregex "VSL(DB)?$")>; -def : InstRW<[VecXsPm, VecXsPm, Lat8], (instregex "VSLB$")>; +def : InstRW<[VecXsPm], (instregex "VSLB$")>; def : InstRW<[VecXsPm], (instregex "VSR(A|L)$")>; -def : InstRW<[VecXsPm, VecXsPm, Lat8], (instregex "VSR(A|L)B$")>; +def : InstRW<[VecXsPm], (instregex "VSR(A|L)B$")>; def : InstRW<[VecXsPm], (instregex "VSB(I|IQ|CBI|CBIQ)?$")>; def : InstRW<[VecXsPm], (instregex "VSCBI(B|F|G|H|Q)?$")>; @@ -1435,9 +1435,9 @@ def : InstRW<[VecStr, Lat5], (instregex "VSTRCZ(B|F|H) // Vector: Packed-decimal instructions //===----------------------------------------------------------------------===// -def : InstRW<[VecDF, VecDF, Lat10, GroupAlone], (instregex "VLIP$")>; -def : InstRW<[VecDFX, LSU, Lat12, GroupAlone], (instregex "VPKZ$")>; -def : InstRW<[VecDFX, FXb, LSU, Lat12, GroupAlone], (instregex "VUPKZ$")>; +def : InstRW<[VecDF, VecDF, Lat10], (instregex "VLIP$")>; +def : InstRW<[VecDFX, LSU, GroupAlone], (instregex "VPKZ$")>; +def : InstRW<[VecDFX, FXb, LSU, Lat12, BeginGroup], (instregex "VUPKZ$")>; def : InstRW<[VecDF, VecDF, FXb, Lat20, GroupAlone], (instregex "VCVB(G)?$")>; def : InstRW<[VecDF, VecDF, FXb, Lat20, GroupAlone], (instregex "VCVD(G)?$")>; def : InstRW<[VecDFX], (instregex "V(A|S)P$")>; Modified: head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -1055,7 +1055,10 @@ static bool foldMaskAndShiftToScale(SelectionDAG &DAG, // Scale the leading zero count down based on the actual size of the value. // Also scale it down based on the size of the shift. - MaskLZ -= (64 - X.getSimpleValueType().getSizeInBits()) + ShiftAmt; + unsigned ScaleDown = (64 - X.getSimpleValueType().getSizeInBits()) + ShiftAmt; + if (MaskLZ < ScaleDown) + return true; + MaskLZ -= ScaleDown; // The final check is to ensure that any masked out high bits of X are // already known to be zero. Otherwise, the mask has a semantic impact Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -22022,8 +22022,9 @@ static SDValue LowerScalarImmediateShift(SDValue Op, S return getTargetVShiftByConstNode(X86Opc, dl, VT, R, ShiftAmt, DAG); // i64 SRA needs to be performed as partial shifts. - if ((VT == MVT::v2i64 || (Subtarget.hasInt256() && VT == MVT::v4i64)) && - Op.getOpcode() == ISD::SRA && !Subtarget.hasXOP()) + if (((!Subtarget.hasXOP() && VT == MVT::v2i64) || + (Subtarget.hasInt256() && VT == MVT::v4i64)) && + Op.getOpcode() == ISD::SRA) return ArithmeticShiftRight64(ShiftAmt); if (VT == MVT::v16i8 || Modified: head/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Transforms/Scalar/JumpThreading.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -64,6 +64,11 @@ ImplicationSearchThreshold( "condition to use to thread over a weaker condition"), cl::init(3), cl::Hidden); +static cl::opt PrintLVIAfterJumpThreading( + "print-lvi-after-jump-threading", + cl::desc("Print the LazyValueInfo cache after JumpThreading"), cl::init(false), + cl::Hidden); + namespace { /// This pass performs 'jump threading', which looks at blocks that have /// multiple predecessors and multiple successors. If one or more of the @@ -93,9 +98,10 @@ namespace { bool runOnFunction(Function &F) override; void getAnalysisUsage(AnalysisUsage &AU) const override { + if (PrintLVIAfterJumpThreading) + AU.addRequired(); AU.addRequired(); AU.addRequired(); - AU.addPreserved(); AU.addPreserved(); AU.addRequired(); } @@ -137,8 +143,14 @@ bool JumpThreading::runOnFunction(Function &F) { BFI.reset(new BlockFrequencyInfo(F, *BPI, LI)); } - return Impl.runImpl(F, TLI, LVI, AA, HasProfileData, std::move(BFI), - std::move(BPI)); + bool Changed = Impl.runImpl(F, TLI, LVI, AA, HasProfileData, std::move(BFI), + std::move(BPI)); + if (PrintLVIAfterJumpThreading) { + dbgs() << "LVI for function '" << F.getName() << "':\n"; + LVI->printLVI(F, getAnalysis().getDomTree(), + dbgs()); + } + return Changed; } PreservedAnalyses JumpThreadingPass::run(Function &F, @@ -231,13 +243,15 @@ bool JumpThreadingPass::runImpl(Function &F, TargetLib // Can't thread an unconditional jump, but if the block is "almost // empty", we can replace uses of it with uses of the successor and make // this dead. - // We should not eliminate the loop header either, because eliminating - // a loop header might later prevent LoopSimplify from transforming nested - // loops into simplified form. + // We should not eliminate the loop header or latch either, because + // eliminating a loop header or latch might later prevent LoopSimplify + // from transforming nested loops into simplified form. We will rely on + // later passes in backend to clean up empty blocks. if (BI && BI->isUnconditional() && BB != &BB->getParent()->getEntryBlock() && // If the terminator is the only non-phi instruction, try to nuke it. - BB->getFirstNonPHIOrDbg()->isTerminator() && !LoopHeaders.count(BB)) { + BB->getFirstNonPHIOrDbg()->isTerminator() && !LoopHeaders.count(BB) && + !LoopHeaders.count(BI->getSuccessor(0))) { // FIXME: It is always conservatively correct to drop the info // for a block even if it doesn't get erased. This isn't totally // awesome, but it allows us to use AssertingVH to prevent nasty Modified: head/contrib/llvm/lib/Transforms/Utils/LoopUtils.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Utils/LoopUtils.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Transforms/Utils/LoopUtils.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -1376,16 +1376,21 @@ Value *llvm::createTargetReduction(IRBuilder<> &Builde } } -void llvm::propagateIRFlags(Value *I, ArrayRef VL) { - if (auto *VecOp = dyn_cast(I)) { - if (auto *I0 = dyn_cast(VL[0])) { - // VecOVp is initialized to the 0th scalar, so start counting from index - // '1'. - VecOp->copyIRFlags(I0); - for (int i = 1, e = VL.size(); i < e; ++i) { - if (auto *Scalar = dyn_cast(VL[i])) - VecOp->andIRFlags(Scalar); - } - } +void llvm::propagateIRFlags(Value *I, ArrayRef VL, Value *OpValue) { + auto *VecOp = dyn_cast(I); + if (!VecOp) + return; + auto *Intersection = (OpValue == nullptr) ? dyn_cast(VL[0]) + : dyn_cast(OpValue); + if (!Intersection) + return; + const unsigned Opcode = Intersection->getOpcode(); + VecOp->copyIRFlags(Intersection); + for (auto *V : VL) { + auto *Instr = dyn_cast(V); + if (!Instr) + continue; + if (OpValue == nullptr || Opcode == Instr->getOpcode()) + VecOp->andIRFlags(V); } } Modified: head/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/lib/Transforms/Utils/SimplifyCFG.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -5656,20 +5656,22 @@ static bool TryToMergeLandingPad(LandingPadInst *LPad, bool SimplifyCFGOpt::SimplifyUncondBranch(BranchInst *BI, IRBuilder<> &Builder) { BasicBlock *BB = BI->getParent(); + BasicBlock *Succ = BI->getSuccessor(0); if (SinkCommon && SinkThenElseCodeToEnd(BI)) return true; // If the Terminator is the only non-phi instruction, simplify the block. - // if LoopHeader is provided, check if the block is a loop header - // (This is for early invocations before loop simplify and vectorization - // to keep canonical loop forms for nested loops. - // These blocks can be eliminated when the pass is invoked later - // in the back-end.) + // if LoopHeader is provided, check if the block or its successor is a loop + // header (This is for early invocations before loop simplify and + // vectorization to keep canonical loop forms for nested loops. These blocks + // can be eliminated when the pass is invoked later in the back-end.) + bool NeedCanonicalLoop = + !LateSimplifyCFG && + (LoopHeaders && (LoopHeaders->count(BB) || LoopHeaders->count(Succ))); BasicBlock::iterator I = BB->getFirstNonPHIOrDbg()->getIterator(); if (I->isTerminator() && BB != &BB->getParent()->getEntryBlock() && - (!LoopHeaders || !LoopHeaders->count(BB)) && - TryToSimplifyUncondBranchFromEmptyBlock(BB)) + !NeedCanonicalLoop && TryToSimplifyUncondBranchFromEmptyBlock(BB)) return true; // If the only instruction in the block is a seteq/setne comparison Modified: head/contrib/llvm/tools/clang/include/clang/AST/Type.h ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/AST/Type.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/include/clang/AST/Type.h Sun Jul 30 18:01:34 2017 (r321723) @@ -1752,6 +1752,7 @@ class Type : public ExtQualsTypeCommonBase { (public) bool isTemplateTypeParmType() const; // C++ template type parameter bool isNullPtrType() const; // C++11 std::nullptr_t bool isAlignValT() const; // C++17 std::align_val_t + bool isStdByteType() const; // C++17 std::byte bool isAtomicType() const; // C11 _Atomic() #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ Modified: head/contrib/llvm/tools/clang/lib/AST/StmtProfile.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/AST/StmtProfile.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/AST/StmtProfile.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -1388,6 +1388,15 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOpe llvm_unreachable("Invalid overloaded operator expression"); } +#if defined(_MSC_VER) +#if _MSC_VER == 1911 +// Work around https://developercommunity.visualstudio.com/content/problem/84002/clang-cl-when-built-with-vc-2017-crashes-cause-vc.html +// MSVC 2017 update 3 miscompiles this function, and a clang built with it +// will crash in stage 2 of a bootstrap build. +#pragma optimize("", off) +#endif +#endif + void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) { if (S->isTypeDependent()) { // Type-dependent operator calls are profiled like their underlying @@ -1419,6 +1428,12 @@ void StmtProfiler::VisitCXXOperatorCallExpr(const CXXO VisitCallExpr(S); ID.AddInteger(S->getOperator()); } + +#if defined(_MSC_VER) +#if _MSC_VER == 1911 +#pragma optimize("", on) +#endif +#endif void StmtProfiler::VisitCXXMemberCallExpr(const CXXMemberCallExpr *S) { VisitCallExpr(S); Modified: head/contrib/llvm/tools/clang/lib/AST/Type.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/AST/Type.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/AST/Type.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -2313,6 +2313,15 @@ bool Type::isAlignValT() const { return false; } +bool Type::isStdByteType() const { + if (auto *ET = getAs()) { + auto *II = ET->getDecl()->getIdentifier(); + if (II && II->isStr("byte") && ET->getDecl()->isInStdNamespace()) + return true; + } + return false; +} + bool Type::isPromotableIntegerType() const { if (const BuiltinType *BT = getAs()) switch (BT->getKind()) { Modified: head/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -516,7 +516,7 @@ std::vector DiagnosticIDs::getDiagnosticF std::string Diag(DiagGroupNames + I + 1, DiagGroupNames[I]); I += DiagGroupNames[I] + 1; Res.push_back("-W" + Diag); - Res.push_back("-Wno" + Diag); + Res.push_back("-Wno-" + Diag); } return Res; Modified: head/contrib/llvm/tools/clang/lib/Basic/Version.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Version.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/Basic/Version.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/trunk/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_50/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenTBAA.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -139,6 +139,12 @@ CodeGenTBAA::getTBAAInfo(QualType QTy) { } } + // C++1z [basic.lval]p10: "If a program attempts to access the stored value of + // an object through a glvalue of other than one of the following types the + // behavior is undefined: [...] a char, unsigned char, or std::byte type." + if (Ty->isStdByteType()) + return MetadataCache[Ty] = getChar(); + // Handle pointers. // TODO: Implement C++'s type "similarity" and consider dis-"similar" // pointers distinct. Modified: head/contrib/llvm/tools/clang/lib/Driver/Driver.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/Driver.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/Driver/Driver.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -69,7 +69,6 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/Process.h" #include "llvm/Support/Program.h" -#include "llvm/Support/TargetRegistry.h" #include "llvm/Support/raw_ostream.h" #include #include @@ -1193,10 +1192,6 @@ bool Driver::HandleImmediateArgs(const Compilation &C) if (C.getArgs().hasArg(options::OPT__version)) { // Follow gcc behavior and use stdout for --version and stderr for -v. PrintVersion(C, llvm::outs()); - - // Print registered targets. - llvm::outs() << '\n'; - llvm::TargetRegistry::printRegisteredTargetsForVersion(llvm::outs()); return false; } @@ -1299,7 +1294,7 @@ bool Driver::HandleImmediateArgs(const Compilation &C) std::sort(SuggestedCompletions.begin(), SuggestedCompletions.end(), [](StringRef A, StringRef B) { return A.compare_lower(B) < 0; }); - llvm::outs() << llvm::join(SuggestedCompletions, " ") << '\n'; + llvm::outs() << llvm::join(SuggestedCompletions, "\n") << '\n'; return false; } Modified: head/contrib/llvm/tools/clang/lib/Headers/unwind.h ============================================================================== --- head/contrib/llvm/tools/clang/lib/Headers/unwind.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/Headers/unwind.h Sun Jul 30 18:01:34 2017 (r321723) @@ -76,7 +76,13 @@ typedef intptr_t _sleb128_t; typedef uintptr_t _uleb128_t; struct _Unwind_Context; +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) +struct _Unwind_Control_Block; +typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */ +#else struct _Unwind_Exception; +typedef struct _Unwind_Exception _Unwind_Exception; +#endif typedef enum { _URC_NO_REASON = 0, #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ @@ -109,8 +115,42 @@ typedef enum { } _Unwind_Action; typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code, - struct _Unwind_Exception *); + _Unwind_Exception *); +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) +typedef struct _Unwind_Control_Block _Unwind_Control_Block; +typedef uint32_t _Unwind_EHT_Header; + +struct _Unwind_Control_Block { + uint64_t exception_class; + void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); + /* unwinder cache (private fields for the unwinder's use) */ + struct { + uint32_t reserved1; /* forced unwind stop function, 0 if not forced */ + uint32_t reserved2; /* personality routine */ + uint32_t reserved3; /* callsite */ + uint32_t reserved4; /* forced unwind stop argument */ + uint32_t reserved5; + } unwinder_cache; + /* propagation barrier cache (valid after phase 1) */ + struct { + uint32_t sp; + uint32_t bitpattern[5]; + } barrier_cache; + /* cleanup cache (preserved over cleanup) */ + struct { + uint32_t bitpattern[4]; + } cleanup_cache; + /* personality cache (for personality's benefit) */ + struct { + uint32_t fnstart; /* function start address */ + _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ + uint32_t additional; /* additional data */ + uint32_t reserved1; + } pr_cache; + long long int : 0; /* force alignment of next item to 8-byte boundary */ +}; +#else struct _Unwind_Exception { _Unwind_Exception_Class exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; @@ -120,23 +160,24 @@ struct _Unwind_Exception { * aligned". GCC has interpreted this to mean "use the maximum useful * alignment for the target"; so do we. */ } __attribute__((__aligned__)); +#endif typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, + _Unwind_Exception *, struct _Unwind_Context *, void *); -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)( - int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *, - struct _Unwind_Context *); +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn)(int, _Unwind_Action, + _Unwind_Exception_Class, + _Unwind_Exception *, + struct _Unwind_Context *); typedef _Unwind_Personality_Fn __personality_routine; typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *, void *); -#if defined(__arm__) && !defined(__APPLE__) - +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) typedef enum { _UVRSC_CORE = 0, /* integer register */ _UVRSC_VFP = 1, /* vfp */ @@ -158,14 +199,12 @@ typedef enum { _UVRSR_FAILED = 2 } _Unwind_VRS_Result; -#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__ARM_DWARF_EH__) typedef uint32_t _Unwind_State; #define _US_VIRTUAL_UNWIND_FRAME ((_Unwind_State)0) #define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1) #define _US_UNWIND_FRAME_RESUME ((_Unwind_State)2) #define _US_ACTION_MASK ((_Unwind_State)3) #define _US_FORCE_UNWIND ((_Unwind_State)8) -#endif _Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context, _Unwind_VRS_RegClass __regclass, @@ -224,14 +263,13 @@ _Unwind_Ptr _Unwind_GetRegionStart(struct _Unwind_Cont /* DWARF EH functions; currently not available on Darwin/ARM */ #if !defined(__APPLE__) || !defined(__arm__) +_Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_ForcedUnwind(_Unwind_Exception *, _Unwind_Stop_Fn, + void *); +void _Unwind_DeleteException(_Unwind_Exception *); +void _Unwind_Resume(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(_Unwind_Exception *); -_Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *, - _Unwind_Stop_Fn, void *); -void _Unwind_DeleteException(struct _Unwind_Exception *); -void _Unwind_Resume(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *); - #endif _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *); @@ -241,11 +279,11 @@ typedef struct SjLj_Function_Context *_Unwind_Function void _Unwind_SjLj_Register(_Unwind_FunctionContext_t); void _Unwind_SjLj_Unregister(_Unwind_FunctionContext_t); -_Unwind_Reason_Code _Unwind_SjLj_RaiseException(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(struct _Unwind_Exception *, +_Unwind_Reason_Code _Unwind_SjLj_RaiseException(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind(_Unwind_Exception *, _Unwind_Stop_Fn, void *); -void _Unwind_SjLj_Resume(struct _Unwind_Exception *); -_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(struct _Unwind_Exception *); +void _Unwind_SjLj_Resume(_Unwind_Exception *); +_Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow(_Unwind_Exception *); void *_Unwind_FindEnclosingFunction(void *); Modified: head/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -2398,6 +2398,37 @@ formatBlockPlaceholder(const PrintingPolicy &Policy, c return Result; } +static std::string GetDefaultValueString(const ParmVarDecl *Param, + const SourceManager &SM, + const LangOptions &LangOpts) { + const Expr *defaultArg = Param->getDefaultArg(); + if (!defaultArg) + return ""; + const SourceRange SrcRange = defaultArg->getSourceRange(); + CharSourceRange CharSrcRange = CharSourceRange::getTokenRange(SrcRange); + bool Invalid = CharSrcRange.isInvalid(); + if (Invalid) + return ""; + StringRef srcText = Lexer::getSourceText(CharSrcRange, SM, LangOpts, &Invalid); + if (Invalid) + return ""; + + if (srcText.empty() || srcText == "=") { + // Lexer can't determine the value. + // This happens if the code is incorrect (for example class is forward declared). + return ""; + } + std::string DefValue(srcText.str()); + // FIXME: remove this check if the Lexer::getSourceText value is fixed and + // this value always has (or always does not have) '=' in front of it + if (DefValue.at(0) != '=') { + // If we don't have '=' in front of value. + // Lexer returns built-in types values without '=' and user-defined types values with it. + return " = " + DefValue; + } + return " " + DefValue; +} + /// \brief Add function parameter chunks to the given code completion string. static void AddFunctionParameterChunks(Preprocessor &PP, const PrintingPolicy &Policy, @@ -2431,6 +2462,8 @@ static void AddFunctionParameterChunks(Preprocessor &P // Format the placeholder string. std::string PlaceholderStr = FormatFunctionParameter(Policy, Param); + if (Param->hasDefaultArg()) + PlaceholderStr += GetDefaultValueString(Param, PP.getSourceManager(), PP.getLangOpts()); if (Function->isVariadic() && P == N - 1) PlaceholderStr += ", ..."; @@ -3012,10 +3045,14 @@ static void AddOverloadParameterChunks(ASTContext &Con // Format the placeholder string. std::string Placeholder; - if (Function) - Placeholder = FormatFunctionParameter(Policy, Function->getParamDecl(P)); - else + if (Function) { + const ParmVarDecl *Param = Function->getParamDecl(P); + Placeholder = FormatFunctionParameter(Policy, Param); + if (Param->hasDefaultArg()) + Placeholder += GetDefaultValueString(Param, Context.getSourceManager(), Context.getLangOpts()); + } else { Placeholder = Prototype->getParamType(P).getAsString(Policy); + } if (P == CurrentArg) Result.AddCurrentParameterChunk( Modified: head/contrib/llvm/tools/clang/tools/clang-format/ClangFormat.cpp ============================================================================== --- head/contrib/llvm/tools/clang/tools/clang-format/ClangFormat.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/clang/tools/clang-format/ClangFormat.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -328,7 +328,8 @@ static bool format(StringRef FileName) { } // namespace format } // namespace clang -static void PrintVersion(raw_ostream &OS) { +static void PrintVersion() { + raw_ostream &OS = outs(); OS << clang::getClangToolFullVersion("clang-format") << '\n'; } Modified: head/contrib/llvm/tools/lld/COFF/Config.h ============================================================================== --- head/contrib/llvm/tools/lld/COFF/Config.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/lld/COFF/Config.h Sun Jul 30 18:01:34 2017 (r321723) @@ -130,7 +130,7 @@ struct Configuration { std::map Section; // Options for manifest files. - ManifestKind Manifest = SideBySide; + ManifestKind Manifest = No; int ManifestID = 1; StringRef ManifestDependency; bool ManifestUAC = true; Modified: head/contrib/llvm/tools/lld/COFF/Driver.cpp ============================================================================== --- head/contrib/llvm/tools/lld/COFF/Driver.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/lld/COFF/Driver.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -899,18 +899,25 @@ void LinkerDriver::link(ArrayRef ArgsArr for (auto *Arg : Args.filtered(OPT_section)) parseSection(Arg->getValue()); - // Handle /manifest - if (auto *Arg = Args.getLastArg(OPT_manifest_colon)) - parseManifest(Arg->getValue()); + // Handle /manifestdependency. This enables /manifest unless /manifest:no is + // also passed. + if (auto *Arg = Args.getLastArg(OPT_manifestdependency)) { + Config->ManifestDependency = Arg->getValue(); + Config->Manifest = Configuration::SideBySide; + } + // Handle /manifest and /manifest: + if (auto *Arg = Args.getLastArg(OPT_manifest, OPT_manifest_colon)) { + if (Arg->getOption().getID() == OPT_manifest) + Config->Manifest = Configuration::SideBySide; + else + parseManifest(Arg->getValue()); + } + // Handle /manifestuac if (auto *Arg = Args.getLastArg(OPT_manifestuac)) parseManifestUAC(Arg->getValue()); - // Handle /manifestdependency - if (auto *Arg = Args.getLastArg(OPT_manifestdependency)) - Config->ManifestDependency = Arg->getValue(); - // Handle /manifestfile if (auto *Arg = Args.getLastArg(OPT_manifestfile)) Config->ManifestFile = Arg->getValue(); @@ -918,6 +925,11 @@ void LinkerDriver::link(ArrayRef ArgsArr // Handle /manifestinput for (auto *Arg : Args.filtered(OPT_manifestinput)) Config->ManifestInput.push_back(Arg->getValue()); + + if (!Config->ManifestInput.empty() && + Config->Manifest != Configuration::Embed) { + fatal("/MANIFESTINPUT: requires /MANIFEST:EMBED"); + } // Handle miscellaneous boolean flags. if (Args.hasArg(OPT_allowisolation_no)) Modified: head/contrib/llvm/tools/lld/ELF/InputFiles.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/InputFiles.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/lld/ELF/InputFiles.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -91,8 +91,7 @@ template void elf::ObjectFile::init template Optional elf::ObjectFile::getDILineInfo(InputSectionBase *S, uint64_t Offset) { - if (!DwarfLine) - initializeDwarfLine(); + llvm::call_once(InitDwarfLine, [this]() { initializeDwarfLine(); }); // The offset to CU is 0. const DWARFDebugLine::LineTable *Tbl = DwarfLine->getLineTable(0); Modified: head/contrib/llvm/tools/lld/ELF/InputFiles.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/InputFiles.h Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/lld/ELF/InputFiles.h Sun Jul 30 18:01:34 2017 (r321723) @@ -24,6 +24,7 @@ #include "llvm/Object/Archive.h" #include "llvm/Object/ELF.h" #include "llvm/Object/IRObjectFile.h" +#include "llvm/Support/Threading.h" #include @@ -211,6 +212,7 @@ template class ObjectFile : public ELFFil // single object file, so we cache debugging information in order to // parse it only once for each object file we link. std::unique_ptr DwarfLine; + llvm::once_flag InitDwarfLine; }; // LazyObjectFile is analogous to ArchiveFile in the sense that Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Sun Jul 30 16:45:28 2017 (r321722) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Sun Jul 30 18:01:34 2017 (r321723) @@ -211,6 +211,12 @@ static uint8_t getMinVisibility(uint8_t VA, uint8_t VB // Find an existing symbol or create and insert a new one. template std::pair SymbolTable::insert(StringRef Name) { + // @@ means the symbol is the default version. In that + // case @@ will be used to resolve references to . + size_t Pos = Name.find("@@"); + if (Pos != StringRef::npos) + Name = Name.take_front(Pos); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***