From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:33 2017 Return-Path: Delivered-To: svn-src-vendor@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 ED471CBD439; Sun, 22 Jan 2017 16:52:33 +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 A3A02F37; Sun, 22 Jan 2017 16:52:33 +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 v0MGqWP4022801; Sun, 22 Jan 2017 16:52:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqURt022768; Sun, 22 Jan 2017 16:52:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqURt022768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312625 - in vendor/llvm/dist: cmake/modules docs include/llvm/Analysis lib/Analysis lib/Bitcode/Reader lib/LTO lib/Target/X86 lib/Transforms/Scalar lib/Transforms/Vectorize test/CodeGe... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:52:34 -0000 Author: dim Date: Sun Jan 22 16:52:30 2017 New Revision: 312625 URL: https://svnweb.freebsd.org/changeset/base/312625 Log: Vendor import of llvm release_40 branch r292732: https://llvm.org/svn/llvm-project/llvm/branches/release_40@292732 Added: vendor/llvm/dist/test/Transforms/LoopStrengthReduce/pr31627.ll vendor/llvm/dist/test/Transforms/LoopVectorize/X86/consecutive-ptr-uniforms.ll vendor/llvm/dist/test/Transforms/NewGVN/pr31613.ll Modified: vendor/llvm/dist/cmake/modules/AddLLVM.cmake vendor/llvm/dist/docs/ReleaseNotes.rst vendor/llvm/dist/docs/index.rst vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll Modified: vendor/llvm/dist/cmake/modules/AddLLVM.cmake ============================================================================== --- vendor/llvm/dist/cmake/modules/AddLLVM.cmake Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/cmake/modules/AddLLVM.cmake Sun Jan 22 16:52:30 2017 (r312625) @@ -462,11 +462,9 @@ function(llvm_add_library name) if(UNIX AND NOT APPLE AND NOT ARG_SONAME) set_target_properties(${name} PROPERTIES - # Concatenate the version numbers since ldconfig expects exactly - # one component indicating the ABI version, while LLVM uses - # major+minor for that. - SOVERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR} - VERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}) + # Since 4.0.0, the ABI version is indicated by the major version + SOVERSION ${LLVM_VERSION_MAJOR} + VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}${LLVM_VERSION_SUFFIX}) endif() endif() Modified: vendor/llvm/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.rst Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:30 2017 (r312625) @@ -67,13 +67,46 @@ Non-comprehensive list of changes in thi Makes programs 10x faster by doing Special New Thing. + Improvements to ThinLTO (-flto=thin) + ------------------------------------ + * Integration with profile data (PGO). When available, profile data + enables more accurate function importing decisions, as well as + cross-module indirect call promotion. + * Significant build-time and binary-size improvements when compiling with + debug info (-g). + Changes to the LLVM IR ---------------------- -Changes to the ARM Backend +Changes to the ARM Targets -------------------------- - During this release ... +**During this release the AArch64 target has:** + +* Gained support for ILP32 relocations. +* Gained support for XRay. +* Made even more progress on GlobalISel. There is still some work left before + it is production-ready though. +* Refined the support for Qualcomm's Falkor and Samsung's Exynos CPUs. +* Learned a few new tricks for lowering multiplications by constants, folding + spilled/refilled copies etc. + +**During this release the ARM target has:** + +* Gained support for ROPI (read-only position independence) and RWPI + (read-write position independence), which can be used to remove the need for + a dynamic linker. +* Gained support for execute-only code, which is placed in pages without read + permissions. +* Gained a machine scheduler for Cortex-R52. +* Gained support for XRay. +* Gained Thumb1 implementations for several compiler-rt builtins. It also + has some support for building the builtins for HF targets. +* Started using the generic bitreverse intrinsic instead of rbit. +* Gained very basic support for GlobalISel. + +A lot of work has also been done in LLD for ARM, which now supports more +relocations and TLS. Changes to the MIPS Target Modified: vendor/llvm/dist/docs/index.rst ============================================================================== --- vendor/llvm/dist/docs/index.rst Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/docs/index.rst Sun Jan 22 16:52:30 2017 (r312625) @@ -1,11 +1,6 @@ Overview ======== -.. warning:: - - If you are using a released version of LLVM, see `the download page - `_ to find your documentation. - The LLVM compiler infrastructure supports a wide range of projects, from industrial strength compilers to specialized JIT applications to small research projects. Modified: vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h ============================================================================== --- vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h Sun Jan 22 16:52:30 2017 (r312625) @@ -68,7 +68,10 @@ class AssumptionCache { AffectedValuesMap AffectedValues; /// Get the vector of assumptions which affect a value from the cache. - SmallVector &getAffectedValues(Value *V); + SmallVector &getOrInsertAffectedValues(Value *V); + + /// Copy affected values in the cache for OV to be affected values for NV. + void copyAffectedValuesInCache(Value *OV, Value *NV); /// \brief Flag tracking whether we have scanned the function yet. /// Modified: vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -24,7 +24,7 @@ using namespace llvm; using namespace llvm::PatternMatch; -SmallVector &AssumptionCache::getAffectedValues(Value *V) { +SmallVector &AssumptionCache::getOrInsertAffectedValues(Value *V) { // Try using find_as first to avoid creating extra value handles just for the // purpose of doing the lookup. auto AVI = AffectedValues.find_as(V); @@ -98,7 +98,7 @@ void AssumptionCache::updateAffectedValu } for (auto &AV : Affected) { - auto &AVV = getAffectedValues(AV); + auto &AVV = getOrInsertAffectedValues(AV); if (std::find(AVV.begin(), AVV.end(), CI) == AVV.end()) AVV.push_back(CI); } @@ -111,20 +111,27 @@ void AssumptionCache::AffectedValueCallb // 'this' now dangles! } +void AssumptionCache::copyAffectedValuesInCache(Value *OV, Value *NV) { + auto &NAVV = getOrInsertAffectedValues(NV); + auto AVI = AffectedValues.find(OV); + if (AVI == AffectedValues.end()) + return; + + for (auto &A : AVI->second) + if (std::find(NAVV.begin(), NAVV.end(), A) == NAVV.end()) + NAVV.push_back(A); +} + void AssumptionCache::AffectedValueCallbackVH::allUsesReplacedWith(Value *NV) { if (!isa(NV) && !isa(NV)) return; // Any assumptions that affected this value now affect the new value. - auto &NAVV = AC->getAffectedValues(NV); - auto AVI = AC->AffectedValues.find(getValPtr()); - if (AVI == AC->AffectedValues.end()) - return; - - for (auto &A : AVI->second) - if (std::find(NAVV.begin(), NAVV.end(), A) == NAVV.end()) - NAVV.push_back(A); + AC->copyAffectedValuesInCache(getValPtr(), NV); + // 'this' now might dangle! If the AffectedValues map was resized to add an + // entry for NV then this object might have been destroyed in favor of some + // copy in the grown map. } void AssumptionCache::scanFunction() { Modified: vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp ============================================================================== --- vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -405,6 +405,7 @@ char ModuleSummaryIndexWrapperPass::ID = INITIALIZE_PASS_BEGIN(ModuleSummaryIndexWrapperPass, "module-summary-analysis", "Module Summary Analysis", false, true) INITIALIZE_PASS_DEPENDENCY(BlockFrequencyInfoWrapperPass) +INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass) INITIALIZE_PASS_END(ModuleSummaryIndexWrapperPass, "module-summary-analysis", "Module Summary Analysis", false, true) Modified: vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -768,13 +768,12 @@ void MetadataLoader::MetadataLoaderImpl: unsigned ID, PlaceholderQueue &Placeholders) { assert(ID < (MDStringRef.size()) + GlobalMetadataBitPosIndex.size()); assert(ID >= MDStringRef.size() && "Unexpected lazy-loading of MDString"); -#ifndef NDEBUG // Lookup first if the metadata hasn't already been loaded. if (auto *MD = MetadataList.lookup(ID)) { auto *N = dyn_cast_or_null(MD); - assert(N && N->isTemporary() && "Lazy loading an already loaded metadata"); + if (!N->isTemporary()) + return; } -#endif SmallVector Record; StringRef Blob; IndexCursor.JumpToBit(GlobalMetadataBitPosIndex[ID - MDStringRef.size()]); @@ -827,8 +826,22 @@ Error MetadataLoader::MetadataLoaderImpl auto getMD = [&](unsigned ID) -> Metadata * { if (ID < MDStringRef.size()) return lazyLoadOneMDString(ID); - if (!IsDistinct) + if (!IsDistinct) { + if (auto *MD = MetadataList.lookup(ID)) + return MD; + // If lazy-loading is enabled, we try recursively to load the operand + // instead of creating a temporary. + if (ID < (MDStringRef.size() + GlobalMetadataBitPosIndex.size())) { + // Create a temporary for the node that is referencing the operand we + // will lazy-load. It is needed before recursing in case there are + // uniquing cycles. + MetadataList.getMetadataFwdRef(NextMetadataNo); + lazyLoadOneMetadata(ID, Placeholders); + return MetadataList.lookup(ID); + } + // Return a temporary. return MetadataList.getMetadataFwdRef(ID); + } if (auto *MD = MetadataList.getMetadataIfResolved(ID)) return MD; return &Placeholders.getPlaceholderOp(ID); Modified: vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp ============================================================================== --- vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -829,11 +829,22 @@ static std::string writeGeneratedObject( // Main entry point for the ThinLTO processing void ThinLTOCodeGenerator::run() { + // Prepare the resulting object vector + assert(ProducedBinaries.empty() && "The generator should not be reused"); + if (SavedObjectsDirectoryPath.empty()) + ProducedBinaries.resize(Modules.size()); + else { + sys::fs::create_directories(SavedObjectsDirectoryPath); + bool IsDir; + sys::fs::is_directory(SavedObjectsDirectoryPath, IsDir); + if (!IsDir) + report_fatal_error("Unexistent dir: '" + SavedObjectsDirectoryPath + "'"); + ProducedBinaryFiles.resize(Modules.size()); + } + if (CodeGenOnly) { // Perform only parallel codegen and return. ThreadPool Pool; - assert(ProducedBinaries.empty() && "The generator should not be reused"); - ProducedBinaries.resize(Modules.size()); int count = 0; for (auto &ModuleBuffer : Modules) { Pool.async([&](int count) { @@ -845,7 +856,12 @@ void ThinLTOCodeGenerator::run() { /*IsImporting*/ false); // CodeGen - ProducedBinaries[count] = codegen(*TheModule); + auto OutputBuffer = codegen(*TheModule); + if (SavedObjectsDirectoryPath.empty()) + ProducedBinaries[count] = std::move(OutputBuffer); + else + ProducedBinaryFiles[count] = writeGeneratedObject( + count, "", SavedObjectsDirectoryPath, *OutputBuffer); }, count++); } @@ -866,18 +882,6 @@ void ThinLTOCodeGenerator::run() { WriteIndexToFile(*Index, OS); } - // Prepare the resulting object vector - assert(ProducedBinaries.empty() && "The generator should not be reused"); - if (SavedObjectsDirectoryPath.empty()) - ProducedBinaries.resize(Modules.size()); - else { - sys::fs::create_directories(SavedObjectsDirectoryPath); - bool IsDir; - sys::fs::is_directory(SavedObjectsDirectoryPath, IsDir); - if (!IsDir) - report_fatal_error("Unexistent dir: '" + SavedObjectsDirectoryPath + "'"); - ProducedBinaryFiles.resize(Modules.size()); - } // Prepare the module map. auto ModuleMap = generateModuleMap(Modules); Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -29455,19 +29455,11 @@ static SDValue combineSelect(SDNode *N, return SDValue(); } -/// Combine brcond/cmov/setcc/.. based on comparing the result of -/// atomic_load_add to use EFLAGS produced by the addition -/// directly if possible. For example: -/// -/// (setcc (cmp (atomic_load_add x, -C) C), COND_E) -/// becomes: -/// (setcc (LADD x, -C), COND_E) -/// -/// and +/// Combine: /// (brcond/cmov/setcc .., (cmp (atomic_load_add x, 1), 0), COND_S) -/// becomes: +/// to: /// (brcond/cmov/setcc .., (LADD x, 1), COND_LE) -/// +/// i.e., reusing the EFLAGS produced by the LOCKed instruction. /// Note that this is only legal for some op/cc combinations. static SDValue combineSetCCAtomicArith(SDValue Cmp, X86::CondCode &CC, SelectionDAG &DAG) { @@ -29482,7 +29474,7 @@ static SDValue combineSetCCAtomicArith(S if (!Cmp.hasOneUse()) return SDValue(); - // This applies to variations of the common case: + // This only applies to variations of the common case: // (icmp slt x, 0) -> (icmp sle (add x, 1), 0) // (icmp sge x, 0) -> (icmp sgt (add x, 1), 0) // (icmp sle x, 0) -> (icmp slt (sub x, 1), 0) @@ -29501,9 +29493,8 @@ static SDValue combineSetCCAtomicArith(S return SDValue(); auto *CmpRHSC = dyn_cast(CmpRHS); - if (!CmpRHSC) + if (!CmpRHSC || CmpRHSC->getZExtValue() != 0) return SDValue(); - APInt Comparand = CmpRHSC->getAPIntValue(); const unsigned Opc = CmpLHS.getOpcode(); @@ -29519,19 +29510,16 @@ static SDValue combineSetCCAtomicArith(S if (Opc == ISD::ATOMIC_LOAD_SUB) Addend = -Addend; - if (Comparand == -Addend) { - // No change to CC. - } else if (CC == X86::COND_S && Comparand == 0 && Addend == 1) { + if (CC == X86::COND_S && Addend == 1) CC = X86::COND_LE; - } else if (CC == X86::COND_NS && Comparand == 0 && Addend == 1) { + else if (CC == X86::COND_NS && Addend == 1) CC = X86::COND_G; - } else if (CC == X86::COND_G && Comparand == 0 && Addend == -1) { + else if (CC == X86::COND_G && Addend == -1) CC = X86::COND_GE; - } else if (CC == X86::COND_LE && Comparand == 0 && Addend == -1) { + else if (CC == X86::COND_LE && Addend == -1) CC = X86::COND_L; - } else { + else return SDValue(); - } SDValue LockOp = lowerAtomicArithWithLOCK(CmpLHS, DAG); DAG.ReplaceAllUsesOfValueWith(CmpLHS.getValue(0), Modified: vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -232,9 +232,6 @@ void X86Subtarget::initSubtargetFeatures else if (isTargetDarwin() || isTargetLinux() || isTargetSolaris() || isTargetKFreeBSD() || In64BitMode) stackAlignment = 16; - - assert((!isPMULLDSlow() || hasSSE41()) && - "Feature Slow PMULLD can only be set on a subtarget with SSE4.1"); } void X86Subtarget::initializeEnvironment() { Modified: vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -3163,6 +3163,9 @@ LSRInstance::CollectLoopInvariantFixupsA // Don't bother if the instruction is in a BB which ends in an EHPad. if (UseBB->getTerminator()->isEHPad()) continue; + // Don't bother rewriting PHIs in catchswitch blocks. + if (isa(UserInst->getParent()->getTerminator())) + continue; // Ignore uses which are part of other SCEV expressions, to avoid // analyzing them multiple times. if (SE.isSCEVable(UserInst->getType())) { @@ -4672,7 +4675,8 @@ void LSRInstance::RewriteForPHI(PHINode // is the canonical backedge for this loop, which complicates post-inc // users. if (e != 1 && BB->getTerminator()->getNumSuccessors() > 1 && - !isa(BB->getTerminator())) { + !isa(BB->getTerminator()) && + !isa(BB->getTerminator())) { BasicBlock *Parent = PN->getParent(); Loop *PNLoop = LI.getLoopFor(Parent); if (!PNLoop || Parent != PNLoop->getHeader()) { Modified: vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -81,6 +81,10 @@ STATISTIC(NumGVNOpsSimplified, "Number o STATISTIC(NumGVNPhisAllSame, "Number of PHIs whos arguments are all the same"); STATISTIC(NumGVNMaxIterations, "Maximum Number of iterations it took to converge GVN"); +STATISTIC(NumGVNLeaderChanges, "Number of leader changes"); +STATISTIC(NumGVNSortedLeaderChanges, "Number of sorted leader changes"); +STATISTIC(NumGVNAvoidedSortedLeaderChanges, + "Number of avoided sorted leader changes"); //===----------------------------------------------------------------------===// // GVN Pass @@ -139,6 +143,10 @@ struct CongruenceClass { // This is used so we can detect store equivalence changes properly. int StoreCount = 0; + // The most dominating leader after our current leader, because the member set + // is not sorted and is expensive to keep sorted all the time. + std::pair NextLeader = {nullptr, ~0U}; + explicit CongruenceClass(unsigned ID) : ID(ID) {} CongruenceClass(unsigned ID, Value *Leader, const Expression *E) : ID(ID), RepLeader(Leader), DefiningExpr(E) {} @@ -320,8 +328,8 @@ private: // Templated to allow them to work both on BB's and BB-edges. template Value *lookupOperandLeader(Value *, const User *, const T &) const; - void performCongruenceFinding(Value *, const Expression *); - void moveValueToNewCongruenceClass(Value *, CongruenceClass *, + void performCongruenceFinding(Instruction *, const Expression *); + void moveValueToNewCongruenceClass(Instruction *, CongruenceClass *, CongruenceClass *); // Reachability handling. void updateReachableEdge(BasicBlock *, BasicBlock *); @@ -1056,20 +1064,43 @@ void NewGVN::markLeaderChangeTouched(Con // Move a value, currently in OldClass, to be part of NewClass // Update OldClass for the move (including changing leaders, etc) -void NewGVN::moveValueToNewCongruenceClass(Value *V, CongruenceClass *OldClass, +void NewGVN::moveValueToNewCongruenceClass(Instruction *I, + CongruenceClass *OldClass, CongruenceClass *NewClass) { - DEBUG(dbgs() << "New congruence class for " << V << " is " << NewClass->ID + DEBUG(dbgs() << "New congruence class for " << I << " is " << NewClass->ID << "\n"); - OldClass->Members.erase(V); - NewClass->Members.insert(V); - if (isa(V)) { + + if (I == OldClass->NextLeader.first) + OldClass->NextLeader = {nullptr, ~0U}; + + // The new instruction and new class leader may either be siblings in the + // dominator tree, or the new class leader should dominate the new member + // instruction. We simply check that the member instruction does not properly + // dominate the new class leader. + assert( + !isa(NewClass->RepLeader) || !NewClass->RepLeader || + I == NewClass->RepLeader || + !DT->properlyDominates( + I->getParent(), + cast(NewClass->RepLeader)->getParent()) && + "New class for instruction should not be dominated by instruction"); + + if (NewClass->RepLeader != I) { + auto DFSNum = InstrDFS.lookup(I); + if (DFSNum < NewClass->NextLeader.second) + NewClass->NextLeader = {I, DFSNum}; + } + + OldClass->Members.erase(I); + NewClass->Members.insert(I); + if (isa(I)) { --OldClass->StoreCount; assert(OldClass->StoreCount >= 0); ++NewClass->StoreCount; assert(NewClass->StoreCount > 0); } - ValueToClass[V] = NewClass; + ValueToClass[I] = NewClass; // See if we destroyed the class or need to swap leaders. if (OldClass->Members.empty() && OldClass != InitialClass) { if (OldClass->DefiningExpr) { @@ -1078,25 +1109,48 @@ void NewGVN::moveValueToNewCongruenceCla << " from table\n"); ExpressionToClass.erase(OldClass->DefiningExpr); } - } else if (OldClass->RepLeader == V) { + } else if (OldClass->RepLeader == I) { // When the leader changes, the value numbering of // everything may change due to symbolization changes, so we need to // reprocess. - OldClass->RepLeader = *(OldClass->Members.begin()); + DEBUG(dbgs() << "Leader change!\n"); + ++NumGVNLeaderChanges; + // We don't need to sort members if there is only 1, and we don't care about + // sorting the initial class because everything either gets out of it or is + // unreachable. + if (OldClass->Members.size() == 1 || OldClass == InitialClass) { + OldClass->RepLeader = *(OldClass->Members.begin()); + } else if (OldClass->NextLeader.first) { + ++NumGVNAvoidedSortedLeaderChanges; + OldClass->RepLeader = OldClass->NextLeader.first; + OldClass->NextLeader = {nullptr, ~0U}; + } else { + ++NumGVNSortedLeaderChanges; + // TODO: If this ends up to slow, we can maintain a dual structure for + // member testing/insertion, or keep things mostly sorted, and sort only + // here, or .... + std::pair MinDFS = {nullptr, ~0U}; + for (const auto X : OldClass->Members) { + auto DFSNum = InstrDFS.lookup(X); + if (DFSNum < MinDFS.second) + MinDFS = {X, DFSNum}; + } + OldClass->RepLeader = MinDFS.first; + } markLeaderChangeTouched(OldClass); } } // Perform congruence finding on a given value numbering expression. -void NewGVN::performCongruenceFinding(Value *V, const Expression *E) { - ValueToExpression[V] = E; +void NewGVN::performCongruenceFinding(Instruction *I, const Expression *E) { + ValueToExpression[I] = E; // This is guaranteed to return something, since it will at least find // INITIAL. - CongruenceClass *VClass = ValueToClass[V]; - assert(VClass && "Should have found a vclass"); + CongruenceClass *IClass = ValueToClass[I]; + assert(IClass && "Should have found a IClass"); // Dead classes should have been eliminated from the mapping. - assert(!VClass->Dead && "Found a dead class"); + assert(!IClass->Dead && "Found a dead class"); CongruenceClass *EClass; if (const auto *VE = dyn_cast(E)) { @@ -1118,13 +1172,13 @@ void NewGVN::performCongruenceFinding(Va NewClass->RepLeader = lookupOperandLeader(SI->getValueOperand(), SI, SI->getParent()); } else { - NewClass->RepLeader = V; + NewClass->RepLeader = I; } assert(!isa(E) && "VariableExpression should have been handled already"); EClass = NewClass; - DEBUG(dbgs() << "Created new congruence class for " << *V + DEBUG(dbgs() << "Created new congruence class for " << *I << " using expression " << *E << " at " << NewClass->ID << " and leader " << *(NewClass->RepLeader) << "\n"); DEBUG(dbgs() << "Hash value was " << E->getHashValue() << "\n"); @@ -1140,36 +1194,31 @@ void NewGVN::performCongruenceFinding(Va assert(!EClass->Dead && "We accidentally looked up a dead class"); } } - bool ClassChanged = VClass != EClass; - bool LeaderChanged = LeaderChanges.erase(V); + bool ClassChanged = IClass != EClass; + bool LeaderChanged = LeaderChanges.erase(I); if (ClassChanged || LeaderChanged) { DEBUG(dbgs() << "Found class " << EClass->ID << " for expression " << E << "\n"); if (ClassChanged) - - moveValueToNewCongruenceClass(V, VClass, EClass); - - - markUsersTouched(V); - if (auto *I = dyn_cast(V)) { - if (MemoryAccess *MA = MSSA->getMemoryAccess(I)) { - // If this is a MemoryDef, we need to update the equivalence table. If - // we determined the expression is congruent to a different memory - // state, use that different memory state. If we determined it didn't, - // we update that as well. Right now, we only support store - // expressions. - if (!isa(MA) && isa(E) && - EClass->Members.size() != 1) { - auto *DefAccess = cast(E)->getDefiningAccess(); - setMemoryAccessEquivTo(MA, DefAccess != MA ? DefAccess : nullptr); - } else { - setMemoryAccessEquivTo(MA, nullptr); - } - markMemoryUsersTouched(MA); + moveValueToNewCongruenceClass(I, IClass, EClass); + markUsersTouched(I); + if (MemoryAccess *MA = MSSA->getMemoryAccess(I)) { + // If this is a MemoryDef, we need to update the equivalence table. If + // we determined the expression is congruent to a different memory + // state, use that different memory state. If we determined it didn't, + // we update that as well. Right now, we only support store + // expressions. + if (!isa(MA) && isa(E) && + EClass->Members.size() != 1) { + auto *DefAccess = cast(E)->getDefiningAccess(); + setMemoryAccessEquivTo(MA, DefAccess != MA ? DefAccess : nullptr); + } else { + setMemoryAccessEquivTo(MA, nullptr); } + markMemoryUsersTouched(MA); } - } else if (StoreInst *SI = dyn_cast(V)) { + } else if (auto *SI = dyn_cast(I)) { // There is, sadly, one complicating thing for stores. Stores do not // produce values, only consume them. However, in order to make loads and // stores value number the same, we ignore the value operand of the store. Modified: vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp Sun Jan 22 16:52:30 2017 (r312625) @@ -5602,6 +5602,13 @@ void LoopVectorizationLegality::collectL // is consecutive-like, the pointer operand should remain uniform. else if (hasConsecutiveLikePtrOperand(&I)) ConsecutiveLikePtrs.insert(Ptr); + + // Otherwise, if the memory instruction will be vectorized and its + // pointer operand is non-consecutive-like, the memory instruction should + // be a gather or scatter operation. Its pointer operand will be + // non-uniform. + else + PossibleNonUniformPtrs.insert(Ptr); } // Add to the Worklist all consecutive and consecutive-like pointers that Modified: vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/test/CodeGen/X86/atomic-eflags-reuse.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -192,68 +192,4 @@ entry: ret i8 %s2 } -define i8 @test_sub_1_setcc_eq(i64* %p) #0 { -; CHECK-LABEL: test_sub_1_setcc_eq: -; CHECK: # BB#0: # %entry -; CHECK-NEXT: lock decq (%rdi) -; CHECK-NEXT: sete %al -; CHECK-NEXT: retq -entry: - %tmp0 = atomicrmw sub i64* %p, i64 1 seq_cst - %tmp1 = icmp eq i64 %tmp0, 1 - %tmp2 = zext i1 %tmp1 to i8 - ret i8 %tmp2 -} - -define i8 @test_add_5_setcc_ne(i64* %p) #0 { -; CHECK-LABEL: test_add_5_setcc_ne: -; CHECK: # BB#0: # %entry -; CHECK-NEXT: lock addq $5, (%rdi) -; CHECK-NEXT: setne %al -; CHECK-NEXT: retq -entry: - %tmp0 = atomicrmw add i64* %p, i64 5 seq_cst - %tmp1 = icmp ne i64 %tmp0, -5 - %tmp2 = zext i1 %tmp1 to i8 - ret i8 %tmp2 -} - -define i8 @test_add_5_setcc_ne_comparand_mismatch(i64* %p) #0 { -; CHECK-LABEL: test_add_5_setcc_ne_comparand_mismatch: -; CHECK: # BB#0: # %entry -; CHECK-NEXT: movl $5, %eax -; CHECK-NEXT: lock xaddq %rax, (%rdi) -; CHECK-NEXT: testq %rax, %rax -; CHECK-NEXT: setne %al -; CHECK-NEXT: retq -entry: - %tmp0 = atomicrmw add i64* %p, i64 5 seq_cst - %tmp1 = icmp ne i64 %tmp0, 0 - %tmp2 = zext i1 %tmp1 to i8 - ret i8 %tmp2 -} - -declare void @g() -define zeroext i1 @test_sub_1_setcc_jcc(i64* %p) local_unnamed_addr #0 { -; TODO: It's possible to use "lock dec" here, but both uses of the cmp need to -; be updated. -; CHECK-LABEL: test_sub_1_setcc_jcc: -; CHECK: # BB#0: # %entry -; CHECK: movq $-1, %rax -; CHECK-NEXT: lock xaddq %rax, (%rdi) -; CHECK-NEXT: cmpq $1, %rax -; CHECK-NEXT: sete %bl -; CHECK-NEXT: jne -entry: - %add = atomicrmw volatile add i64* %p, i64 -1 seq_cst - %cmp = icmp ne i64 %add, 1 - %not = xor i1 %cmp, true - br i1 %cmp, label %else, label %then -then: - tail call void @g() - br label %else -else: - ret i1 %not -} - attributes #0 = { nounwind } Modified: vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/test/CodeGen/X86/slow-pmulld.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -4,6 +4,9 @@ ; RUN: llc < %s -mtriple=i386-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=SSE4-32 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=SSE4-64 +; Make sure that the slow-pmulld feature can be used without SSE4.1. +; RUN: llc < %s -mtriple=i386-unknown-unknown -mcpu=silvermont -mattr=-sse4.1 + define <4 x i32> @foo(<4 x i8> %A) { ; CHECK32-LABEL: foo: ; CHECK32: # BB#0: Modified: vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll ============================================================================== --- vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll Sun Jan 22 16:05:13 2017 (r312624) +++ vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -17,7 +17,7 @@ ; RUN: -o /dev/null -disable-ondemand-mds-loading -stats \ ; RUN: 2>&1 | FileCheck %s -check-prefix=NOTLAZY ; NOTLAZY: 58 bitcode-reader - Number of Metadata records loaded -; NOTLAZY: 8 bitcode-reader - Number of MDStrings loaded +; NOTLAZY: 6 bitcode-reader - Number of MDStrings loaded target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" @@ -48,7 +48,7 @@ define void @globalfunc3(i32 %arg) { !3 = !{!"3"} !4 = !{!"4"} !5 = !{!"5"} -!6 = !{!"6"} +!6 = !{!9} !7 = !{!"7"} !8 = !{!"8"} -!9 = !{!"9"} +!9 = !{!6} Added: vendor/llvm/dist/test/Transforms/LoopStrengthReduce/pr31627.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Transforms/LoopStrengthReduce/pr31627.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -0,0 +1,58 @@ +; RUN: opt -S -loop-reduce < %s | FileCheck %s +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc-windows-msvc19.0.24215" + +define void @fn3() personality i32 (...)* @__CxxFrameHandler3 { +entry: + %call = invoke i32 @fn2() + to label %for.cond.preheader unwind label %catch.dispatch2 + +for.cond.preheader: ; preds = %entry + br label %for.cond + +for.cond: ; preds = %for.cond.preheader, %for.cond + %b.0 = phi i32 [ %inc, %for.cond ], [ %call, %for.cond.preheader ] + %inc = add nsw i32 %b.0, 1 + invoke void @fn1(i32 %inc) + to label %for.cond unwind label %catch.dispatch + +; CHECK: %[[add:.*]] = add i32 %call, 1 +; CHECK: br label %for.cond + +; CHECK: for.cond: ; preds = %for.cond, %for.cond.preheader +; CHECK: %[[lsr_iv:.*]] = phi i32 [ %lsr.iv.next, %for.cond ], [ %[[add]], %for.cond.preheader ] +; CHECK: %[[lsr_iv_next:.*]] = add i32 %lsr.iv, 1 +; CHECK: invoke void @fn1(i32 %[[lsr_iv]]) + + +catch.dispatch: ; preds = %for.cond + %0 = catchswitch within none [label %catch] unwind label %catch.dispatch2 + +catch: ; preds = %catch.dispatch + %1 = catchpad within %0 [i8* null, i32 64, i8* null] + invoke void @_CxxThrowException(i8* null, i8* null) #2 [ "funclet"(token %1) ] + to label %unreachable unwind label %catch.dispatch2 + +catch.dispatch2: ; preds = %catch.dispatch, %catch, %entry + %a.0 = phi i32 [ undef, %entry ], [ %call, %catch ], [ %call, %catch.dispatch ] + %2 = catchswitch within none [label %catch3] unwind to caller + +catch3: ; preds = %catch.dispatch2 + %3 = catchpad within %2 [i8* null, i32 64, i8* null] + call void @fn1(i32 %a.0) [ "funclet"(token %3) ] + catchret from %3 to label %try.cont4 + +try.cont4: ; preds = %catch3 + ret void + +unreachable: ; preds = %catch + unreachable +} + +declare i32 @fn2() + +declare i32 @__CxxFrameHandler3(...) + +declare void @fn1(i32) + +declare void @_CxxThrowException(i8*, i8*) Added: vendor/llvm/dist/test/Transforms/LoopVectorize/X86/consecutive-ptr-uniforms.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Transforms/LoopVectorize/X86/consecutive-ptr-uniforms.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -0,0 +1,56 @@ +; REQUIRES: asserts +; RUN: opt < %s -loop-vectorize -instcombine -S -debug-only=loop-vectorize -disable-output -print-after=instcombine 2>&1 | FileCheck %s + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; CHECK-LABEL: PR31671 +; +; Check a pointer in which one of its uses is consecutive-like and another of +; its uses is non-consecutive-like. In the test case below, %tmp3 is the +; pointer operand of an interleaved load, making it consecutive-like. However, +; it is also the pointer operand of a non-interleaved store that will become a +; scatter operation. %tmp3 (and the induction variable) should not be marked +; uniform-after-vectorization. +; +; CHECK: LV: Found uniform instruction: %tmp0 = getelementptr inbounds %data, %data* %d, i64 0, i32 3, i64 %i +; CHECK-NOT: LV: Found uniform instruction: %tmp3 = getelementptr inbounds %data, %data* %d, i64 0, i32 0, i64 %i +; CHECK-NOT: LV: Found uniform instruction: %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] +; CHECK-NOT: LV: Found uniform instruction: %i.next = add nuw nsw i64 %i, 5 +; CHECK: vector.body: +; CHECK: %vec.ind = phi <16 x i64> +; CHECK: %[[T0:.+]] = extractelement <16 x i64> %vec.ind, i32 0 +; CHECK: %[[T1:.+]] = getelementptr inbounds %data, %data* %d, i64 0, i32 3, i64 %[[T0]] +; CHECK: %[[T2:.+]] = bitcast float* %[[T1]] to <80 x float>* +; CHECK: load <80 x float>, <80 x float>* %[[T2]], align 4 +; CHECK: %[[T3:.+]] = getelementptr inbounds %data, %data* %d, i64 0, i32 0, i64 %[[T0]] +; CHECK: %[[T4:.+]] = bitcast float* %[[T3]] to <80 x float>* +; CHECK: load <80 x float>, <80 x float>* %[[T4]], align 4 +; CHECK: %VectorGep = getelementptr inbounds %data, %data* %d, i64 0, i32 0, <16 x i64> %vec.ind +; CHECK: call void @llvm.masked.scatter.v16f32({{.*}}, <16 x float*> %VectorGep, {{.*}}) +; CHECK: br i1 {{.*}}, label %middle.block, label %vector.body + +%data = type { [32000 x float], [3 x i32], [4 x i8], [32000 x float] } + +define void @PR31671(float %x, %data* %d) #0 { +entry: + br label %for.body + +for.body: + %i = phi i64 [ %i.next, %for.body ], [ 0, %entry ] + %tmp0 = getelementptr inbounds %data, %data* %d, i64 0, i32 3, i64 %i + %tmp1 = load float, float* %tmp0, align 4 + %tmp2 = fmul float %x, %tmp1 + %tmp3 = getelementptr inbounds %data, %data* %d, i64 0, i32 0, i64 %i + %tmp4 = load float, float* %tmp3, align 4 + %tmp5 = fadd float %tmp4, %tmp2 + store float %tmp5, float* %tmp3, align 4 + %i.next = add nuw nsw i64 %i, 5 + %cond = icmp slt i64 %i.next, 32000 + br i1 %cond, label %for.body, label %for.end + +for.end: + ret void +} + +attributes #0 = { "target-cpu"="knl" } Added: vendor/llvm/dist/test/Transforms/NewGVN/pr31613.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/Transforms/NewGVN/pr31613.ll Sun Jan 22 16:52:30 2017 (r312625) @@ -0,0 +1,135 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -basicaa -newgvn -S | FileCheck %s +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" + +;; Both of these tests are tests of phi nodes that end up all equivalent to each other +;; Without proper leader ordering, we will end up cycling the leader between all of them and never converge. + +define void @foo() { +; CHECK-LABEL: @foo( +; CHECK-NEXT: bb: +; CHECK-NEXT: br label [[BB1:%.*]] +; CHECK: bb1: +; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ 0, [[BB:%.*]] ], [ 1, [[BB18:%.*]] ] +; CHECK-NEXT: br label [[BB2:%.*]] +; CHECK: bb2: +; CHECK-NEXT: br label [[BB4:%.*]] +; CHECK: bb4: +; CHECK-NEXT: br i1 undef, label [[BB18]], label [[BB7:%.*]] +; CHECK: bb7: +; CHECK-NEXT: br label [[BB9:%.*]] +; CHECK: bb9: +; CHECK-NEXT: br i1 undef, label [[BB2]], label [[BB11:%.*]] +; CHECK: bb11: +; CHECK-NEXT: br i1 undef, label [[BB16:%.*]], label [[BB14:%.*]] +; CHECK: bb14: +; CHECK-NEXT: br label [[BB4]] +; CHECK: bb16: +; CHECK-NEXT: br label [[BB7]] +; CHECK: bb18: +; CHECK-NEXT: br label [[BB1]] +; +bb: + br label %bb1 + +bb1: ; preds = %bb18, %bb + %tmp = phi i32 [ 0, %bb ], [ 1, %bb18 ] + br label %bb2 + +bb2: ; preds = %bb9, %bb1 + %tmp3 = phi i32 [ %tmp, %bb1 ], [ %tmp8, %bb9 ] + br label %bb4 + +bb4: ; preds = %bb14, %bb2 + %tmp5 = phi i32 [ %tmp3, %bb2 ], [ %tmp15, %bb14 ] + br i1 undef, label %bb18, label %bb7 + +bb7: ; preds = %bb16, %bb4 + %tmp8 = phi i32 [ %tmp17, %bb16 ], [ %tmp5, %bb4 ] + br label %bb9 + +bb9: ; preds = %bb7 + br i1 undef, label %bb2, label %bb11 + +bb11: ; preds = %bb9 + br i1 undef, label %bb16, label %bb14 + +bb14: ; preds = %bb11 + %tmp15 = phi i32 [ %tmp8, %bb11 ] + br label %bb4 + +bb16: ; preds = %bb11 + %tmp17 = phi i32 [ %tmp8, %bb11 ] + br label %bb7 + +bb18: ; preds = %bb4 + br label %bb1 +} + +%struct.a = type {} +%struct.b = type {} + +declare void @c.d.p(i64, i8*) + +define void @e() { +; CHECK-LABEL: @e( +; CHECK-NEXT: [[F:%.*]] = alloca i32 +; CHECK-NEXT: store i32 undef, i32* [[F]], !g !0 +; CHECK-NEXT: br label [[H:%.*]] +; CHECK: h: +; CHECK-NEXT: call void @c.d.p(i64 8, i8* undef) +; CHECK-NEXT: [[I:%.*]] = load i32, i32* [[F]] +; CHECK-NEXT: [[J:%.*]] = load i32, i32* null +; CHECK-NEXT: [[K:%.*]] = icmp eq i32 [[I]], [[J]] +; CHECK-NEXT: br i1 [[K]], label [[L:%.*]], label [[Q:%.*]] +; CHECK: l: +; CHECK-NEXT: br label [[R:%.*]] +; CHECK: q: +; CHECK-NEXT: [[M:%.*]] = load %struct.a*, %struct.a** null +; CHECK-NEXT: br label [[R]] +; CHECK: r: +; CHECK-NEXT: switch i32 undef, label [[N:%.*]] [ +; CHECK-NEXT: i32 0, label [[S:%.*]] +; CHECK-NEXT: ] +; CHECK: s: +; CHECK-NEXT: store i32 undef, i32* [[F]], !g !0 +; CHECK-NEXT: br label [[H]] +; CHECK: n: +; CHECK-NEXT: [[O:%.*]] = load %struct.a*, %struct.a** null +; CHECK-NEXT: ret void +; + %f = alloca i32 + store i32 undef, i32* %f, !g !0 + br label %h + +h: ; preds = %s, %0 + call void @c.d.p(i64 8, i8* undef) + %i = load i32, i32* %f + %j = load i32, i32* null + %k = icmp eq i32 %i, %j + br i1 %k, label %l, label %q + +l: ; preds = %h + br label %r + +q: ; preds = %h + %m = load %struct.a*, %struct.a** null + %1 = bitcast %struct.a* %m to %struct.b* + br label %r + +r: ; preds = %q, %l + switch i32 undef, label %n [ + i32 0, label %s + ] + +s: ; preds = %r + store i32 undef, i32* %f, !g !0 + br label %h + +n: ; preds = %r + %o = load %struct.a*, %struct.a** null + %2 = bitcast %struct.a* %o to %struct.b* + ret void +} + +!0 = !{} From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:36 2017 Return-Path: Delivered-To: svn-src-vendor@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 BC967CBD440; Sun, 22 Jan 2017 16:52:36 +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 73709F3C; Sun, 22 Jan 2017 16:52:36 +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 v0MGqZ4R022848; Sun, 22 Jan 2017 16:52:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqZaU022847; Sun, 22 Jan 2017 16:52:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqZaU022847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312626 - vendor/llvm/llvm-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:52:36 -0000 Author: dim Date: Sun Jan 22 16:52:35 2017 New Revision: 312626 URL: https://svnweb.freebsd.org/changeset/base/312626 Log: Tag llvm release_40 branch r292732. Added: vendor/llvm/llvm-release_40-r292732/ - copied from r312625, vendor/llvm/dist/ From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:45 2017 Return-Path: Delivered-To: svn-src-vendor@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 23907CBD48D; Sun, 22 Jan 2017 16:52:45 +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 E0422FDF; Sun, 22 Jan 2017 16:52:44 +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 v0MGqij2022923; Sun, 22 Jan 2017 16:52:44 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqf6N022896; Sun, 22 Jan 2017 16:52:41 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqf6N022896@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312627 - in vendor/clang/dist: bindings/python/clang docs include/clang/Basic lib/Basic lib/Frontend lib/Parse lib/Sema test/CXX/dcl.dcl/basic.namespace/namespace.udecl test/CXX/dcl.de... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:52:45 -0000 Author: dim Date: Sun Jan 22 16:52:41 2017 New Revision: 312627 URL: https://svnweb.freebsd.org/changeset/base/312627 Log: Vendor import of clang release_40 branch r292732: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292732 Added: vendor/clang/dist/test/SemaTemplate/partial-order.cpp (contents, props changed) Modified: vendor/clang/dist/bindings/python/clang/__init__.py vendor/clang/dist/bindings/python/clang/cindex.py vendor/clang/dist/docs/AttributeReference.rst vendor/clang/dist/docs/ReleaseNotes.rst vendor/clang/dist/docs/UsersManual.rst vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/Frontend/DependencyFile.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaTemplate.cpp vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp vendor/clang/dist/test/CXX/drs/dr16xx.cpp vendor/clang/dist/test/CXX/drs/dr19xx.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp vendor/clang/dist/test/CodeCompletion/member-access.cpp vendor/clang/dist/test/Driver/netbsd.c vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Modified: vendor/clang/dist/bindings/python/clang/__init__.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/__init__.py Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/bindings/python/clang/__init__.py Sun Jan 22 16:52:41 2017 (r312627) @@ -20,5 +20,13 @@ The available modules are: Bindings for the Clang indexing library. """ + +# Python 3 uses unicode for strings. The bindings, in particular the interaction +# with ctypes, need modifying to handle conversions between unicode and +# c-strings. +import sys +if sys.version_info[0] != 2: + raise Exception("Only Python 2 is supported.") + __all__ = ['cindex'] Modified: vendor/clang/dist/bindings/python/clang/cindex.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/cindex.py Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/bindings/python/clang/cindex.py Sun Jan 22 16:52:41 2017 (r312627) @@ -554,8 +554,8 @@ class BaseEnumeration(object): if value >= len(self.__class__._kinds): self.__class__._kinds += [None] * (value - len(self.__class__._kinds) + 1) if self.__class__._kinds[value] is not None: - raise ValueError,'{0} value {1} already loaded'.format( - str(self.__class__), value) + raise ValueError('{0} value {1} already loaded'.format( + str(self.__class__), value)) self.value = value self.__class__._kinds[value] = self self.__class__._name_map = None @@ -577,7 +577,7 @@ class BaseEnumeration(object): @classmethod def from_id(cls, id): if id >= len(cls._kinds) or cls._kinds[id] is None: - raise ValueError,'Unknown template argument kind %d' % id + raise ValueError('Unknown template argument kind %d' % id) return cls._kinds[id] def __repr__(self): @@ -1777,7 +1777,7 @@ class StorageClass(object): if value >= len(StorageClass._kinds): StorageClass._kinds += [None] * (value - len(StorageClass._kinds) + 1) if StorageClass._kinds[value] is not None: - raise ValueError,'StorageClass already loaded' + raise ValueError('StorageClass already loaded') self.value = value StorageClass._kinds[value] = self StorageClass._name_map = None @@ -1798,7 +1798,7 @@ class StorageClass(object): @staticmethod def from_id(id): if id >= len(StorageClass._kinds) or not StorageClass._kinds[id]: - raise ValueError,'Unknown storage class %d' % id + raise ValueError('Unknown storage class %d' % id) return StorageClass._kinds[id] def __repr__(self): @@ -2729,9 +2729,9 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print value + print(value) if not isinstance(value, str): - raise TypeError,'Unexpected unsaved file contents.' + raise TypeError('Unexpected unsaved file contents.') unsaved_files_array[i].name = name unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) @@ -2793,9 +2793,9 @@ class TranslationUnit(ClangObject): # FIXME: It would be great to support an efficient version # of this, one day. value = value.read() - print value + print(value) if not isinstance(value, str): - raise TypeError,'Unexpected unsaved file contents.' + raise TypeError('Unexpected unsaved file contents.') unsaved_files_array[i].name = name unsaved_files_array[i].contents = value unsaved_files_array[i].length = len(value) Modified: vendor/clang/dist/docs/AttributeReference.rst ============================================================================== --- vendor/clang/dist/docs/AttributeReference.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/AttributeReference.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -456,6 +456,7 @@ warnings or errors at compile-time if ca certain user-defined criteria. For example: .. code-block:: c + void abs(int a) __attribute__((diagnose_if(a >= 0, "Redundant abs call", "warning"))); void must_abs(int a) Modified: vendor/clang/dist/docs/ReleaseNotes.rst ============================================================================== --- vendor/clang/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/ReleaseNotes.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -46,8 +46,35 @@ Major New Features clang to emit a warning or error if a function call meets one or more user-specified conditions. +- Enhanced devirtualization with + `-fstrict-vtable-pointers `_. + Clang devirtualizes across different basic blocks, like loops: + + .. code-block:: c++ + + struct A { + virtual void foo(); + }; + void indirect(A &a, int n) { + for (int i = 0 ; i < n; i++) + a.foo(); + } + void test(int n) { + A a; + indirect(a, n); + } + + - ... +Improvements to ThinLTO (-flto=thin) +------------------------------------ +- Integration with profile data (PGO). When available, profile data enables + more accurate function importing decisions, as well as cross-module indirect + call promotion. +- Significant build-time and binary-size improvements when compiling with debug + info (-g). + Improvements to Clang's diagnostics ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Modified: vendor/clang/dist/docs/UsersManual.rst ============================================================================== --- vendor/clang/dist/docs/UsersManual.rst Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/docs/UsersManual.rst Sun Jan 22 16:52:41 2017 (r312627) @@ -1097,6 +1097,14 @@ are listed below. the behavior of sanitizers in the ``cfi`` group to allow checking of cross-DSO virtual and indirect calls. + +.. option:: -fstrict-vtable-pointers + + Enable optimizations based on the strict rules for overwriting polymorphic + C++ objects, i.e. the vptr is invariant during an object's lifetime. + This enables better devirtualization. Turned off by default, because it is + still experimental. + .. option:: -ffast-math Enable fast-math mode. This defines the ``__FAST_MATH__`` preprocessor @@ -2645,7 +2653,7 @@ Execute ``clang-cl /?`` to see a list of (overridden by LLVM_PROFILE_FILE env var) -fprofile-instr-generate Generate instrumented code to collect execution counts into default.profraw file - (overriden by '=' form of option or LLVM_PROFILE_FILE env var) + (overridden by '=' form of option or LLVM_PROFILE_FILE env var) -fprofile-instr-use= Use instrumentation data for profile-guided optimization -fsanitize-blacklist= Modified: vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td Sun Jan 22 16:52:41 2017 (r312627) @@ -3337,8 +3337,8 @@ def note_ovl_candidate : Note<"candidate def note_ovl_candidate_inherited_constructor : Note< "constructor from base class %0 inherited here">; def note_ovl_candidate_inherited_constructor_slice : Note< - "constructor inherited from base class cannot be used to initialize from " - "an argument of the derived class type">; + "candidate %select{constructor|template}0 ignored: " + "inherited constructor cannot be used to %select{copy|move}1 object">; def note_ovl_candidate_illegal_constructor : Note< "candidate %select{constructor|template}0 ignored: " "instantiation %select{takes|would take}0 its own class type by value">; Modified: vendor/clang/dist/lib/Basic/Targets.cpp ============================================================================== --- vendor/clang/dist/lib/Basic/Targets.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Basic/Targets.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -512,7 +512,7 @@ protected: Builder.defineMacro("__unix__"); Builder.defineMacro("__ELF__"); if (Opts.POSIXThreads) - Builder.defineMacro("_POSIX_THREADS"); + Builder.defineMacro("_REENTRANT"); switch (Triple.getArch()) { default: Modified: vendor/clang/dist/lib/Frontend/DependencyFile.cpp ============================================================================== --- vendor/clang/dist/lib/Frontend/DependencyFile.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Frontend/DependencyFile.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -447,9 +447,9 @@ void DFGImpl::OutputDependencyFile() { // Create phony targets if requested. if (PhonyTarget && !Files.empty()) { // Skip the first entry, this is always the input file itself. - for (StringRef File : Files) { + for (auto I = Files.begin() + 1, E = Files.end(); I != E; ++I) { OS << '\n'; - PrintFilename(OS, File, OutputFormat); + PrintFilename(OS, *I, OutputFormat); OS << ":\n"; } } Modified: vendor/clang/dist/lib/Parse/ParseExpr.cpp ============================================================================== --- vendor/clang/dist/lib/Parse/ParseExpr.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Parse/ParseExpr.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -1652,9 +1652,10 @@ Parser::ParsePostfixExpressionSuffix(Exp if (Tok.is(tok::code_completion)) { // Code completion for a member access expression. - Actions.CodeCompleteMemberReferenceExpr( - getCurScope(), LHS.get(), OpLoc, OpKind == tok::arrow, - ExprStatementTokLoc == LHS.get()->getLocStart()); + if (Expr *Base = LHS.get()) + Actions.CodeCompleteMemberReferenceExpr( + getCurScope(), Base, OpLoc, OpKind == tok::arrow, + ExprStatementTokLoc == Base->getLocStart()); cutOffParsing(); return ExprError(); Modified: vendor/clang/dist/lib/Sema/SemaOverload.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaOverload.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Sema/SemaOverload.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -5944,6 +5944,28 @@ Sema::AddOverloadCandidate(FunctionDecl Candidate.FailureKind = ovl_fail_illegal_constructor; return; } + + // C++ [over.match.funcs]p8: (proposed DR resolution) + // A constructor inherited from class type C that has a first parameter + // of type "reference to P" (including such a constructor instantiated + // from a template) is excluded from the set of candidate functions when + // constructing an object of type cv D if the argument list has exactly + // one argument and D is reference-related to P and P is reference-related + // to C. + auto *Shadow = dyn_cast(FoundDecl.getDecl()); + if (Shadow && Args.size() == 1 && Constructor->getNumParams() >= 1 && + Constructor->getParamDecl(0)->getType()->isReferenceType()) { + QualType P = Constructor->getParamDecl(0)->getType()->getPointeeType(); + QualType C = Context.getRecordType(Constructor->getParent()); + QualType D = Context.getRecordType(Shadow->getParent()); + SourceLocation Loc = Args.front()->getExprLoc(); + if ((Context.hasSameUnqualifiedType(P, C) || IsDerivedFrom(Loc, P, C)) && + (Context.hasSameUnqualifiedType(D, P) || IsDerivedFrom(Loc, D, P))) { + Candidate.Viable = false; + Candidate.FailureKind = ovl_fail_inhctor_slice; + return; + } + } } unsigned NumParams = Proto->getNumParams(); @@ -6016,31 +6038,6 @@ Sema::AddOverloadCandidate(FunctionDecl } } - // C++ [over.best.ics]p4+: (proposed DR resolution) - // If the target is the first parameter of an inherited constructor when - // constructing an object of type C with an argument list that has exactly - // one expression, an implicit conversion sequence cannot be formed if C is - // reference-related to the type that the argument would have after the - // application of the user-defined conversion (if any) and before the final - // standard conversion sequence. - auto *Shadow = dyn_cast(FoundDecl.getDecl()); - if (Shadow && Args.size() == 1 && !isa(Args.front())) { - bool DerivedToBase, ObjCConversion, ObjCLifetimeConversion; - QualType ConvertedArgumentType = Args.front()->getType(); - if (Candidate.Conversions[0].isUserDefined()) - ConvertedArgumentType = - Candidate.Conversions[0].UserDefined.After.getFromType(); - if (CompareReferenceRelationship(Args.front()->getLocStart(), - Context.getRecordType(Shadow->getParent()), - ConvertedArgumentType, DerivedToBase, - ObjCConversion, - ObjCLifetimeConversion) >= Ref_Related) { - Candidate.Viable = false; - Candidate.FailureKind = ovl_fail_inhctor_slice; - return; - } - } - if (EnableIfAttr *FailedAttr = CheckEnableIf(Function, Args)) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_enable_if; @@ -10222,8 +10219,13 @@ static void NoteFunctionCandidate(Sema & return DiagnoseOpenCLExtensionDisabled(S, Cand); case ovl_fail_inhctor_slice: + // It's generally not interesting to note copy/move constructors here. + if (cast(Fn)->isCopyOrMoveConstructor()) + return; S.Diag(Fn->getLocation(), - diag::note_ovl_candidate_inherited_constructor_slice); + diag::note_ovl_candidate_inherited_constructor_slice) + << (Fn->getPrimaryTemplate() ? 1 : 0) + << Fn->getParamDecl(0)->getType()->isRValueReferenceType(); MaybeEmitInheritedConstructorNote(S, Cand->FoundDecl); return; Modified: vendor/clang/dist/lib/Sema/SemaTemplate.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaTemplate.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/lib/Sema/SemaTemplate.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -5127,18 +5127,22 @@ ExprResult Sema::CheckTemplateArgument(N if (CTAK == CTAK_Deduced && !Context.hasSameType(ParamType.getNonLValueExprType(Context), Arg->getType())) { - // C++ [temp.deduct.type]p17: (DR1770) - // If P has a form that contains , and if the type of i differs from - // the type of the corresponding template parameter of the template named - // by the enclosing simple-template-id, deduction fails. - // - // Note that CTAK will be CTAK_DeducedFromArrayBound if the form was [i] - // rather than . - // - // FIXME: We interpret the 'i' here as referring to the expression - // denoting the non-type template parameter rather than the parameter - // itself, and so strip off references before comparing types. It's - // not clear how this is supposed to work for references. + // FIXME: If either type is dependent, we skip the check. This isn't + // correct, since during deduction we're supposed to have replaced each + // template parameter with some unique (non-dependent) placeholder. + // FIXME: If the argument type contains 'auto', we carry on and fail the + // type check in order to force specific types to be more specialized than + // 'auto'. It's not clear how partial ordering with 'auto' is supposed to + // work. + if ((ParamType->isDependentType() || Arg->isTypeDependent()) && + !Arg->getType()->getContainedAutoType()) { + Converted = TemplateArgument(Arg); + return Arg; + } + // FIXME: This attempts to implement C++ [temp.deduct.type]p17. Per DR1770, + // we should actually be checking the type of the template argument in P, + // not the type of the template argument deduced from A, against the + // template parameter type. Diag(StartLoc, diag::err_deduced_non_type_template_arg_type_mismatch) << Arg->getType() << ParamType.getUnqualifiedType(); Modified: vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p15.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -1,16 +1,16 @@ // RUN: %clang_cc1 -std=c++11 -verify %s -struct B1 { // expected-note 2{{candidate}} +struct B1 { B1(int); // expected-note {{candidate}} }; -struct B2 { // expected-note 2{{candidate}} +struct B2 { B2(int); // expected-note {{candidate}} }; struct D1 : B1, B2 { // expected-note 2{{candidate}} - using B1::B1; // expected-note 3{{inherited here}} - using B2::B2; // expected-note 3{{inherited here}} + using B1::B1; // expected-note {{inherited here}} + using B2::B2; // expected-note {{inherited here}} }; D1 d1(0); // expected-error {{ambiguous}} @@ -35,7 +35,7 @@ namespace default_ctor { operator D&&(); }; - struct A { // expected-note 4{{candidate}} + struct A { // expected-note 2{{candidate}} A(); // expected-note {{candidate}} A(C &&); // expected-note {{candidate}} @@ -47,7 +47,7 @@ namespace default_ctor { A(convert_to_D2); // expected-note {{candidate}} }; - struct B { // expected-note 4{{candidate}} + struct B { // expected-note 2{{candidate}} B(); // expected-note {{candidate}} B(C &&); // expected-note {{candidate}} @@ -66,9 +66,9 @@ namespace default_ctor { using B::operator=; }; struct D : A, B { - using A::A; // expected-note 5{{inherited here}} + using A::A; // expected-note 3{{inherited here}} using A::operator=; - using B::B; // expected-note 5{{inherited here}} + using B::B; // expected-note 3{{inherited here}} using B::operator=; D(int); @@ -93,13 +93,13 @@ namespace default_ctor { } struct Y; - struct X { // expected-note 2{{candidate}} + struct X { X(); - X(volatile Y &); // expected-note {{constructor inherited from base class cannot be used to initialize from an argument of the derived class type}} + X(volatile Y &); // expected-note 3{{inherited constructor cannot be used to copy object}} } x; - struct Y : X { using X::X; } volatile y; // expected-note 2{{candidate}} - struct Z : Y { using Y::Y; } volatile z; // expected-note 3{{candidate}} expected-note 5{{inherited here}} - Z z1(x); // ok - Z z2(y); // ok, Z is not reference-related to type of y + struct Y : X { using X::X; } volatile y; + struct Z : Y { using Y::Y; } volatile z; // expected-note 4{{no known conversion}} expected-note 2{{would lose volatile}} expected-note 3{{requires 0}} expected-note 3{{inherited here}} + Z z1(x); // expected-error {{no match}} + Z z2(y); // expected-error {{no match}} Z z3(z); // expected-error {{no match}} } Modified: vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp ============================================================================== --- vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -134,13 +134,13 @@ ExplicitDefaultedAggr eda2{}; struct DefaultedBase { int n; - DefaultedBase() = default; // expected-note 0+ {{candidate}} - DefaultedBase(DefaultedBase const&) = default; // expected-note 0+ {{candidate}} - DefaultedBase(DefaultedBase &&) = default; // expected-note 0+ {{candidate}} + DefaultedBase() = default; + DefaultedBase(DefaultedBase const&) = default; + DefaultedBase(DefaultedBase &&) = default; }; struct InheritingConstructors : DefaultedBase { // expected-note 3 {{candidate}} - using DefaultedBase::DefaultedBase; // expected-note 2 {{inherited here}} + using DefaultedBase::DefaultedBase; }; InheritingConstructors ic = { 42 }; // expected-error {{no matching constructor}} Modified: vendor/clang/dist/test/CXX/drs/dr16xx.cpp ============================================================================== --- vendor/clang/dist/test/CXX/drs/dr16xx.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/drs/dr16xx.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -71,14 +71,14 @@ namespace dr1638 { // dr1638: yes namespace dr1645 { // dr1645: 3.9 #if __cplusplus >= 201103L - struct A { // expected-note 2{{candidate}} + struct A { constexpr A(int, float = 0); // expected-note 2{{candidate}} explicit A(int, int = 0); // expected-note 2{{candidate}} A(int, int, int = 0) = delete; // expected-note {{candidate}} }; struct B : A { // expected-note 2{{candidate}} - using A::A; // expected-note 7{{inherited here}} + using A::A; // expected-note 5{{inherited here}} }; constexpr B a(0); // expected-error {{ambiguous}} Modified: vendor/clang/dist/test/CXX/drs/dr19xx.cpp ============================================================================== --- vendor/clang/dist/test/CXX/drs/dr19xx.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/drs/dr19xx.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -138,18 +138,21 @@ namespace dr1959 { // dr1959: 3.9 struct c; struct a { a() = default; - a(const a &) = delete; // expected-note 2{{deleted}} + a(const a &) = delete; // expected-note {{deleted}} a(const b &) = delete; // not inherited - a(c &&) = delete; - template a(T) = delete; + a(c &&) = delete; // expected-note {{not viable}} + template a(T) = delete; // expected-note {{would take its own class type by value}} }; - struct b : a { // expected-note {{copy constructor of 'b' is implicitly deleted because base class 'dr1959::a' has a deleted copy constructor}} - using a::a; + struct b : a { // expected-note {{cannot bind}} expected-note {{deleted because}} + using a::a; // expected-note 2{{inherited here}} }; a x; - b y = x; // expected-error {{deleted}} + // FIXME: As a resolution to an open DR against P0136R0, we disallow + // use of inherited constructors to construct from a single argument + // where the base class is reference-related to the argument type. + b y = x; // expected-error {{no viable conversion}} b z = z; // expected-error {{deleted}} struct c : a { @@ -158,7 +161,7 @@ namespace dr1959 { // dr1959: 3.9 }; // FIXME: As a resolution to an open DR against P0136R0, we disallow // use of inherited constructors to construct from a single argument - // where the derived class is reference-related to its type. + // where the base class is reference-related to the argument type. c q(static_cast(q)); #endif } Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p1.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -3,7 +3,7 @@ // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior // for the wording that used to be there. -struct A { // expected-note 8{{candidate is the implicit}} +struct A { // expected-note 4{{candidate is the implicit}} A(...); // expected-note 4{{candidate constructor}} expected-note 4{{candidate inherited constructor}} A(int = 0, int = 0, int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}} A(int = 0, int = 0, ...); // expected-note 3{{candidate constructor}} expected-note 3{{candidate inherited constructor}} @@ -15,7 +15,7 @@ struct A { // expected-note 8{{candidate }; struct B : A { // expected-note 4{{candidate is the implicit}} - using A::A; // expected-note 19{{inherited here}} + using A::A; // expected-note 15{{inherited here}} B(void*); }; Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p3.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -14,21 +14,21 @@ D1 d1a(1), d1b(1, 1); D1 fd1() { return 1; } -struct B2 { // expected-note 2{{candidate}} +struct B2 { explicit B2(int, int = 0, int = 0); }; struct D2 : B2 { // expected-note 2{{candidate constructor}} - using B2::B2; // expected-note 2{{inherited here}} + using B2::B2; }; D2 d2a(1), d2b(1, 1), d2c(1, 1, 1); D2 fd2() { return 1; } // expected-error {{no viable conversion}} -struct B3 { // expected-note 2{{candidate}} +struct B3 { B3(void*); // expected-note {{candidate}} }; struct D3 : B3 { // expected-note 2{{candidate constructor}} - using B3::B3; // expected-note 3{{inherited here}} + using B3::B3; // expected-note {{inherited here}} }; D3 fd3() { return 1; } // expected-error {{no viable conversion}} Modified: vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp ============================================================================== --- vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CXX/special/class.inhctor/p7.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -3,15 +3,15 @@ // Note: [class.inhctor] was removed by P0136R1. This tests the new behavior // for the wording that used to be there. -struct B1 { // expected-note 2{{candidate}} +struct B1 { B1(int); // expected-note {{candidate}} }; -struct B2 { // expected-note 2{{candidate}} +struct B2 { B2(int); // expected-note {{candidate}} }; struct D1 : B1, B2 { // expected-note 2{{candidate}} - using B1::B1; // expected-note 3{{inherited here}} - using B2::B2; // expected-note 3{{inherited here}} + using B1::B1; // expected-note {{inherited here}} + using B2::B2; // expected-note {{inherited here}} }; struct D2 : B1, B2 { using B1::B1; Modified: vendor/clang/dist/test/CodeCompletion/member-access.cpp ============================================================================== --- vendor/clang/dist/test/CodeCompletion/member-access.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/CodeCompletion/member-access.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -27,6 +27,16 @@ public: void test(const Proxy &p) { p-> +} + +struct Test1 { + Base1 b; + + static void sfunc() { + b. // expected-error {{invalid use of member 'b' in static member function}} + } +}; + // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:29:6 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s // CHECK-CC1: Base1 : Base1:: // CHECK-CC1: member1 : [#int#][#Base1::#]member1 @@ -39,4 +49,6 @@ void test(const Proxy &p) { // CHECK-CC1: memfun1 (Hidden) : [#void#]Base2::memfun1(<#int#>) // CHECK-CC1: memfun2 : [#void#][#Base3::#]memfun2(<#int#>) // CHECK-CC1: memfun3 : [#int#]memfun3(<#int#>) - + +// Make sure this doesn't crash +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:36:7 %s -verify Modified: vendor/clang/dist/test/Driver/netbsd.c ============================================================================== --- vendor/clang/dist/test/Driver/netbsd.c Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/Driver/netbsd.c Sun Jan 22 16:52:41 2017 (r312627) @@ -126,6 +126,8 @@ // RUN: %clang -no-canonical-prefixes -target powerpc64--netbsd -static \ // RUN: --sysroot=%S/Inputs/basic_netbsd_tree %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=S-POWERPC64 %s +// RUN: %clang -target x86_64--netbsd -pthread -dM -E %s \ +// RUN: | FileCheck -check-prefix=PTHREAD %s // STATIC: ld{{.*}}" "--eh-frame-hdr" // STATIC-NOT: "-pie" @@ -427,3 +429,7 @@ // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crti.o" // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc" // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o" + +// PTHREAD-NOT: _POSIX_THREADS +// PTHREAD: _REENTRANT +// PTHREAD-NOT: _POSIX_THREADS Modified: vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c ============================================================================== --- vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/Preprocessor/dependencies-and-pp.c Sun Jan 22 16:52:41 2017 (r312627) @@ -32,5 +32,12 @@ // RUN: FileCheck -check-prefix=TEST5 %s < %t.d // TEST5: foo $$(bar) b az qu\ ux \ space: +// Test self dependency, PR31644 + +// RUN: %clang -E -MD -MP -MF %t.d %s +// RUN: FileCheck -check-prefix=TEST6 %s < %t.d +// TEST6: dependencies-and-pp.c +// TEST6-NOT: dependencies-and-pp.c: + // TODO: Test default target without quoting // TODO: Test default target with quoting Modified: vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp ============================================================================== --- vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaCXX/cxx11-inheriting-ctors.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -56,9 +56,9 @@ namespace InvalidConstruction { } namespace ExplicitConv { - struct B {}; // expected-note 2{{candidate}} + struct B {}; struct D : B { // expected-note 3{{candidate}} - using B::B; // expected-note 2{{inherited}} + using B::B; }; struct X { explicit operator B(); } x; struct Y { explicit operator D(); } y; @@ -68,19 +68,40 @@ namespace ExplicitConv { } namespace NestedListInit { - struct B { B(); } b; // expected-note 5{{candidate}} - struct D : B { // expected-note 3{{candidate}} - using B::B; // expected-note 2{{inherited}} + struct B { B(); } b; // expected-note 3{{candidate}} + struct D : B { // expected-note 14{{not viable}} + using B::B; }; // This is a bit weird. We're allowed one pair of braces for overload // resolution, and one more pair of braces due to [over.ics.list]/2. B b1 = {b}; B b2 = {{b}}; B b3 = {{{b}}}; // expected-error {{no match}} - // This is the same, but we get one call to D's version of B::B(const B&) - // before the two permitted calls to D::D(D&&). - D d1 = {b}; - D d2 = {{b}}; - D d3 = {{{b}}}; + // Per a proposed defect resolution, we don't get to call + // D's version of B::B(const B&) here. + D d0 = b; // expected-error {{no viable conversion}} + D d1 = {b}; // expected-error {{no match}} + D d2 = {{b}}; // expected-error {{no match}} + D d3 = {{{b}}}; // expected-error {{no match}} D d4 = {{{{b}}}}; // expected-error {{no match}} } + +namespace PR31606 { + // PR31606: as part of a proposed defect resolution, do not consider + // inherited constructors that would be copy constructors for any class + // between the declaring class and the constructed class (inclusive). + struct Base {}; + + struct A : Base { + using Base::Base; + bool operator==(A const &) const; // expected-note {{no known conversion from 'PR31606::B' to 'const PR31606::A' for 1st argument}} + }; + + struct B : Base { + using Base::Base; + }; + + bool a = A{} == A{}; + // Note, we do *not* allow operator=='s argument to use the inherited A::A(Base&&) constructor to construct from B{}. + bool b = A{} == B{}; // expected-error {{invalid operands}} +} Modified: vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/class-template-spec.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -207,19 +207,19 @@ namespace NTTPTypeVsPartialOrder { struct X { typedef int value_type; }; template struct Y { typedef T value_type; }; - template struct A; // expected-note {{template}} + template struct A; template struct A {}; - template struct A, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} + template struct A, N> {}; A ax; A, 0> ay; - template struct B; // expected-note {{template}} - template struct B<0, T, N>; // expected-note {{matches}} + template struct B; + template struct B<0, T, N>; template struct B<0, X, N> {}; - template struct B<0, Y, N> {}; // expected-error {{not more specialized}} expected-note {{'T' vs 'typename Y::value_type'}} expected-note {{matches}} + template struct B<0, Y, N> {}; B<0, X, 0> bx; - B<0, Y, 0> by; // expected-error {{ambiguous}} + B<0, Y, 0> by; } namespace DefaultArgVsPartialSpec { Modified: vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/cxx1z-using-declaration.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -17,7 +17,7 @@ void test_Unexpanded() { // Test using non-type members from pack of base classes. template struct A : T... { // expected-note 2{{candidate}} - using T::T ...; // expected-note 6{{inherited here}} + using T::T ...; // expected-note 2{{inherited here}} using T::operator() ...; using T::operator T* ...; using T::h ...; @@ -29,7 +29,7 @@ template struct A : T... }; namespace test_A { - struct X { // expected-note 2{{candidate}} + struct X { X(); X(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} @@ -43,7 +43,7 @@ namespace test_A { operator Y *(); void h(int, int); // expected-note {{not viable}} }; - struct Z { // expected-note 2{{candidate}} + struct Z { Z(); Z(int); // expected-note {{candidate}} void operator()(int); // expected-note 2{{candidate}} Added: vendor/clang/dist/test/SemaTemplate/partial-order.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/test/SemaTemplate/partial-order.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++1z %s -verify + +// expected-no-diagnostics + +namespace hana_enable_if_idiom { + template struct A {}; + template> struct B; + template struct B> {}; + template struct B> {}; + struct C { + static const bool value = true; + }; + B b; +} Modified: vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/temp_arg_nontype.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -370,13 +370,13 @@ namespace PR17696 { } namespace partial_order_different_types { - // These are unordered because the type of the final argument doesn't match. - template struct A; // expected-note {{here}} - template struct A<0, N, T, U, V> {}; // expected-note {{matches}} - template struct A<0, 0, T, U, V> {}; // expected-note {{matches}} - // expected-error@-1 {{not more specialized than the primary}} - // expected-note@-2 {{deduced non-type template argument does not have the same type as the corresponding template parameter ('U' vs 'type-parameter-0-0')}} - A<0, 0, int, int, 0> a; // expected-error {{ambiguous partial specializations}} + template struct A; + template struct A<0, N, T, U, V>; // expected-note {{matches}} + // FIXME: It appears that this partial specialization should be ill-formed as + // it is not more specialized than the primary template. V is not deducible + // because it does not have the same type as the corresponding parameter. + template struct A<0, N, T, U, V> {}; // expected-note {{matches}} + A<0, 0, int, int, 0> a; // expected-error {{ambiguous}} } namespace partial_order_references { @@ -434,7 +434,7 @@ namespace dependent_nested_partial_speci template struct E { template struct F; // expected-note {{template}} - template struct F {}; // expected-error {{not more specialized than the primary}} expected-note {{does not have the same type}} + template struct F {}; // expected-error {{not more specialized than the primary}} }; E::F e1; // expected-note {{instantiation of}} } Modified: vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Sun Jan 22 16:52:35 2017 (r312626) +++ vendor/clang/dist/test/SemaTemplate/temp_arg_template_cxx1z.cpp Sun Jan 22 16:52:41 2017 (r312627) @@ -79,13 +79,13 @@ namespace Auto { TInt ia; TInt iap; // expected-error {{different template parameters}} - TInt ida; // FIXME expected-error {{different template parameters}} + TInt ida; TInt ii; TInt iip; // expected-error {{different template parameters}} TIntPtr ipa; TIntPtr ipap; - TIntPtr ipda; // FIXME expected-error {{different template parameters}} + TIntPtr ipda; TIntPtr ipi; // expected-error {{different template parameters}} TIntPtr ipip; @@ -114,6 +114,6 @@ namespace Auto { int n; template struct SubstFailure; - TInt isf; // expected-error {{different template parameters}} - TIntPtr ipsf; // expected-error {{different template parameters}} + TInt isf; // FIXME: this should be ill-formed + TIntPtr ipsf; } From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:47 2017 Return-Path: Delivered-To: svn-src-vendor@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 F0A81CBD49A; Sun, 22 Jan 2017 16:52:47 +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 A7230103A; Sun, 22 Jan 2017 16:52:47 +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 v0MGqkDQ022971; Sun, 22 Jan 2017 16:52:46 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqkkI022970; Sun, 22 Jan 2017 16:52:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqkkI022970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312628 - vendor/clang/clang-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:52:48 -0000 Author: dim Date: Sun Jan 22 16:52:46 2017 New Revision: 312628 URL: https://svnweb.freebsd.org/changeset/base/312628 Log: Tag clang release_40 branch r292732. Added: vendor/clang/clang-release_40-r292732/ - copied from r312627, vendor/clang/dist/ From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:50 2017 Return-Path: Delivered-To: svn-src-vendor@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 CC728CBD4B6; Sun, 22 Jan 2017 16:52:50 +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 8377E107E; Sun, 22 Jan 2017 16:52:50 +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 v0MGqnae023018; Sun, 22 Jan 2017 16:52:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqnmD023017; Sun, 22 Jan 2017 16:52:49 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqnmD023017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312629 - vendor/compiler-rt/compiler-rt-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:52:50 -0000 Author: dim Date: Sun Jan 22 16:52:49 2017 New Revision: 312629 URL: https://svnweb.freebsd.org/changeset/base/312629 Log: Tag compiler-rt release_40 branch r292732. Added: vendor/compiler-rt/compiler-rt-release_40-r292732/ - copied from r312628, vendor/compiler-rt/dist/ From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:58 2017 Return-Path: Delivered-To: svn-src-vendor@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 E8DC4CBD529; Sun, 22 Jan 2017 16:52:58 +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 978C21164; Sun, 22 Jan 2017 16:52:58 +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 v0MGqvZS023126; Sun, 22 Jan 2017 16:52:57 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqvnL023125; Sun, 22 Jan 2017 16:52:57 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqvnL023125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312631 - vendor/libc++/libc++-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:52:59 -0000 Author: dim Date: Sun Jan 22 16:52:57 2017 New Revision: 312631 URL: https://svnweb.freebsd.org/changeset/base/312631 Log: Tag libc++ release_40 branch r292732. Added: vendor/libc++/libc++-release_40-r292732/ - copied from r312630, vendor/libc++/dist/ From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:53:04 2017 Return-Path: Delivered-To: svn-src-vendor@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 08BA2CBD578; Sun, 22 Jan 2017 16:53:04 +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 BF227121A; Sun, 22 Jan 2017 16:53:03 +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 v0MGr2cI023190; Sun, 22 Jan 2017 16:53:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGr1ec023177; Sun, 22 Jan 2017 16:53:01 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221653.v0MGr1ec023177@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312632 - in vendor/lld/dist: ELF test/ELF test/ELF/Inputs X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:53:04 -0000 Author: dim Date: Sun Jan 22 16:53:01 2017 New Revision: 312632 URL: https://svnweb.freebsd.org/changeset/base/312632 Log: Vendor import of lld release_40 branch r292732: https://llvm.org/svn/llvm-project/lld/branches/release_40@292732 Added: vendor/lld/dist/test/ELF/Inputs/resolution-end.s (contents, props changed) vendor/lld/dist/test/ELF/resolution-end.s (contents, props changed) vendor/lld/dist/test/ELF/version-script-hide-so-symbol.s (contents, props changed) Modified: vendor/lld/dist/ELF/SymbolTable.cpp vendor/lld/dist/ELF/SymbolTable.h vendor/lld/dist/ELF/Symbols.cpp vendor/lld/dist/ELF/Symbols.h vendor/lld/dist/ELF/SyntheticSections.cpp vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/test/ELF/gc-sections-shared.s vendor/lld/dist/test/ELF/init-fini.s Modified: vendor/lld/dist/ELF/SymbolTable.cpp ============================================================================== --- vendor/lld/dist/ELF/SymbolTable.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/SymbolTable.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -140,7 +140,7 @@ template DefinedRegular *SymbolTable::addIgnored(StringRef Name, uint8_t Visibility) { SymbolBody *S = find(Name); - if (!S || !S->isUndefined()) + if (!S || S->isInCurrentDSO()) return nullptr; return addAbsolute(Name, Visibility); } @@ -283,7 +283,7 @@ static int compareDefined(Symbol *S, boo if (WasInserted) return 1; SymbolBody *Body = S->body(); - if (Body->isLazy() || Body->isUndefined() || Body->isShared()) + if (Body->isLazy() || !Body->isInCurrentDSO()) return 1; if (Binding == STB_WEAK) return -1; @@ -426,12 +426,8 @@ void SymbolTable::addShared(Shared std::tie(S, WasInserted) = insert(Name, Sym.getType(), STV_DEFAULT, /*CanOmitFromDynSym*/ true, F); // Make sure we preempt DSO symbols with default visibility. - if (Sym.getVisibility() == STV_DEFAULT) { + if (Sym.getVisibility() == STV_DEFAULT) S->ExportDynamic = true; - // Exporting preempting symbols takes precedence over linker scripts. - if (S->VersionId == VER_NDX_LOCAL) - S->VersionId = VER_NDX_GLOBAL; - } if (WasInserted || isa>(S->body())) { replaceBody>(S, F, Name, Sym, Verdef); if (!S->isWeak()) @@ -468,6 +464,14 @@ template SymbolBody *Symbol } template +SymbolBody *SymbolTable::findInCurrentDSO(StringRef Name) { + if (SymbolBody *S = find(Name)) + if (S->isInCurrentDSO()) + return S; + return nullptr; +} + +template void SymbolTable::addLazyArchive(ArchiveFile *F, const object::Archive::Symbol Sym) { Symbol *S; Modified: vendor/lld/dist/ELF/SymbolTable.h ============================================================================== --- vendor/lld/dist/ELF/SymbolTable.h Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/SymbolTable.h Sun Jan 22 16:53:01 2017 (r312632) @@ -82,6 +82,7 @@ public: void scanVersionScript(); SymbolBody *find(StringRef Name); + SymbolBody *findInCurrentDSO(StringRef Name); void trace(StringRef Name); void wrap(StringRef Name); Modified: vendor/lld/dist/ELF/Symbols.cpp ============================================================================== --- vendor/lld/dist/ELF/Symbols.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/Symbols.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -203,8 +203,8 @@ void SymbolBody::parseSymbolVersion() { // Truncate the symbol name so that it doesn't include the version string. Name = {S.data(), Pos}; - // If this is an undefined or shared symbol it is not a definition. - if (isUndefined() || isShared()) + // If this is not in this DSO, it is not a definition. + if (!isInCurrentDSO()) return; // '@@' in a symbol name means the default version. @@ -299,7 +299,8 @@ uint8_t Symbol::computeBinding() const { return Binding; if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED) return STB_LOCAL; - if (VersionId == VER_NDX_LOCAL && !body()->isUndefined()) + const SymbolBody *Body = body(); + if (VersionId == VER_NDX_LOCAL && Body->isInCurrentDSO()) return STB_LOCAL; if (Config->NoGnuUnique && Binding == STB_GNU_UNIQUE) return STB_GLOBAL; Modified: vendor/lld/dist/ELF/Symbols.h ============================================================================== --- vendor/lld/dist/ELF/Symbols.h Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/Symbols.h Sun Jan 22 16:53:01 2017 (r312632) @@ -67,6 +67,7 @@ public: return SymbolKind == LazyArchiveKind || SymbolKind == LazyObjectKind; } bool isShared() const { return SymbolKind == SharedKind; } + bool isInCurrentDSO() const { return !isUndefined() && !isShared(); } bool isLocal() const { return IsLocal; } bool isPreemptible() const; StringRef getName() const { return Name; } Modified: vendor/lld/dist/ELF/SyntheticSections.cpp ============================================================================== --- vendor/lld/dist/ELF/SyntheticSections.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/SyntheticSections.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -883,9 +883,9 @@ template void DynamicSectio add({DT_FINI_ARRAYSZ, Out::FiniArray, Entry::SecSize}); } - if (SymbolBody *B = Symtab::X->find(Config->Init)) + if (SymbolBody *B = Symtab::X->findInCurrentDSO(Config->Init)) add({DT_INIT, B}); - if (SymbolBody *B = Symtab::X->find(Config->Fini)) + if (SymbolBody *B = Symtab::X->findInCurrentDSO(Config->Fini)) add({DT_FINI, B}); bool HasVerNeed = In::VerNeed->getNeedNum() != 0; Modified: vendor/lld/dist/ELF/Writer.cpp ============================================================================== --- vendor/lld/dist/ELF/Writer.cpp Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/ELF/Writer.cpp Sun Jan 22 16:53:01 2017 (r312632) @@ -641,7 +641,7 @@ static void addOptionalSynthetic(StringR typename ELFT::uint Val, uint8_t StOther = STV_HIDDEN) { if (SymbolBody *S = Symtab::X->find(Name)) - if (S->isUndefined() || S->isShared()) + if (!S->isInCurrentDSO()) Symtab::X->addSynthetic(Name, Sec, Val, StOther); } @@ -661,7 +661,7 @@ static Symbol *addOptionalRegular(String SymbolBody *S = Symtab::X->find(Name); if (!S) return nullptr; - if (!S->isUndefined() && !S->isShared()) + if (S->isInCurrentDSO()) return S->symbol(); return addRegular(Name, IS, Value); } Added: vendor/lld/dist/test/ELF/Inputs/resolution-end.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/Inputs/resolution-end.s Sun Jan 22 16:53:01 2017 (r312632) @@ -0,0 +1,2 @@ +.data + .quad _end Modified: vendor/lld/dist/test/ELF/gc-sections-shared.s ============================================================================== --- vendor/lld/dist/test/ELF/gc-sections-shared.s Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/test/ELF/gc-sections-shared.s Sun Jan 22 16:53:01 2017 (r312632) @@ -19,15 +19,6 @@ # CHECK-NEXT: Section: Undefined (0x0) # CHECK-NEXT: } # CHECK-NEXT: Symbol { -# CHECK-NEXT: Name: bar -# CHECK-NEXT: Value: -# CHECK-NEXT: Size: -# CHECK-NEXT: Binding: Global -# CHECK-NEXT: Type: -# CHECK-NEXT: Other: -# CHECK-NEXT: Section: .text -# CHECK-NEXT: } -# CHECK-NEXT: Symbol { # CHECK-NEXT: Name: bar2 # CHECK-NEXT: Value: # CHECK-NEXT: Size: Modified: vendor/lld/dist/test/ELF/init-fini.s ============================================================================== --- vendor/lld/dist/test/ELF/init-fini.s Sun Jan 22 16:52:57 2017 (r312631) +++ vendor/lld/dist/test/ELF/init-fini.s Sun Jan 22 16:53:01 2017 (r312632) @@ -17,11 +17,22 @@ // RUN: ld.lld -shared %t -o %t2 -init=_foo -fini=_bar // RUN: llvm-readobj -dynamic-table %t2 | FileCheck --check-prefix=OVR %s -// Should add a dynamic table entry even if a given symbol stay undefined +// Don't add an entry for undef. The freebsd dynamic linker doesn't +// check if the value is null. If it is, it will just call the +// load address. // RUN: ld.lld -shared %t -o %t2 -init=_undef -fini=_undef // RUN: llvm-readobj -dynamic-table %t2 | FileCheck --check-prefix=UNDEF %s -// UNDEF: INIT 0x0 -// UNDEF: FINI 0x0 +// UNDEF-NOT: INIT +// UNDEF-NOT: FINI + +// Don't add an entry for shared. For the same reason as undef. +// RUN: ld.lld -shared %t -o %t.so +// RUN: echo > %t.s +// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %t.s -o %t2.o +// RUN: ld.lld -shared %t2.o %t.so -o %t2 +// RUN: llvm-readobj -dynamic-table %t2 | FileCheck --check-prefix=SHARED %s +// SHARED-NOT: INIT +// SHARED-NOT: FINI // Should not add new entries to the symbol table // and should not require given symbols to be resolved Added: vendor/lld/dist/test/ELF/resolution-end.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/resolution-end.s Sun Jan 22 16:53:01 2017 (r312632) @@ -0,0 +1,39 @@ +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/resolution-end.s -o %t2.o +# RUN: ld.lld -shared -o %t2.so %t2.o +# RUN: ld.lld %t1.o %t2.so -o %t +# RUN: llvm-readobj -t -s -section-data %t | FileCheck %s +# REQUIRES: x86 + +# Test that we resolve _end to the this executable. + +# CHECK: Name: .text +# CHECK-NEXT: Type: SHT_PROGBITS +# CHECK-NEXT: Flags [ +# CHECK-NEXT: SHF_ALLOC +# CHECK-NEXT: SHF_EXECINSTR +# CHECK-NEXT: ] +# CHECK-NEXT: Address: +# CHECK-NEXT: Offset: +# CHECK-NEXT: Size: +# CHECK-NEXT: Link: +# CHECK-NEXT: Info: +# CHECK-NEXT: AddressAlignment: +# CHECK-NEXT: EntrySize: +# CHECK-NEXT: SectionData ( +# CHECK-NEXT: 0000: 80202000 00000000 +# CHECK-NEXT: ) + +# CHECK: Symbol { +# CHECK: Name: _end +# CHECK-NEXT: Value: 0x202080 +# CHECK-NEXT: Size: +# CHECK-NEXT: Binding: Global +# CHECK-NEXT: Type: +# CHECK-NEXT: Other: +# CHECK-NEXT: Section: +# CHECK-NEXT: } + +.global _start +_start: +.quad _end Added: vendor/lld/dist/test/ELF/version-script-hide-so-symbol.s ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lld/dist/test/ELF/version-script-hide-so-symbol.s Sun Jan 22 16:53:01 2017 (r312632) @@ -0,0 +1,28 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: ld.lld -shared %t.o -o %t2.so +# RUN: echo "{ local: *; };" > %t.script +# RUN: ld.lld --version-script %t.script -shared %t.o %t2.so -o %t.so +# RUN: llvm-readobj -dyn-symbols %t.so | FileCheck %s + +# The symbol foo must be hidden. This matches bfd and gold and is +# required to make it possible for a c++ library to hide its own +# operator delete. + +# CHECK: DynamicSymbols [ +# CHECK-NEXT: Symbol { +# CHECK-NEXT: Name: @ (0) +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: None +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: Undefined +# CHECK-NEXT: } +# CHECK-NEXT: ] + + .global foo +foo: + nop + From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:53:06 2017 Return-Path: Delivered-To: svn-src-vendor@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 D6BE2CBD58D; Sun, 22 Jan 2017 16:53:06 +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 8A0451262; Sun, 22 Jan 2017 16:53:06 +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 v0MGr50F023236; Sun, 22 Jan 2017 16:53:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGr5VU023235; Sun, 22 Jan 2017 16:53:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221653.v0MGr5VU023235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312633 - vendor/lld/lld-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:53:07 -0000 Author: dim Date: Sun Jan 22 16:53:05 2017 New Revision: 312633 URL: https://svnweb.freebsd.org/changeset/base/312633 Log: Tag lld release_40 branch r292732. Added: vendor/lld/lld-release_40-r292732/ - copied from r312632, vendor/lld/dist/ From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:52:56 2017 Return-Path: Delivered-To: svn-src-vendor@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 1012DCBD4FC; Sun, 22 Jan 2017 16:52:56 +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 CEA601125; Sun, 22 Jan 2017 16:52:55 +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 v0MGqtLa023080; Sun, 22 Jan 2017 16:52:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGqrcr023065; Sun, 22 Jan 2017 16:52:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221652.v0MGqrcr023065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312630 - in vendor/libc++/dist: include src test/std/containers/sequences/array test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time test/std/language.support/support.rtt... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:52:56 -0000 Author: dim Date: Sun Jan 22 16:52:53 2017 New Revision: 312630 URL: https://svnweb.freebsd.org/changeset/base/312630 Log: Vendor import of libc++ release_40 branch r292732: https://llvm.org/svn/llvm-project/libcxx/branches/release_40@292732 Added: vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp (contents, props changed) Modified: vendor/libc++/dist/include/__config vendor/libc++/dist/include/array vendor/libc++/dist/include/new vendor/libc++/dist/include/string vendor/libc++/dist/include/typeinfo vendor/libc++/dist/src/new.cpp vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/__config Sun Jan 22 16:52:53 2017 (r312630) @@ -835,6 +835,18 @@ template struct __static_asse #define _DECLARE_C99_LDBL_MATH 1 #endif +#if defined(__APPLE__) +# if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ + defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# endif +# if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +# if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# endif +# endif +#endif // defined(__APPLE__) + #if defined(__APPLE__) || defined(__FreeBSD__) #define _LIBCPP_HAS_DEFAULTRUNELOCALE #endif Modified: vendor/libc++/dist/include/array ============================================================================== --- vendor/libc++/dist/include/array Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/array Sun Jan 22 16:52:53 2017 (r312630) @@ -185,14 +185,17 @@ struct _LIBCPP_TEMPLATE_VIS array _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} // element access: - _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];} - reference at(size_type __n); + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 + reference operator[](size_type __n) {return __elems_[__n];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 + const_reference operator[](size_type __n) const {return __elems_[__n];} + + _LIBCPP_CONSTEXPR_AFTER_CXX14 reference at(size_type __n); _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const; - _LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference front() {return __elems_[0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];} - _LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 @@ -202,6 +205,7 @@ struct _LIBCPP_TEMPLATE_VIS array }; template +_LIBCPP_CONSTEXPR_AFTER_CXX14 typename array<_Tp, _Size>::reference array<_Tp, _Size>::at(size_type __n) { Modified: vendor/libc++/dist/include/new ============================================================================== --- vendor/libc++/dist/include/new Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/new Sun Jan 22 16:52:53 2017 (r312630) @@ -101,8 +101,9 @@ void operator delete[](void* ptr, void* # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION #endif -#if !(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \ - (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606)) +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \ + (!(defined(_LIBCPP_BUILDING_NEW) || _LIBCPP_STD_VER > 14 || \ + (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))) # define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION #endif @@ -144,7 +145,7 @@ public: #endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11) -#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14 #ifndef _LIBCPP_CXX03_LANG enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; #else Modified: vendor/libc++/dist/include/string ============================================================================== --- vendor/libc++/dist/include/string Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/string Sun Jan 22 16:52:53 2017 (r312630) @@ -818,6 +818,7 @@ public: operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } basic_string& operator=(const basic_string& __str); + template _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES Modified: vendor/libc++/dist/include/typeinfo ============================================================================== --- vendor/libc++/dist/include/typeinfo Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/include/typeinfo Sun Jan 22 16:52:53 2017 (r312630) @@ -95,12 +95,13 @@ protected: uintptr_t __type_name; _LIBCPP_INLINE_VISIBILITY - type_info(const char* __n) : __type_name(reinterpret_cast(__n)) {} + explicit type_info(const char* __n) + : __type_name(reinterpret_cast(__n)) {} #else const char *__type_name; _LIBCPP_INLINE_VISIBILITY - type_info(const char* __n) : __type_name(__n) {} + explicit type_info(const char* __n) : __type_name(__n) {} #endif public: Modified: vendor/libc++/dist/src/new.cpp ============================================================================== --- vendor/libc++/dist/src/new.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/src/new.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -64,38 +64,6 @@ operator new(std::size_t size) _THROW_BA } _LIBCPP_WEAK -void * -operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC -{ - if (size == 0) - size = 1; - if (static_cast(alignment) < sizeof(void*)) - alignment = std::align_val_t(sizeof(void*)); - void* p; -#if defined(_LIBCPP_MSVCRT) - while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr) -#else - while (::posix_memalign(&p, static_cast(alignment), size) != 0) -#endif - { - // If posix_memalign fails and there is a new_handler, - // call it to try free up memory. - std::new_handler nh = std::get_new_handler(); - if (nh) - nh(); - else { -#ifndef _LIBCPP_NO_EXCEPTIONS - throw std::bad_alloc(); -#else - p = nullptr; // posix_memalign doesn't initialize 'p' on failure - break; -#endif - } - } - return p; -} - -_LIBCPP_WEAK void* operator new(size_t size, const std::nothrow_t&) _NOEXCEPT { @@ -116,14 +84,21 @@ operator new(size_t size, const std::not _LIBCPP_WEAK void* -operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT +operator new[](size_t size) _THROW_BAD_ALLOC +{ + return ::operator new(size); +} + +_LIBCPP_WEAK +void* +operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT { void* p = 0; #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif // _LIBCPP_NO_EXCEPTIONS - p = ::operator new(size, alignment); + p = ::operator new[](size); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -134,29 +109,92 @@ operator new(size_t size, std::align_val } _LIBCPP_WEAK -void* -operator new[](size_t size) _THROW_BAD_ALLOC +void +operator delete(void* ptr) _NOEXCEPT { - return ::operator new(size); + if (ptr) + ::free(ptr); } _LIBCPP_WEAK -void* -operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC +void +operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT { - return ::operator new(size, alignment); + ::operator delete(ptr); +} + +_LIBCPP_WEAK +void +operator delete(void* ptr, size_t) _NOEXCEPT +{ + ::operator delete(ptr); +} + +_LIBCPP_WEAK +void +operator delete[] (void* ptr) _NOEXCEPT +{ + ::operator delete(ptr); +} + +_LIBCPP_WEAK +void +operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT +{ + ::operator delete[](ptr); +} + +_LIBCPP_WEAK +void +operator delete[] (void* ptr, size_t) _NOEXCEPT +{ + ::operator delete[](ptr); +} + +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) + +_LIBCPP_WEAK +void * +operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC +{ + if (size == 0) + size = 1; + if (static_cast(alignment) < sizeof(void*)) + alignment = std::align_val_t(sizeof(void*)); + void* p; +#if defined(_LIBCPP_MSVCRT) + while ((p = _aligned_malloc(size, static_cast(alignment))) == nullptr) +#else + while (::posix_memalign(&p, static_cast(alignment), size) != 0) +#endif + { + // If posix_memalign fails and there is a new_handler, + // call it to try free up memory. + std::new_handler nh = std::get_new_handler(); + if (nh) + nh(); + else { +#ifndef _LIBCPP_NO_EXCEPTIONS + throw std::bad_alloc(); +#else + p = nullptr; // posix_memalign doesn't initialize 'p' on failure + break; +#endif + } + } + return p; } _LIBCPP_WEAK void* -operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT +operator new(size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { void* p = 0; #ifndef _LIBCPP_NO_EXCEPTIONS try { #endif // _LIBCPP_NO_EXCEPTIONS - p = ::operator new[](size); + p = ::operator new(size, alignment); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -168,6 +206,13 @@ operator new[](size_t size, const std::n _LIBCPP_WEAK void* +operator new[](size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC +{ + return ::operator new(size, alignment); +} + +_LIBCPP_WEAK +void* operator new[](size_t size, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { void* p = 0; @@ -187,14 +232,6 @@ operator new[](size_t size, std::align_v _LIBCPP_WEAK void -operator delete(void* ptr) _NOEXCEPT -{ - if (ptr) - ::free(ptr); -} - -_LIBCPP_WEAK -void operator delete(void* ptr, std::align_val_t) _NOEXCEPT { if (ptr) @@ -207,13 +244,6 @@ operator delete(void* ptr, std::align_va _LIBCPP_WEAK void -operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - ::operator delete(ptr); -} - -_LIBCPP_WEAK -void operator delete(void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { ::operator delete(ptr, alignment); @@ -221,13 +251,6 @@ operator delete(void* ptr, std::align_va _LIBCPP_WEAK void -operator delete(void* ptr, size_t) _NOEXCEPT -{ - ::operator delete(ptr); -} - -_LIBCPP_WEAK -void operator delete(void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT { ::operator delete(ptr, alignment); @@ -235,13 +258,6 @@ operator delete(void* ptr, size_t, std:: _LIBCPP_WEAK void -operator delete[] (void* ptr) _NOEXCEPT -{ - ::operator delete(ptr); -} - -_LIBCPP_WEAK -void operator delete[] (void* ptr, std::align_val_t alignment) _NOEXCEPT { ::operator delete(ptr, alignment); @@ -249,13 +265,6 @@ operator delete[] (void* ptr, std::align _LIBCPP_WEAK void -operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT -{ - ::operator delete[](ptr); -} - -_LIBCPP_WEAK -void operator delete[] (void* ptr, std::align_val_t alignment, const std::nothrow_t&) _NOEXCEPT { ::operator delete[](ptr, alignment); @@ -263,18 +272,13 @@ operator delete[] (void* ptr, std::align _LIBCPP_WEAK void -operator delete[] (void* ptr, size_t) _NOEXCEPT -{ - ::operator delete[](ptr); -} - -_LIBCPP_WEAK -void operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT { ::operator delete[](ptr, alignment); } +#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) + #endif // !__GLIBCXX__ namespace std Modified: vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/containers/sequences/array/at.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -23,6 +23,14 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" +#if TEST_STD_VER > 14 +constexpr bool check_idx( size_t idx, double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr.at(idx) == val; +} +#endif + int main() { { @@ -82,4 +90,11 @@ int main() } #endif +#if TEST_STD_VER > 14 + { + static_assert (check_idx(0, 1), ""); + static_assert (check_idx(1, 2), ""); + static_assert (check_idx(2, 3.5), ""); + } +#endif } Modified: vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/containers/sequences/array/front_back.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -9,10 +9,10 @@ // -// reference front(); -// reference back(); +// reference front(); // constexpr in C++17 +// reference back(); // constexpr in C++17 // const_reference front(); // constexpr in C++14 -// const_reference back(); // constexpr in C++14 +// const_reference back(); // constexpr in C++14 #include #include @@ -23,6 +23,20 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" +#if TEST_STD_VER > 14 +constexpr bool check_front( double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr.front() == val; +} + +constexpr bool check_back( double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr.back() == val; +} +#endif + int main() { { @@ -65,4 +79,10 @@ int main() } #endif +#if TEST_STD_VER > 14 + { + static_assert (check_front(1), ""); + static_assert (check_back (3.5), ""); + } +#endif } Modified: vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/containers/sequences/array/indexing.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -23,6 +23,14 @@ // Disable the missing braces warning for this reason. #include "disable_missing_braces_warning.h" +#if TEST_STD_VER > 14 +constexpr bool check_idx( size_t idx, double val ) +{ + std::array arr = {1, 2, 3.5}; + return arr[idx] == val; +} +#endif + int main() { { @@ -63,4 +71,11 @@ int main() } #endif +#if TEST_STD_VER > 14 + { + static_assert (check_idx(0, 1), ""); + static_assert (check_idx(1, 2), ""); + static_assert (check_idx(2, 3.5), ""); + } +#endif } Modified: vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -72,13 +72,60 @@ std::pair GetS return {st.st_atime, st.st_mtime}; } -inline bool TimeIsRepresentableAsTimeT(file_time_type tp) { +namespace { +bool TestSupportsNegativeTimes() { + using namespace std::chrono; + std::error_code ec; + std::time_t old_write_time, new_write_time; + { // WARNING: Do not assert in this scope. + scoped_test_env env; + const path file = env.create_file("file", 42); + old_write_time = LastWriteTime(file); + file_time_type tp(seconds(-5)); + fs::last_write_time(file, tp, ec); + new_write_time = LastWriteTime(file); + } + return !ec && new_write_time <= -5; +} + +bool TestSupportsMaxTime() { using namespace std::chrono; using Lim = std::numeric_limits; - auto sec = duration_cast(tp.time_since_epoch()).count(); - return (sec >= Lim::min() && sec <= Lim::max()); + auto max_sec = duration_cast(file_time_type::max().time_since_epoch()).count(); + if (max_sec > Lim::max()) return false; + std::error_code ec; + std::time_t old_write_time, new_write_time; + { // WARNING: Do not assert in this scope. + scoped_test_env env; + const path file = env.create_file("file", 42); + old_write_time = LastWriteTime(file); + file_time_type tp = file_time_type::max(); + fs::last_write_time(file, tp, ec); + new_write_time = LastWriteTime(file); + } + return !ec && new_write_time > max_sec - 1; } +static const bool SupportsNegativeTimes = TestSupportsNegativeTimes(); +static const bool SupportsMaxTime = TestSupportsMaxTime(); + +} // end namespace + +// Check if a time point is representable on a given filesystem. Check that: +// (A) 'tp' is representable as a time_t +// (B) 'tp' is non-negative or the filesystem supports negative times. +// (C) 'tp' is not 'file_time_type::max()' or the filesystem supports the max +// value. +inline bool TimeIsRepresentableByFilesystem(file_time_type tp) { + using namespace std::chrono; + using Lim = std::numeric_limits; + auto sec = duration_cast(tp.time_since_epoch()).count(); + auto microsec = duration_cast(tp.time_since_epoch()).count(); + if (sec < Lim::min() || sec > Lim::max()) return false; + else if (microsec < 0 && !SupportsNegativeTimes) return false; + else if (tp == file_time_type::max() && !SupportsMaxTime) return false; + return true; +} TEST_SUITE(exists_test_suite) @@ -214,15 +261,17 @@ TEST_CASE(set_last_write_time_dynamic_en file_time_type got_time = last_write_time(TC.p); - TEST_CHECK(got_time != old_time); - if (TC.new_time < epoch_time) { - TEST_CHECK(got_time <= TC.new_time); - TEST_CHECK(got_time > TC.new_time - Sec(1)); - } else { - TEST_CHECK(got_time <= TC.new_time + Sec(1)); - TEST_CHECK(got_time >= TC.new_time - Sec(1)); + if (TimeIsRepresentableByFilesystem(TC.new_time)) { + TEST_CHECK(got_time != old_time); + if (TC.new_time < epoch_time) { + TEST_CHECK(got_time <= TC.new_time); + TEST_CHECK(got_time > TC.new_time - Sec(1)); + } else { + TEST_CHECK(got_time <= TC.new_time + Sec(1)); + TEST_CHECK(got_time >= TC.new_time - Sec(1)); + } + TEST_CHECK(LastAccessTime(TC.p) == old_times.first); } - TEST_CHECK(LastAccessTime(TC.p) == old_times.first); } } @@ -269,17 +318,12 @@ TEST_CASE(test_write_min_time) const path p = env.create_file("file", 42); std::error_code ec = GetTestEC(); - file_time_type last_time = last_write_time(p); file_time_type new_time = file_time_type::min(); last_write_time(p, new_time, ec); file_time_type tt = last_write_time(p); - if (!TimeIsRepresentableAsTimeT(new_time)) { - TEST_CHECK(ec); - TEST_CHECK(ec != GetTestEC()); - TEST_CHECK(tt == last_time); - } else { + if (TimeIsRepresentableByFilesystem(new_time)) { TEST_CHECK(!ec); TEST_CHECK(tt >= new_time); TEST_CHECK(tt < new_time + Sec(1)); @@ -287,18 +331,13 @@ TEST_CASE(test_write_min_time) ec = GetTestEC(); last_write_time(p, Clock::now()); - last_time = last_write_time(p); new_time = file_time_type::min() + MicroSec(1); last_write_time(p, new_time, ec); tt = last_write_time(p); - if (!TimeIsRepresentableAsTimeT(new_time)) { - TEST_CHECK(ec); - TEST_CHECK(ec != GetTestEC()); - TEST_CHECK(tt == last_time); - } else { + if (TimeIsRepresentableByFilesystem(new_time)) { TEST_CHECK(!ec); TEST_CHECK(tt >= new_time); TEST_CHECK(tt < new_time + Sec(1)); @@ -317,18 +356,13 @@ TEST_CASE(test_write_min_max_time) const path p = env.create_file("file", 42); std::error_code ec = GetTestEC(); - file_time_type last_time = last_write_time(p); file_time_type new_time = file_time_type::max(); ec = GetTestEC(); last_write_time(p, new_time, ec); file_time_type tt = last_write_time(p); - if (!TimeIsRepresentableAsTimeT(new_time)) { - TEST_CHECK(ec); - TEST_CHECK(ec != GetTestEC()); - TEST_CHECK(tt == last_time); - } else { + if (TimeIsRepresentableByFilesystem(new_time)) { TEST_CHECK(!ec); TEST_CHECK(tt > new_time - Sec(1)); TEST_CHECK(tt <= new_time); Modified: vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/language.support/support.rtti/type.info/type_info.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -10,11 +10,16 @@ // test type_info #include +#include #include #include +bool test_constructor_explicit(std::type_info const&) { return false; } +bool test_constructor_explicit(std::string const&) { return true; } + int main() { + { const std::type_info& t1 = typeid(int); const std::type_info& t2 = typeid(int); assert(t1 == t2); @@ -23,4 +28,13 @@ int main() assert(!t1.before(t2)); assert(strcmp(t1.name(), t2.name()) == 0); assert(strcmp(t1.name(), t3.name()) != 0); + } + { + // type_info has a protected constructor taking a string literal. This + // constructor is not intended for users. However it still participates + // in overload resolution, so we need to ensure that it is marked explicit + // to avoid ambiguous conversions. + // See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=216201 + assert(test_constructor_explicit("abc")); + } } Added: vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/brace_assignment.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +// + +// basic_string& +// operator=(basic_string&& str); + +#include +#include + +#include "test_macros.h" + +int main() +{ + // Test that assignment from {} and {ptr, len} are allowed and are not + // ambiguous. + { + std::string s = "hello world"; + s = {}; + assert(s.empty()); + } + { + std::string s = "hello world"; + s = {"abc", 2}; + assert(s == "ab"); + } +} Modified: vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp ============================================================================== --- vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp Sun Jan 22 16:52:49 2017 (r312629) +++ vendor/libc++/dist/test/std/strings/basic.string/string.cons/string_view.pass.cpp Sun Jan 22 16:52:53 2017 (r312630) @@ -28,12 +28,23 @@ test(std::basic_string_view sv) typedef std::basic_string, test_allocator > S; typedef typename S::traits_type T; typedef typename S::allocator_type A; + { S s2(sv); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == sv.size()); assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); assert(s2.get_allocator() == A()); assert(s2.capacity() >= s2.size()); + } + { + S s2; + s2 = sv; + LIBCPP_ASSERT(s2.__invariants()); + assert(s2.size() == sv.size()); + assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); + assert(s2.get_allocator() == A()); + assert(s2.capacity() >= s2.size()); + } } template @@ -42,12 +53,23 @@ test(std::basic_string_view sv, c { typedef std::basic_string, A> S; typedef typename S::traits_type T; + { S s2(sv, a); LIBCPP_ASSERT(s2.__invariants()); assert(s2.size() == sv.size()); assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); assert(s2.get_allocator() == a); assert(s2.capacity() >= s2.size()); + } + { + S s2(a); + s2 = sv; + LIBCPP_ASSERT(s2.__invariants()); + assert(s2.size() == sv.size()); + assert(T::compare(s2.data(), sv.data(), sv.size()) == 0); + assert(s2.get_allocator() == a); + assert(s2.capacity() >= s2.size()); + } } int main() From owner-svn-src-vendor@freebsd.org Sun Jan 22 16:53:11 2017 Return-Path: Delivered-To: svn-src-vendor@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 1B901CBD5CC; Sun, 22 Jan 2017 16:53:11 +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 C6C7F12E3; Sun, 22 Jan 2017 16:53:10 +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 v0MGr9AK023283; Sun, 22 Jan 2017 16:53:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0MGr9sm023282; Sun, 22 Jan 2017 16:53:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701221653.v0MGr9sm023282@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 22 Jan 2017 16:53:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312634 - vendor/lldb/lldb-release_40-r292732 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 16:53:11 -0000 Author: dim Date: Sun Jan 22 16:53:09 2017 New Revision: 312634 URL: https://svnweb.freebsd.org/changeset/base/312634 Log: Tag lldb release_40 branch r292732. Added: vendor/lldb/lldb-release_40-r292732/ - copied from r312633, vendor/lldb/dist/ From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:17:56 2017 Return-Path: Delivered-To: svn-src-vendor@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 88C02CBF518; Tue, 24 Jan 2017 19:17:56 +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 3F0FFA36; Tue, 24 Jan 2017 19:17:56 +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 v0OJHtRZ072190; Tue, 24 Jan 2017 19:17:55 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJHsaj072176; Tue, 24 Jan 2017 19:17:54 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241917.v0OJHsaj072176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312704 - in vendor/llvm/dist: lib/Bitcode/Reader lib/Target/AArch64 lib/Target/ARM lib/Target/X86 lib/Transforms/Instrumentation lib/Transforms/Scalar test/CodeGen/AArch64 test/CodeGen... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:17:56 -0000 Author: dim Date: Tue Jan 24 19:17:53 2017 New Revision: 312704 URL: https://svnweb.freebsd.org/changeset/base/312704 Log: Vendor import of llvm release_40 branch r292951: https://llvm.org/svn/llvm-project/llvm/branches/release_40@292951 Added: vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt.mir vendor/llvm/dist/test/CodeGen/Thumb2/intrinsics-cc.ll vendor/llvm/dist/test/Transforms/NewGVN/pr31682.ll vendor/llvm/dist/test/tools/llvm-cxxfilt/invalid.test Deleted: vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt-dbg-limit.mir Modified: vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll vendor/llvm/dist/test/CodeGen/X86/sse1.ll vendor/llvm/dist/test/Instrumentation/AddressSanitizer/global_metadata_darwin.ll vendor/llvm/dist/test/ThinLTO/X86/lazyload_metadata.ll vendor/llvm/dist/tools/llvm-cxxfilt/llvm-cxxfilt.cpp vendor/llvm/dist/utils/release/test-release.sh Modified: vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -512,7 +512,7 @@ private: } Metadata *getFnMetadataByID(unsigned ID) { - return MDLoader->getMetadataFwdRef(ID); + return MDLoader->getMetadataFwdRefOrLoad(ID); } BasicBlock *getBasicBlock(unsigned ID) const { Modified: vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -485,8 +485,21 @@ public: Error parseMetadata(bool ModuleLevel); bool hasFwdRefs() const { return MetadataList.hasFwdRefs(); } - Metadata *getMetadataFwdRef(unsigned Idx) { - return MetadataList.getMetadataFwdRef(Idx); + + Metadata *getMetadataFwdRefOrLoad(unsigned ID) { + if (ID < MDStringRef.size()) + return lazyLoadOneMDString(ID); + if (auto *MD = MetadataList.lookup(ID)) + return MD; + // If lazy-loading is enabled, we try recursively to load the operand + // instead of creating a temporary. + if (ID < (MDStringRef.size() + GlobalMetadataBitPosIndex.size())) { + PlaceholderQueue Placeholders; + lazyLoadOneMetadata(ID, Placeholders); + resolveForwardRefsAndPlaceholders(Placeholders); + return MetadataList.lookup(ID); + } + return MetadataList.getMetadataFwdRef(ID); } MDNode *getMDNodeFwdRefOrNull(unsigned Idx) { @@ -1727,8 +1740,8 @@ bool MetadataLoader::hasFwdRefs() const /// Return the given metadata, creating a replaceable forward reference if /// necessary. -Metadata *MetadataLoader::getMetadataFwdRef(unsigned Idx) { - return Pimpl->getMetadataFwdRef(Idx); +Metadata *MetadataLoader::getMetadataFwdRefOrLoad(unsigned Idx) { + return Pimpl->getMetadataFwdRefOrLoad(Idx); } MDNode *MetadataLoader::getMDNodeFwdRefOrNull(unsigned Idx) { Modified: vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h ============================================================================== --- vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.h Tue Jan 24 19:17:53 2017 (r312704) @@ -63,7 +63,7 @@ public: /// Return the given metadata, creating a replaceable forward reference if /// necessary. - Metadata *getMetadataFwdRef(unsigned Idx); + Metadata *getMetadataFwdRefOrLoad(unsigned Idx); MDNode *getMDNodeFwdRefOrNull(unsigned Idx); Modified: vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -687,9 +687,30 @@ AArch64LoadStoreOpt::mergePairedInsns(Ma MachineInstrBuilder MIB; DebugLoc DL = I->getDebugLoc(); MachineBasicBlock *MBB = I->getParent(); + MachineOperand RegOp0 = getLdStRegOp(*RtMI); + MachineOperand RegOp1 = getLdStRegOp(*Rt2MI); + // Kill flags may become invalid when moving stores for pairing. + if (RegOp0.isUse()) { + if (!MergeForward) { + // Clear kill flags on store if moving upwards. Example: + // STRWui %w0, ... + // USE %w1 + // STRWui kill %w1 ; need to clear kill flag when moving STRWui upwards + RegOp0.setIsKill(false); + RegOp1.setIsKill(false); + } else { + // Clear kill flags of the first stores register. Example: + // STRWui %w1, ... + // USE kill %w1 ; need to clear kill flag when moving STRWui downwards + // STRW %w0 + unsigned Reg = getLdStRegOp(*I).getReg(); + for (MachineInstr &MI : make_range(std::next(I), Paired)) + MI.clearRegisterKills(Reg, TRI); + } + } MIB = BuildMI(*MBB, InsertionPoint, DL, TII->get(getMatchingPairOpcode(Opc))) - .addOperand(getLdStRegOp(*RtMI)) - .addOperand(getLdStRegOp(*Rt2MI)) + .addOperand(RegOp0) + .addOperand(RegOp1) .addOperand(BaseRegOp) .addImm(OffsetImm) .setMemRefs(I->mergeMemRefsWith(*Paired)); Modified: vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -97,171 +97,6 @@ namespace { }; } -void ARMTargetLowering::InitLibcallCallingConvs() { - // The builtins on ARM always use AAPCS, irrespective of wheter C is AAPCS or - // AAPCS_VFP. - for (const auto LC : { - RTLIB::SHL_I16, - RTLIB::SHL_I32, - RTLIB::SHL_I64, - RTLIB::SHL_I128, - RTLIB::SRL_I16, - RTLIB::SRL_I32, - RTLIB::SRL_I64, - RTLIB::SRL_I128, - RTLIB::SRA_I16, - RTLIB::SRA_I32, - RTLIB::SRA_I64, - RTLIB::SRA_I128, - RTLIB::MUL_I8, - RTLIB::MUL_I16, - RTLIB::MUL_I32, - RTLIB::MUL_I64, - RTLIB::MUL_I128, - RTLIB::MULO_I32, - RTLIB::MULO_I64, - RTLIB::MULO_I128, - RTLIB::SDIV_I8, - RTLIB::SDIV_I16, - RTLIB::SDIV_I32, - RTLIB::SDIV_I64, - RTLIB::SDIV_I128, - RTLIB::UDIV_I8, - RTLIB::UDIV_I16, - RTLIB::UDIV_I32, - RTLIB::UDIV_I64, - RTLIB::UDIV_I128, - RTLIB::SREM_I8, - RTLIB::SREM_I16, - RTLIB::SREM_I32, - RTLIB::SREM_I64, - RTLIB::SREM_I128, - RTLIB::UREM_I8, - RTLIB::UREM_I16, - RTLIB::UREM_I32, - RTLIB::UREM_I64, - RTLIB::UREM_I128, - RTLIB::SDIVREM_I8, - RTLIB::SDIVREM_I16, - RTLIB::SDIVREM_I32, - RTLIB::SDIVREM_I64, - RTLIB::SDIVREM_I128, - RTLIB::UDIVREM_I8, - RTLIB::UDIVREM_I16, - RTLIB::UDIVREM_I32, - RTLIB::UDIVREM_I64, - RTLIB::UDIVREM_I128, - RTLIB::NEG_I32, - RTLIB::NEG_I64, - RTLIB::ADD_F32, - RTLIB::ADD_F64, - RTLIB::ADD_F80, - RTLIB::ADD_F128, - RTLIB::SUB_F32, - RTLIB::SUB_F64, - RTLIB::SUB_F80, - RTLIB::SUB_F128, - RTLIB::MUL_F32, - RTLIB::MUL_F64, - RTLIB::MUL_F80, - RTLIB::MUL_F128, - RTLIB::DIV_F32, - RTLIB::DIV_F64, - RTLIB::DIV_F80, - RTLIB::DIV_F128, - RTLIB::POWI_F32, - RTLIB::POWI_F64, - RTLIB::POWI_F80, - RTLIB::POWI_F128, - RTLIB::FPEXT_F64_F128, - RTLIB::FPEXT_F32_F128, - RTLIB::FPEXT_F32_F64, - RTLIB::FPEXT_F16_F32, - RTLIB::FPROUND_F32_F16, - RTLIB::FPROUND_F64_F16, - RTLIB::FPROUND_F80_F16, - RTLIB::FPROUND_F128_F16, - RTLIB::FPROUND_F64_F32, - RTLIB::FPROUND_F80_F32, - RTLIB::FPROUND_F128_F32, - RTLIB::FPROUND_F80_F64, - RTLIB::FPROUND_F128_F64, - RTLIB::FPTOSINT_F32_I32, - RTLIB::FPTOSINT_F32_I64, - RTLIB::FPTOSINT_F32_I128, - RTLIB::FPTOSINT_F64_I32, - RTLIB::FPTOSINT_F64_I64, - RTLIB::FPTOSINT_F64_I128, - RTLIB::FPTOSINT_F80_I32, - RTLIB::FPTOSINT_F80_I64, - RTLIB::FPTOSINT_F80_I128, - RTLIB::FPTOSINT_F128_I32, - RTLIB::FPTOSINT_F128_I64, - RTLIB::FPTOSINT_F128_I128, - RTLIB::FPTOUINT_F32_I32, - RTLIB::FPTOUINT_F32_I64, - RTLIB::FPTOUINT_F32_I128, - RTLIB::FPTOUINT_F64_I32, - RTLIB::FPTOUINT_F64_I64, - RTLIB::FPTOUINT_F64_I128, - RTLIB::FPTOUINT_F80_I32, - RTLIB::FPTOUINT_F80_I64, - RTLIB::FPTOUINT_F80_I128, - RTLIB::FPTOUINT_F128_I32, - RTLIB::FPTOUINT_F128_I64, - RTLIB::FPTOUINT_F128_I128, - RTLIB::SINTTOFP_I32_F32, - RTLIB::SINTTOFP_I32_F64, - RTLIB::SINTTOFP_I32_F80, - RTLIB::SINTTOFP_I32_F128, - RTLIB::SINTTOFP_I64_F32, - RTLIB::SINTTOFP_I64_F64, - RTLIB::SINTTOFP_I64_F80, - RTLIB::SINTTOFP_I64_F128, - RTLIB::SINTTOFP_I128_F32, - RTLIB::SINTTOFP_I128_F64, - RTLIB::SINTTOFP_I128_F80, - RTLIB::SINTTOFP_I128_F128, - RTLIB::UINTTOFP_I32_F32, - RTLIB::UINTTOFP_I32_F64, - RTLIB::UINTTOFP_I32_F80, - RTLIB::UINTTOFP_I32_F128, - RTLIB::UINTTOFP_I64_F32, - RTLIB::UINTTOFP_I64_F64, - RTLIB::UINTTOFP_I64_F80, - RTLIB::UINTTOFP_I64_F128, - RTLIB::UINTTOFP_I128_F32, - RTLIB::UINTTOFP_I128_F64, - RTLIB::UINTTOFP_I128_F80, - RTLIB::UINTTOFP_I128_F128, - RTLIB::OEQ_F32, - RTLIB::OEQ_F64, - RTLIB::OEQ_F128, - RTLIB::UNE_F32, - RTLIB::UNE_F64, - RTLIB::UNE_F128, - RTLIB::OGE_F32, - RTLIB::OGE_F64, - RTLIB::OGE_F128, - RTLIB::OLT_F32, - RTLIB::OLT_F64, - RTLIB::OLT_F128, - RTLIB::OLE_F32, - RTLIB::OLE_F64, - RTLIB::OLE_F128, - RTLIB::OGT_F32, - RTLIB::OGT_F64, - RTLIB::OGT_F128, - RTLIB::UO_F32, - RTLIB::UO_F64, - RTLIB::UO_F128, - RTLIB::O_F32, - RTLIB::O_F64, - RTLIB::O_F128, - }) - setLibcallCallingConv(LC, CallingConv::ARM_AAPCS); -} - // The APCS parameter registers. static const MCPhysReg GPRArgRegs[] = { ARM::R0, ARM::R1, ARM::R2, ARM::R3 @@ -349,7 +184,22 @@ ARMTargetLowering::ARMTargetLowering(con setBooleanVectorContents(ZeroOrNegativeOneBooleanContent); - InitLibcallCallingConvs(); + if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetIOS() && + !Subtarget->isTargetWatchOS()) { + const auto &E = Subtarget->getTargetTriple().getEnvironment(); + + bool IsHFTarget = E == Triple::EABIHF || E == Triple::GNUEABIHF || + E == Triple::MuslEABIHF; + // Windows is a special case. Technically, we will replace all of the "GNU" + // calls with calls to MSVCRT if appropriate and adjust the calling + // convention then. + IsHFTarget = IsHFTarget || Subtarget->isTargetWindows(); + + for (int LCID = 0; LCID < RTLIB::UNKNOWN_LIBCALL; ++LCID) + setLibcallCallingConv(static_cast(LCID), + IsHFTarget ? CallingConv::ARM_AAPCS_VFP + : CallingConv::ARM_AAPCS); + } if (Subtarget->isTargetMachO()) { // Uses VFP for Thumb libfuncs if available. Modified: vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h ============================================================================== --- vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h Tue Jan 24 19:17:53 2017 (r312704) @@ -538,8 +538,6 @@ class InstrItineraryData; bool HasStandaloneRem = true; - void InitLibcallCallingConvs(); - void addTypeForNEON(MVT VT, MVT PromotedLdStVT, MVT PromotedBitwiseVT); void addDRTypeForNEON(MVT VT); void addQRTypeForNEON(MVT VT); Modified: vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -28788,10 +28788,12 @@ static SDValue combineExtractVectorElt(S return SDValue(); } -/// If a vector select has an operand that is -1 or 0, simplify the select to a -/// bitwise logic operation. -static SDValue combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG, - const X86Subtarget &Subtarget) { +/// If a vector select has an operand that is -1 or 0, try to simplify the +/// select to a bitwise logic operation. +static SDValue +combineVSelectWithAllOnesOrZeros(SDNode *N, SelectionDAG &DAG, + TargetLowering::DAGCombinerInfo &DCI, + const X86Subtarget &Subtarget) { SDValue Cond = N->getOperand(0); SDValue LHS = N->getOperand(1); SDValue RHS = N->getOperand(2); @@ -28853,18 +28855,28 @@ static SDValue combineVSelectWithAllOnes } } - if (!TValIsAllOnes && !FValIsAllZeros) + // vselect Cond, 111..., 000... -> Cond + if (TValIsAllOnes && FValIsAllZeros) + return DAG.getBitcast(VT, Cond); + + if (!DCI.isBeforeLegalize() && !TLI.isTypeLegal(CondVT)) return SDValue(); - SDValue Ret; - if (TValIsAllOnes && FValIsAllZeros) - Ret = Cond; - else if (TValIsAllOnes) - Ret = DAG.getNode(ISD::OR, DL, CondVT, Cond, DAG.getBitcast(CondVT, RHS)); - else if (FValIsAllZeros) - Ret = DAG.getNode(ISD::AND, DL, CondVT, Cond, DAG.getBitcast(CondVT, LHS)); + // vselect Cond, 111..., X -> or Cond, X + if (TValIsAllOnes) { + SDValue CastRHS = DAG.getBitcast(CondVT, RHS); + SDValue Or = DAG.getNode(ISD::OR, DL, CondVT, Cond, CastRHS); + return DAG.getBitcast(VT, Or); + } - return DAG.getBitcast(VT, Ret); + // vselect Cond, X, 000... -> and Cond, X + if (FValIsAllZeros) { + SDValue CastLHS = DAG.getBitcast(CondVT, LHS); + SDValue And = DAG.getNode(ISD::AND, DL, CondVT, Cond, CastLHS); + return DAG.getBitcast(VT, And); + } + + return SDValue(); } static SDValue combineSelectOfTwoConstants(SDNode *N, SelectionDAG &DAG) { @@ -29353,7 +29365,7 @@ static SDValue combineSelect(SDNode *N, } } - if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, Subtarget)) + if (SDValue V = combineVSelectWithAllOnesOrZeros(N, DAG, DCI, Subtarget)) return V; // If this is a *dynamic* select (non-constant condition) and we can match Modified: vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -600,6 +600,22 @@ private: void initializeCallbacks(Module &M); bool InstrumentGlobals(IRBuilder<> &IRB, Module &M); + void InstrumentGlobalsCOFF(IRBuilder<> &IRB, Module &M, + ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers); + void InstrumentGlobalsMachO(IRBuilder<> &IRB, Module &M, + ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers); + void + InstrumentGlobalsWithMetadataArray(IRBuilder<> &IRB, Module &M, + ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers); + + GlobalVariable *CreateMetadataGlobal(Module &M, Constant *Initializer, + StringRef OriginalName); + void SetComdatForGlobalMetadata(GlobalVariable *G, GlobalVariable *Metadata); + IRBuilder<> CreateAsanModuleDtor(Module &M); + bool ShouldInstrumentGlobal(GlobalVariable *G); bool ShouldUseMachOGlobalsSection() const; StringRef getGlobalMetadataSection() const; @@ -1553,17 +1569,173 @@ void AddressSanitizerModule::initializeC // Declare the functions that find globals in a shared object and then invoke // the (un)register function on them. - AsanRegisterImageGlobals = checkSanitizerInterfaceFunction( - M.getOrInsertFunction(kAsanRegisterImageGlobalsName, - IRB.getVoidTy(), IntptrTy, nullptr)); + AsanRegisterImageGlobals = + checkSanitizerInterfaceFunction(M.getOrInsertFunction( + kAsanRegisterImageGlobalsName, IRB.getVoidTy(), IntptrTy, nullptr)); AsanRegisterImageGlobals->setLinkage(Function::ExternalLinkage); - AsanUnregisterImageGlobals = checkSanitizerInterfaceFunction( - M.getOrInsertFunction(kAsanUnregisterImageGlobalsName, - IRB.getVoidTy(), IntptrTy, nullptr)); + AsanUnregisterImageGlobals = + checkSanitizerInterfaceFunction(M.getOrInsertFunction( + kAsanUnregisterImageGlobalsName, IRB.getVoidTy(), IntptrTy, nullptr)); AsanUnregisterImageGlobals->setLinkage(Function::ExternalLinkage); } +// Put the metadata and the instrumented global in the same group. This ensures +// that the metadata is discarded if the instrumented global is discarded. +void AddressSanitizerModule::SetComdatForGlobalMetadata( + GlobalVariable *G, GlobalVariable *Metadata) { + Module &M = *G->getParent(); + Comdat *C = G->getComdat(); + if (!C) { + if (!G->hasName()) { + // If G is unnamed, it must be internal. Give it an artificial name + // so we can put it in a comdat. + assert(G->hasLocalLinkage()); + G->setName(Twine(kAsanGenPrefix) + "_anon_global"); + } + C = M.getOrInsertComdat(G->getName()); + // Make this IMAGE_COMDAT_SELECT_NODUPLICATES on COFF. + if (TargetTriple.isOSBinFormatCOFF()) + C->setSelectionKind(Comdat::NoDuplicates); + G->setComdat(C); + } + + assert(G->hasComdat()); + Metadata->setComdat(G->getComdat()); +} + +// Create a separate metadata global and put it in the appropriate ASan +// global registration section. +GlobalVariable * +AddressSanitizerModule::CreateMetadataGlobal(Module &M, Constant *Initializer, + StringRef OriginalName) { + GlobalVariable *Metadata = + new GlobalVariable(M, Initializer->getType(), false, + GlobalVariable::InternalLinkage, Initializer, + Twine("__asan_global_") + + GlobalValue::getRealLinkageName(OriginalName)); + Metadata->setSection(getGlobalMetadataSection()); + return Metadata; +} + +IRBuilder<> AddressSanitizerModule::CreateAsanModuleDtor(Module &M) { + Function *AsanDtorFunction = + Function::Create(FunctionType::get(Type::getVoidTy(*C), false), + GlobalValue::InternalLinkage, kAsanModuleDtorName, &M); + BasicBlock *AsanDtorBB = BasicBlock::Create(*C, "", AsanDtorFunction); + appendToGlobalDtors(M, AsanDtorFunction, kAsanCtorAndDtorPriority); + + return IRBuilder<>(ReturnInst::Create(*C, AsanDtorBB)); +} + +void AddressSanitizerModule::InstrumentGlobalsCOFF( + IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers) { + assert(ExtendedGlobals.size() == MetadataInitializers.size()); + auto &DL = M.getDataLayout(); + + for (size_t i = 0; i < ExtendedGlobals.size(); i++) { + Constant *Initializer = MetadataInitializers[i]; + GlobalVariable *G = ExtendedGlobals[i]; + GlobalVariable *Metadata = + CreateMetadataGlobal(M, Initializer, G->getName()); + + // The MSVC linker always inserts padding when linking incrementally. We + // cope with that by aligning each struct to its size, which must be a power + // of two. + unsigned SizeOfGlobalStruct = DL.getTypeAllocSize(Initializer->getType()); + assert(isPowerOf2_32(SizeOfGlobalStruct) && + "global metadata will not be padded appropriately"); + Metadata->setAlignment(SizeOfGlobalStruct); + + SetComdatForGlobalMetadata(G, Metadata); + } +} + +void AddressSanitizerModule::InstrumentGlobalsMachO( + IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers) { + assert(ExtendedGlobals.size() == MetadataInitializers.size()); + + // On recent Mach-O platforms, use a structure which binds the liveness of + // the global variable to the metadata struct. Keep the list of "Liveness" GV + // created to be added to llvm.compiler.used + StructType *LivenessTy = StructType::get(IntptrTy, IntptrTy, nullptr); + SmallVector LivenessGlobals(ExtendedGlobals.size()); + + for (size_t i = 0; i < ExtendedGlobals.size(); i++) { + Constant *Initializer = MetadataInitializers[i]; + GlobalVariable *G = ExtendedGlobals[i]; + GlobalVariable *Metadata = + CreateMetadataGlobal(M, Initializer, G->getName()); + + // On recent Mach-O platforms, we emit the global metadata in a way that + // allows the linker to properly strip dead globals. + auto LivenessBinder = ConstantStruct::get( + LivenessTy, Initializer->getAggregateElement(0u), + ConstantExpr::getPointerCast(Metadata, IntptrTy), nullptr); + GlobalVariable *Liveness = new GlobalVariable( + M, LivenessTy, false, GlobalVariable::InternalLinkage, LivenessBinder, + Twine("__asan_binder_") + G->getName()); + Liveness->setSection("__DATA,__asan_liveness,regular,live_support"); + LivenessGlobals[i] = Liveness; + } + + // Update llvm.compiler.used, adding the new liveness globals. This is + // needed so that during LTO these variables stay alive. The alternative + // would be to have the linker handling the LTO symbols, but libLTO + // current API does not expose access to the section for each symbol. + if (!LivenessGlobals.empty()) + appendToCompilerUsed(M, LivenessGlobals); + + // RegisteredFlag serves two purposes. First, we can pass it to dladdr() + // to look up the loaded image that contains it. Second, we can store in it + // whether registration has already occurred, to prevent duplicate + // registration. + // + // common linkage ensures that there is only one global per shared library. + GlobalVariable *RegisteredFlag = new GlobalVariable( + M, IntptrTy, false, GlobalVariable::CommonLinkage, + ConstantInt::get(IntptrTy, 0), kAsanGlobalsRegisteredFlagName); + RegisteredFlag->setVisibility(GlobalVariable::HiddenVisibility); + + IRB.CreateCall(AsanRegisterImageGlobals, + {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); + + // We also need to unregister globals at the end, e.g., when a shared library + // gets closed. + IRBuilder<> IRB_Dtor = CreateAsanModuleDtor(M); + IRB_Dtor.CreateCall(AsanUnregisterImageGlobals, + {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); +} + +void AddressSanitizerModule::InstrumentGlobalsWithMetadataArray( + IRBuilder<> &IRB, Module &M, ArrayRef ExtendedGlobals, + ArrayRef MetadataInitializers) { + assert(ExtendedGlobals.size() == MetadataInitializers.size()); + unsigned N = ExtendedGlobals.size(); + assert(N > 0); + + // On platforms that don't have a custom metadata section, we emit an array + // of global metadata structures. + ArrayType *ArrayOfGlobalStructTy = + ArrayType::get(MetadataInitializers[0]->getType(), N); + auto AllGlobals = new GlobalVariable( + M, ArrayOfGlobalStructTy, false, GlobalVariable::InternalLinkage, + ConstantArray::get(ArrayOfGlobalStructTy, MetadataInitializers), ""); + + IRB.CreateCall(AsanRegisterGlobals, + {IRB.CreatePointerCast(AllGlobals, IntptrTy), + ConstantInt::get(IntptrTy, N)}); + + // We also need to unregister globals at the end, e.g., when a shared library + // gets closed. + IRBuilder<> IRB_Dtor = CreateAsanModuleDtor(M); + IRB_Dtor.CreateCall(AsanUnregisterGlobals, + {IRB.CreatePointerCast(AllGlobals, IntptrTy), + ConstantInt::get(IntptrTy, N)}); +} + // This function replaces all global variables with new variables that have // trailing redzones. It also creates a function that poisons // redzones and inserts this function into llvm.global_ctors. @@ -1580,9 +1752,6 @@ bool AddressSanitizerModule::InstrumentG if (n == 0) return false; auto &DL = M.getDataLayout(); - bool UseComdatMetadata = TargetTriple.isOSBinFormatCOFF(); - bool UseMachOGlobalsSection = ShouldUseMachOGlobalsSection(); - bool UseMetadataArray = !(UseComdatMetadata || UseMachOGlobalsSection); // A global is described by a structure // size_t beg; @@ -1597,19 +1766,8 @@ bool AddressSanitizerModule::InstrumentG StructType *GlobalStructTy = StructType::get(IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, IntptrTy, nullptr); - unsigned SizeOfGlobalStruct = DL.getTypeAllocSize(GlobalStructTy); - assert(isPowerOf2_32(SizeOfGlobalStruct) && - "global metadata will not be padded appropriately"); - SmallVector Initializers(UseMetadataArray ? n : 0); - - // On recent Mach-O platforms, use a structure which binds the liveness of - // the global variable to the metadata struct. Keep the list of "Liveness" GV - // created to be added to llvm.compiler.used - StructType *LivenessTy = nullptr; - if (UseMachOGlobalsSection) - LivenessTy = StructType::get(IntptrTy, IntptrTy, nullptr); - SmallVector LivenessGlobals( - UseMachOGlobalsSection ? n : 0); + SmallVector NewGlobals(n); + SmallVector Initializers(n); bool HasDynamicallyInitializedGlobals = false; @@ -1681,25 +1839,7 @@ bool AddressSanitizerModule::InstrumentG ConstantExpr::getGetElementPtr(NewTy, NewGlobal, Indices2, true)); NewGlobal->takeName(G); G->eraseFromParent(); - G = NewGlobal; - - if (UseComdatMetadata) { - // Get or create a COMDAT for G so that we can use it with our metadata. - Comdat *C = G->getComdat(); - if (!C) { - if (!G->hasName()) { - // If G is unnamed, it must be internal. Give it an artificial name - // so we can put it in a comdat. - assert(G->hasLocalLinkage()); - G->setName(Twine(kAsanGenPrefix) + "_anon_global"); - } - C = M.getOrInsertComdat(G->getName()); - // Make this IMAGE_COMDAT_SELECT_NODUPLICATES on COFF. - if (TargetTriple.isOSBinFormatCOFF()) - C->setSelectionKind(Comdat::NoDuplicates); - G->setComdat(C); - } - } + NewGlobals[i] = NewGlobal; Constant *SourceLoc; if (!MD.SourceLoc.empty()) { @@ -1750,117 +1890,21 @@ bool AddressSanitizerModule::InstrumentG DEBUG(dbgs() << "NEW GLOBAL: " << *NewGlobal << "\n"); - // If we aren't using separate metadata globals, add it to the initializer - // list and continue. - if (UseMetadataArray) { - Initializers[i] = Initializer; - continue; - } - - // Create a separate metadata global and put it in the appropriate ASan - // global registration section. - GlobalVariable *Metadata = new GlobalVariable( - M, GlobalStructTy, false, GlobalVariable::InternalLinkage, - Initializer, Twine("__asan_global_") + - GlobalValue::getRealLinkageName(G->getName())); - Metadata->setSection(getGlobalMetadataSection()); - - // We don't want any padding, but we also need a reasonable alignment. - // The MSVC linker always inserts padding when linking incrementally. We - // cope with that by aligning each struct to its size, which must be a power - // of two. - Metadata->setAlignment(SizeOfGlobalStruct); - - // On platforms that support comdats, put the metadata and the - // instrumented global in the same group. This ensures that the metadata - // is discarded if the instrumented global is discarded. - if (UseComdatMetadata) { - assert(G->hasComdat()); - Metadata->setComdat(G->getComdat()); - continue; - } - assert(UseMachOGlobalsSection); + Initializers[i] = Initializer; + } - // On recent Mach-O platforms, we emit the global metadata in a way that - // allows the linker to properly strip dead globals. - auto LivenessBinder = ConstantStruct::get( - LivenessTy, Initializer->getAggregateElement(0u), - ConstantExpr::getPointerCast(Metadata, IntptrTy), nullptr); - GlobalVariable *Liveness = new GlobalVariable( - M, LivenessTy, false, GlobalVariable::InternalLinkage, LivenessBinder, - Twine("__asan_binder_") + G->getName()); - Liveness->setSection("__DATA,__asan_liveness,regular,live_support"); - LivenessGlobals[i] = Liveness; + if (TargetTriple.isOSBinFormatCOFF()) { + InstrumentGlobalsCOFF(IRB, M, NewGlobals, Initializers); + } else if (ShouldUseMachOGlobalsSection()) { + InstrumentGlobalsMachO(IRB, M, NewGlobals, Initializers); + } else { + InstrumentGlobalsWithMetadataArray(IRB, M, NewGlobals, Initializers); } // Create calls for poisoning before initializers run and unpoisoning after. if (HasDynamicallyInitializedGlobals) createInitializerPoisonCalls(M, ModuleName); - // Platforms with a dedicated metadata section don't need to emit any more - // code. - if (UseComdatMetadata) - return true; - - GlobalVariable *AllGlobals = nullptr; - GlobalVariable *RegisteredFlag = nullptr; - - if (UseMachOGlobalsSection) { - // RegisteredFlag serves two purposes. First, we can pass it to dladdr() - // to look up the loaded image that contains it. Second, we can store in it - // whether registration has already occurred, to prevent duplicate - // registration. - // - // common linkage ensures that there is only one global per shared library. - RegisteredFlag = new GlobalVariable( - M, IntptrTy, false, GlobalVariable::CommonLinkage, - ConstantInt::get(IntptrTy, 0), kAsanGlobalsRegisteredFlagName); - RegisteredFlag->setVisibility(GlobalVariable::HiddenVisibility); - - // Update llvm.compiler.used, adding the new liveness globals. This is - // needed so that during LTO these variables stay alive. The alternative - // would be to have the linker handling the LTO symbols, but libLTO - // current API does not expose access to the section for each symbol. - if (!LivenessGlobals.empty()) - appendToCompilerUsed(M, LivenessGlobals); - } else if (UseMetadataArray) { - // On platforms that don't have a custom metadata section, we emit an array - // of global metadata structures. - ArrayType *ArrayOfGlobalStructTy = ArrayType::get(GlobalStructTy, n); - AllGlobals = new GlobalVariable( - M, ArrayOfGlobalStructTy, false, GlobalVariable::InternalLinkage, - ConstantArray::get(ArrayOfGlobalStructTy, Initializers), ""); - } - - // Create a call to register the globals with the runtime. - if (UseMachOGlobalsSection) { - IRB.CreateCall(AsanRegisterImageGlobals, - {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); - } else { - IRB.CreateCall(AsanRegisterGlobals, - {IRB.CreatePointerCast(AllGlobals, IntptrTy), - ConstantInt::get(IntptrTy, n)}); - } - - // We also need to unregister globals at the end, e.g., when a shared library - // gets closed. - Function *AsanDtorFunction = - Function::Create(FunctionType::get(Type::getVoidTy(*C), false), - GlobalValue::InternalLinkage, kAsanModuleDtorName, &M); - BasicBlock *AsanDtorBB = BasicBlock::Create(*C, "", AsanDtorFunction); - IRBuilder<> IRB_Dtor(ReturnInst::Create(*C, AsanDtorBB)); - - if (UseMachOGlobalsSection) { - IRB_Dtor.CreateCall(AsanUnregisterImageGlobals, - {IRB.CreatePointerCast(RegisteredFlag, IntptrTy)}); - } else { - IRB_Dtor.CreateCall(AsanUnregisterGlobals, - {IRB.CreatePointerCast(AllGlobals, IntptrTy), - ConstantInt::get(IntptrTy, n)}); - } - - appendToGlobalDtors(M, AsanDtorFunction, kAsanCtorAndDtorPriority); - DEBUG(dbgs() << M); return true; } Modified: vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp ============================================================================== --- vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp Tue Jan 24 19:17:53 2017 (r312704) @@ -85,6 +85,8 @@ STATISTIC(NumGVNLeaderChanges, "Number o STATISTIC(NumGVNSortedLeaderChanges, "Number of sorted leader changes"); STATISTIC(NumGVNAvoidedSortedLeaderChanges, "Number of avoided sorted leader changes"); +STATISTIC(NumGVNNotMostDominatingLeader, + "Number of times a member dominated it's new classes' leader"); //===----------------------------------------------------------------------===// // GVN Pass @@ -1073,17 +1075,20 @@ void NewGVN::moveValueToNewCongruenceCla if (I == OldClass->NextLeader.first) OldClass->NextLeader = {nullptr, ~0U}; - // The new instruction and new class leader may either be siblings in the - // dominator tree, or the new class leader should dominate the new member - // instruction. We simply check that the member instruction does not properly - // dominate the new class leader. - assert( - !isa(NewClass->RepLeader) || !NewClass->RepLeader || - I == NewClass->RepLeader || - !DT->properlyDominates( + // It's possible, though unlikely, for us to discover equivalences such + // that the current leader does not dominate the old one. + // This statistic tracks how often this happens. + // We assert on phi nodes when this happens, currently, for debugging, because + // we want to make sure we name phi node cycles properly. + if (isa(NewClass->RepLeader) && NewClass->RepLeader && + I != NewClass->RepLeader && + DT->properlyDominates( I->getParent(), - cast(NewClass->RepLeader)->getParent()) && - "New class for instruction should not be dominated by instruction"); + cast(NewClass->RepLeader)->getParent())) { + ++NumGVNNotMostDominatingLeader; + assert(!isa(I) && + "New class for instruction should not be dominated by instruction"); + } if (NewClass->RepLeader != I) { auto DFSNum = InstrDFS.lookup(I); Added: vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt.mir ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/CodeGen/AArch64/ldst-opt.mir Tue Jan 24 19:17:53 2017 (r312704) @@ -0,0 +1,132 @@ +# RUN: llc -mtriple=aarch64--linux-gnu -run-pass=aarch64-ldst-opt %s -verify-machineinstrs -o - 2>&1 | FileCheck %s +--- | + define void @promote-load-from-store() { ret void } + define void @store-pair() { ret void } + define void @store-pair-clearkill0() { ret void } + define void @store-pair-clearkill1() { ret void } +... +--- +name: promote-load-from-store +tracksRegLiveness: true +body: | + bb.0: + liveins: %w1, %x0, %lr + + STRWui killed %w1, %x0, 0 :: (store 4) + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + %w0 = LDRHHui killed %x0, 1 :: (load 2) + RET %lr, implicit %w0 + +... +# Don't count transient instructions towards search limits. +# CHECK-LABEL: name: promote-load-from-store +# CHECK: STRWui %w1 +# CHECK: UBFMWri %w1 +--- +name: store-pair +tracksRegLiveness: true +body: | + bb.0: + liveins: %w1, %x0, %lr + + STRWui %w1, %x0, 0 :: (store 4) + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + CFI_INSTRUCTION 0 + STRWui killed %w1, killed %x0, 1 :: (store 4) + RET %lr + +... +# CHECK-LABEL: name: store-pair +# CHECK: STPWi +--- +name: store-pair-clearkill0 +tracksRegLiveness: true +body: | + bb.0: + liveins: %w1, %x0, %lr + + STRWui %w1, %x0, 0 :: (store 4) + %w2 = COPY %w1 + %x3 = COPY %x0 + STRWui killed %w1, killed %x0, 1 :: (store 4) + RET %lr +... +# When merging a lower store with an upper one, we must clear kill flags on +# the lower store. +# CHECK-LABEL: store-pair-clearkill0 +# CHECK-NOT: STPWi %w1, killed %w1, %x0, 0 :: (store 4) +# CHECK: STPWi %w1, %w1, %x0, 0 :: (store 4) +# CHECK: %w2 = COPY %w1 +# CHECK: RET %lr +--- +name: store-pair-clearkill1 +tracksRegLiveness: true +body: | + bb.0: + liveins: %x0, %lr + + %w1 = MOVi32imm 13 + %w2 = MOVi32imm 7 + STRWui %w1, %x0, 1 :: (store 4) + %w2 = COPY killed %w1 + STRWui killed %w2, %x0, 0 :: (store 4) + + %w1 = MOVi32imm 42 + %w2 = MOVi32imm 7 + STRWui %w1, %x0, 0 :: (store 4) + %w2 = COPY killed %w1 + STRWui killed %w2, killed %x0, 1 :: (store 4) + + RET %lr +... +# When merging an upper store with a lower one, kill flags along the way need +# to be removed; In this case the kill flag on %w1. +# CHECK-LABEL: store-pair-clearkill1 +# CHECK: %w1 = MOVi32imm +# CHECK: %w2 = MOVi32imm +# CHECK-NOT: %w2 = COPY killed %w1 +# CHECK: %w2 = COPY %w1 +# CHECK: STPWi killed %w2, %w1, %x0, 0 + +# CHECK: %w1 = MOVi32imm +# CHECK: %w2 = MOVi32imm +# CHECK-NOT: %w2 = COPY killed %w1 +# CHECK: %w2 = COPY %w1 +# CHECK: STPWi %w1, killed %w2, killed %x0, 0 Modified: vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-double.ll Tue Jan 24 19:17:53 2017 (r312704) @@ -18,7 +18,7 @@ declare double @llvm.powi.f64(double define double @powi_d(double %a, i32 %b) { ; CHECK-LABEL: powi_d: ; SOFT: {{(bl|b)}} __powidf2 -; HARD: bl __powidf2 +; HARD: b __powidf2 %1 = call double @llvm.powi.f64(double %a, i32 %b) ret double %1 } Modified: vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll ============================================================================== --- vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll Tue Jan 24 18:56:09 2017 (r312703) +++ vendor/llvm/dist/test/CodeGen/Thumb2/float-intrinsics-float.ll Tue Jan 24 19:17:53 2017 (r312704) @@ -18,7 +18,7 @@ declare float @llvm.powi.f32(float % define float @powi_f(float %a, i32 %b) { ; CHECK-LABEL: powi_f: ; SOFT: bl __powisf2 -; HARD: bl __powisf2 +; HARD: b __powisf2 %1 = call float @llvm.powi.f32(float %a, i32 %b) ret float %1 } Added: vendor/llvm/dist/test/CodeGen/Thumb2/intrinsics-cc.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/test/CodeGen/Thumb2/intrinsics-cc.ll Tue Jan 24 19:17:53 2017 (r312704) @@ -0,0 +1,41 @@ +; RUN: llc -mtriple thumbv7-unknown-none-eabi -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH +; RUN: llc -mtriple thumbv7-unknown-none-eabi -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-SOFT +; RUN: llc -mtriple thumbv7-unknown-none-eabihf -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-HARD +; RUN: llc -mtriple thumbv7-unknown-none-eabihf -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH + +; RUN: llc -mtriple thumbv7-unknown-none-gnueabi -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH +; RUN: llc -mtriple thumbv7-unknown-none-gnueabi -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-SOFT +; RUN: llc -mtriple thumbv7-unknown-none-gnueabihf -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-HARD +; RUN: llc -mtriple thumbv7-unknown-none-gnueabihf -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH + +; RUN: llc -mtriple thumbv7-unknown-none-musleabi -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH +; RUN: llc -mtriple thumbv7-unknown-none-musleabi -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-SOFT +; RUN: llc -mtriple thumbv7-unknown-none-musleabihf -float-abi soft -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MISMATCH -check-prefix CHECK-TO-HARD +; RUN: llc -mtriple thumbv7-unknown-none-musleabihf -float-abi hard -filetype asm -o - %s | FileCheck %s -check-prefix CHECK-MATCH + +declare float @llvm.powi.f32(float, i32) + +define float @f(float %f, i32 %i) { +entry: + %0 = call float @llvm.powi.f32(float %f, i32 %i) + ret float %0 +} + +; CHECK-MATCH: b __powisf2 +; CHECK-MISMATCH: bl __powisf2 +; CHECK-TO-SOFT: vmov s0, r0 +; CHECK-TO-HARD: vmov r0, s0 + +declare double @llvm.powi.f64(double, i32) + +define double @g(double %d, i32 %i) { +entry: + %0 = call double @llvm.powi.f64(double %d, i32 %i) + ret double %0 +} + +; CHECK-MATCH: b __powidf2 +; CHECK-MISMATCH: bl __powidf2 +; CHECK-TO-SOFT: vmov d0, r0, r1 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:00 2017 Return-Path: Delivered-To: svn-src-vendor@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 4E8E8CBF51C; Tue, 24 Jan 2017 19:18:00 +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 04424A38; Tue, 24 Jan 2017 19:17:59 +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 v0OJHxsV072238; Tue, 24 Jan 2017 19:17:59 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJHxbb072237; Tue, 24 Jan 2017 19:17:59 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241917.v0OJHxbb072237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:17:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312705 - vendor/llvm/llvm-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:00 -0000 Author: dim Date: Tue Jan 24 19:17:58 2017 New Revision: 312705 URL: https://svnweb.freebsd.org/changeset/base/312705 Log: Tag llvm release_40 branch r292951. Added: vendor/llvm/llvm-release_40-r292951/ - copied from r312704, vendor/llvm/dist/ From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:11 2017 Return-Path: Delivered-To: svn-src-vendor@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 71970CBF586; Tue, 24 Jan 2017 19:18:11 +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 1D6DCAF8; Tue, 24 Jan 2017 19:18:11 +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 v0OJIATn072349; Tue, 24 Jan 2017 19:18:10 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIAYv072348; Tue, 24 Jan 2017 19:18:10 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIAYv072348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312707 - vendor/clang/clang-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:11 -0000 Author: dim Date: Tue Jan 24 19:18:10 2017 New Revision: 312707 URL: https://svnweb.freebsd.org/changeset/base/312707 Log: Tag clang release_40 branch r292951. Added: vendor/clang/clang-release_40-r292951/ - copied from r312706, vendor/clang/dist/ From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:07 2017 Return-Path: Delivered-To: svn-src-vendor@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 3A622CBF56C; Tue, 24 Jan 2017 19:18:07 +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 04390A9F; Tue, 24 Jan 2017 19:18:06 +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 v0OJI62v072303; Tue, 24 Jan 2017 19:18:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJI4q2072290; Tue, 24 Jan 2017 19:18:04 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJI4q2072290@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312706 - in vendor/clang/dist: docs include/clang/Basic lib/AST lib/CodeGen lib/Lex lib/Sema test/CodeGenCXX test/Lexer test/Sema test/SemaCXX X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:07 -0000 Author: dim Date: Tue Jan 24 19:18:04 2017 New Revision: 312706 URL: https://svnweb.freebsd.org/changeset/base/312706 Log: Vendor import of clang release_40 branch r292951: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292951 Added: vendor/clang/dist/test/Sema/PR28181.c (contents, props changed) vendor/clang/dist/test/SemaCXX/cxx11-default-member-initializers.cpp (contents, props changed) Modified: vendor/clang/dist/docs/LanguageExtensions.rst vendor/clang/dist/include/clang/Basic/Builtins.def vendor/clang/dist/lib/AST/ExprConstant.cpp vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/test/CodeGenCXX/builtins.cpp vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp vendor/clang/dist/test/SemaCXX/constexpr-string.cpp Modified: vendor/clang/dist/docs/LanguageExtensions.rst ============================================================================== --- vendor/clang/dist/docs/LanguageExtensions.rst Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/docs/LanguageExtensions.rst Tue Jan 24 19:18:04 2017 (r312706) @@ -1776,6 +1776,46 @@ numeric primitives such as frexp. See `L `_ for more information on the semantics. +String builtins +--------------- + +Clang provides constant expression evaluation support for builtins forms of +the following functions from the C standard library ```` header: + +* ``memchr`` +* ``memcmp`` +* ``strchr`` +* ``strcmp`` +* ``strlen`` +* ``strncmp`` +* ``wcschr`` +* ``wcscmp`` +* ``wcslen`` +* ``wcsncmp`` +* ``wmemchr`` +* ``wmemcmp`` + +In each case, the builtin form has the name of the C library function prefixed +by ``__builtin_``. Example: + +.. code-block:: c + + void *p = __builtin_memchr("foobar", 'b', 5); + +In addition to the above, one further builtin is provided: + +.. code-block:: c + + char *__builtin_char_memchr(const char *haystack, int needle, size_t size); + +``__builtin_char_memchr(a, b, c)`` is identical to +``(char*)__builtin_memchr(a, b, c)`` except that its use is permitted within +constant expressions in C++11 onwards (where a cast from ``void*`` to ``char*`` +is disallowed in general). + +Support for constant expression evaluation for the above builtins be detected +with ``__has_feature(cxx_constexpr_string_builtins)``. + .. _langext-__c11_atomic: __c11_atomic builtins Modified: vendor/clang/dist/include/clang/Basic/Builtins.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/Builtins.def Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/include/clang/Basic/Builtins.def Tue Jan 24 19:18:04 2017 (r312706) @@ -1339,6 +1339,7 @@ BUILTIN(__builtin_smulll_overflow, "bSLL BUILTIN(__builtin_addressof, "v*v&", "nct") BUILTIN(__builtin_operator_new, "v*z", "c") BUILTIN(__builtin_operator_delete, "vv*", "n") +BUILTIN(__builtin_char_memchr, "c*cC*iz", "n") // Safestack builtins BUILTIN(__builtin___get_unsafe_stack_start, "v*", "Fn") Modified: vendor/clang/dist/lib/AST/ExprConstant.cpp ============================================================================== --- vendor/clang/dist/lib/AST/ExprConstant.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/AST/ExprConstant.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -5683,6 +5683,7 @@ bool PointerExprEvaluator::VisitBuiltinC case Builtin::BI__builtin_strchr: case Builtin::BI__builtin_wcschr: case Builtin::BI__builtin_memchr: + case Builtin::BI__builtin_char_memchr: case Builtin::BI__builtin_wmemchr: { if (!Visit(E->getArg(0))) return false; @@ -5720,6 +5721,7 @@ bool PointerExprEvaluator::VisitBuiltinC // Fall through. case Builtin::BImemchr: case Builtin::BI__builtin_memchr: + case Builtin::BI__builtin_char_memchr: // memchr compares by converting both sides to unsigned char. That's also // correct for strchr if we get this far (to cope with plain char being // unsigned in the strchr case). Modified: vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -1189,6 +1189,10 @@ RValue CodeGenFunction::EmitBuiltinExpr( return RValue::get(Dest.getPointer()); } + case Builtin::BI__builtin_char_memchr: + BuiltinID = Builtin::BI__builtin_memchr; + break; + case Builtin::BI__builtin___memcpy_chk: { // fold __builtin_memcpy_chk(x, y, cst1, cst2) to memcpy iff cst1<=cst2. llvm::APSInt Size, DstSize; Modified: vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp ============================================================================== --- vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -1183,6 +1183,7 @@ static bool HasFeature(const Preprocesso .Case("cxx_attributes", LangOpts.CPlusPlus11) .Case("cxx_auto_type", LangOpts.CPlusPlus11) .Case("cxx_constexpr", LangOpts.CPlusPlus11) + .Case("cxx_constexpr_string_builtins", LangOpts.CPlusPlus11) .Case("cxx_decltype", LangOpts.CPlusPlus11) .Case("cxx_decltype_incomplete_return_types", LangOpts.CPlusPlus11) .Case("cxx_default_function_template_args", LangOpts.CPlusPlus11) Modified: vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -12383,9 +12383,9 @@ ExprResult Sema::BuildCXXDefaultInitExpr Diag(Loc, diag::err_in_class_initializer_not_yet_parsed) << OutermostClass << Field; Diag(Field->getLocEnd(), diag::note_in_class_initializer_not_yet_parsed); - - // Don't diagnose this again. - Field->setInvalidDecl(); + // Recover by marking the field invalid, unless we're in a SFINAE context. + if (!isSFINAEContext()) + Field->setInvalidDecl(); return ExprError(); } Modified: vendor/clang/dist/lib/Sema/SemaExpr.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaExpr.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/lib/Sema/SemaExpr.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -11496,7 +11496,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, RHSExpr); // Don't resolve overloads if the other type is overloadable. - if (pty->getKind() == BuiltinType::Overload) { + if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload) { // We can't actually test that if we still have a placeholder, // though. Fortunately, none of the exceptions we see in that // code below are valid when the LHS is an overload set. Note @@ -11521,17 +11521,16 @@ ExprResult Sema::BuildBinOp(Scope *S, So // An overload in the RHS can potentially be resolved by the type // being assigned to. if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) { - if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent()) - return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); - - if (LHSExpr->getType()->isOverloadableType()) + if (getLangOpts().CPlusPlus && + (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() || + LHSExpr->getType()->isOverloadableType())) return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr); } // Don't resolve overloads if the other type is overloadable. - if (pty->getKind() == BuiltinType::Overload && + if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload && LHSExpr->getType()->isOverloadableType()) return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); Modified: vendor/clang/dist/test/CodeGenCXX/builtins.cpp ============================================================================== --- vendor/clang/dist/test/CodeGenCXX/builtins.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/test/CodeGenCXX/builtins.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -26,3 +26,7 @@ int x = __builtin_abs(-2); long y = __builtin_abs(-2l); // CHECK: [[Y:%.+]] = call i64 @_Z13__builtin_absl(i64 -2) // CHECK: store i64 [[Y]], i64* @y, align 8 + +extern const char char_memchr_arg[32]; +char *memchr_result = __builtin_char_memchr(char_memchr_arg, 123, 32); +// CHECK: call i8* @memchr(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @char_memchr_arg, i32 0, i32 0), i32 123, i64 32) Modified: vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp ============================================================================== --- vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/test/Lexer/has_feature_cxx0x.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -301,6 +301,17 @@ int no_constexpr(); // CHECK-11: has_constexpr // CHECK-NO-11: no_constexpr +#if __has_feature(cxx_constexpr_string_builtins) +int has_constexpr_string_builtins(); +#else +int no_constexpr_string_builtins(); +#endif + +// CHECK-1Z: has_constexpr_string_builtins +// CHECK-14: has_constexpr_string_builtins +// CHECK-11: has_constexpr_string_builtins +// CHECK-NO-11: no_constexpr_string_builtins + #if __has_feature(cxx_generalized_initializers) int has_generalized_initializers(); #else Added: vendor/clang/dist/test/Sema/PR28181.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/test/Sema/PR28181.c Tue Jan 24 19:18:04 2017 (r312706) @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct spinlock_t { + int lock; +} audit_skb_queue; + +void fn1() { + audit_skb_queue = (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}} +} // expected-error@-1 {{assigning to 'struct spinlock_t' from incompatible type ''}} + +void fn2() { + audit_skb_queue + (lock); // expected-error {{use of undeclared identifier 'lock'; did you mean 'long'?}} +} // expected-error@-1 {{reference to overloaded function could not be resolved; did you mean to call it?}} Modified: vendor/clang/dist/test/SemaCXX/constexpr-string.cpp ============================================================================== --- vendor/clang/dist/test/SemaCXX/constexpr-string.cpp Tue Jan 24 19:17:58 2017 (r312705) +++ vendor/clang/dist/test/SemaCXX/constexpr-string.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -166,6 +166,27 @@ namespace StrchrEtc { static_assert(__builtin_memchr(nullptr, 'x', 3) == nullptr); // expected-error {{not an integral constant}} expected-note {{dereferenced null}} static_assert(__builtin_memchr(nullptr, 'x', 0) == nullptr); // FIXME: Should we reject this? + static_assert(__builtin_char_memchr(kStr, 'a', 0) == nullptr); + static_assert(__builtin_char_memchr(kStr, 'a', 1) == kStr); + static_assert(__builtin_char_memchr(kStr, '\0', 5) == nullptr); + static_assert(__builtin_char_memchr(kStr, '\0', 6) == kStr + 5); + static_assert(__builtin_char_memchr(kStr, '\xff', 8) == kStr + 4); + static_assert(__builtin_char_memchr(kStr, '\xff' + 256, 8) == kStr + 4); + static_assert(__builtin_char_memchr(kStr, '\xff' - 256, 8) == kStr + 4); + static_assert(__builtin_char_memchr(kFoo, 'x', 3) == nullptr); + static_assert(__builtin_char_memchr(kFoo, 'x', 4) == nullptr); // expected-error {{not an integral constant}} expected-note {{dereferenced one-past-the-end}} + static_assert(__builtin_char_memchr(nullptr, 'x', 3) == nullptr); // expected-error {{not an integral constant}} expected-note {{dereferenced null}} + static_assert(__builtin_char_memchr(nullptr, 'x', 0) == nullptr); // FIXME: Should we reject this? + + static_assert(*__builtin_char_memchr(kStr, '\xff', 8) == '\xff'); + constexpr bool char_memchr_mutable() { + char buffer[] = "mutable"; + *__builtin_char_memchr(buffer, 't', 8) = 'r'; + *__builtin_char_memchr(buffer, 'm', 8) = 'd'; + return __builtin_strcmp(buffer, "durable") == 0; + } + static_assert(char_memchr_mutable()); + constexpr bool a = !strchr("hello", 'h'); // expected-error {{constant expression}} expected-note {{non-constexpr function 'strchr' cannot be used in a constant expression}} constexpr bool b = !memchr("hello", 'h', 3); // expected-error {{constant expression}} expected-note {{non-constexpr function 'memchr' cannot be used in a constant expression}} } Added: vendor/clang/dist/test/SemaCXX/cxx11-default-member-initializers.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/test/SemaCXX/cxx11-default-member-initializers.cpp Tue Jan 24 19:18:04 2017 (r312706) @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s -pedantic + +namespace PR31692 { + struct A { + struct X { int n = 0; } x; + // Trigger construction of X() from a SFINAE context. This must not mark + // any part of X as invalid. + static_assert(!__is_constructible(X), ""); + // Check that X::n is not marked invalid. + double &r = x.n; // expected-error {{non-const lvalue reference to type 'double' cannot bind to a value of unrelated type 'int'}} + }; + // A::X can now be default-constructed. + static_assert(__is_constructible(A::X), ""); +} From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:14 2017 Return-Path: Delivered-To: svn-src-vendor@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 49DE3CBF5BD; Tue, 24 Jan 2017 19:18:14 +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 F2BAEB5B; Tue, 24 Jan 2017 19:18:13 +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 v0OJIDLN072399; Tue, 24 Jan 2017 19:18:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIDTa072398; Tue, 24 Jan 2017 19:18:13 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIDTa072398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312708 - vendor/compiler-rt/compiler-rt-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:14 -0000 Author: dim Date: Tue Jan 24 19:18:12 2017 New Revision: 312708 URL: https://svnweb.freebsd.org/changeset/base/312708 Log: Tag compiler-rt release_40 branch r292951. Added: vendor/compiler-rt/compiler-rt-release_40-r292951/ - copied from r312707, vendor/compiler-rt/dist/ From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:21 2017 Return-Path: Delivered-To: svn-src-vendor@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 CDD06CBF64A; Tue, 24 Jan 2017 19:18:21 +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 7BA4DC3E; Tue, 24 Jan 2017 19:18:21 +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 v0OJIKi9072498; Tue, 24 Jan 2017 19:18:20 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIKH2072497; Tue, 24 Jan 2017 19:18:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIKH2072497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312710 - vendor/libc++/libc++-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:21 -0000 Author: dim Date: Tue Jan 24 19:18:20 2017 New Revision: 312710 URL: https://svnweb.freebsd.org/changeset/base/312710 Log: Tag libc++ release_40 branch r292951. Added: vendor/libc++/libc++-release_40-r292951/ - copied from r312709, vendor/libc++/dist/ From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:18 2017 Return-Path: Delivered-To: svn-src-vendor@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 B722ECBF5FF; Tue, 24 Jan 2017 19:18:18 +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 6BEFFBEC; Tue, 24 Jan 2017 19:18:18 +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 v0OJIHXc072452; Tue, 24 Jan 2017 19:18:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIH9l072450; Tue, 24 Jan 2017 19:18:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIH9l072450@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312709 - vendor/libc++/dist/include X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:18 -0000 Author: dim Date: Tue Jan 24 19:18:17 2017 New Revision: 312709 URL: https://svnweb.freebsd.org/changeset/base/312709 Log: Vendor import of libc++ release_40 branch r292951: https://llvm.org/svn/llvm-project/libcxx/branches/release_40@292951 Modified: vendor/libc++/dist/include/__config vendor/libc++/dist/include/string Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Tue Jan 24 19:18:12 2017 (r312708) +++ vendor/libc++/dist/include/__config Tue Jan 24 19:18:17 2017 (r312709) @@ -103,6 +103,9 @@ #if defined(__clang__) #define _LIBCPP_COMPILER_CLANG +# ifndef __apple_build_version__ +# define _LIBCPP_CLANG_VER (__clang_major__ * 100 + __clang_minor__) +# endif #elif defined(__GNUC__) #define _LIBCPP_COMPILER_GCC #elif defined(_MSC_VER) @@ -111,6 +114,10 @@ #define _LIBCPP_COMPILER_IBM #endif +#ifndef _LIBCPP_CLANG_VER +# define _LIBCPP_CLANG_VER 0 +#endif + // FIXME: ABI detection should be done via compiler builtin macros. This // is just a placeholder until Clang implements such macros. For now assume // that Windows compilers pretending to be MSVC++ target the microsoft ABI. @@ -741,7 +748,7 @@ template struct __static_asse #ifdef _LIBCPP_HAS_NO_DECLTYPE // GCC 4.6 provides __decltype in all standard modes. -#if !__is_identifier(__decltype) || _GNUC_VER >= 406 +#if !__is_identifier(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406 # define decltype(__x) __decltype(__x) #else # define decltype(__x) __typeof__(__x) @@ -838,7 +845,7 @@ template struct __static_asse #if defined(__APPLE__) # if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && \ defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIROMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ +# define __MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ # endif # if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) # if __MAC_OS_X_VERSION_MIN_REQUIRED < 1060 Modified: vendor/libc++/dist/include/string ============================================================================== --- vendor/libc++/dist/include/string Tue Jan 24 19:18:12 2017 (r312708) +++ vendor/libc++/dist/include/string Tue Jan 24 19:18:17 2017 (r312709) @@ -818,7 +818,10 @@ public: operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } basic_string& operator=(const basic_string& __str); + +#ifndef _LIBCPP_CXX03_LANG template +#endif _LIBCPP_INLINE_VISIBILITY basic_string& operator=(__self_view __sv) {return assign(__sv);} #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:28 2017 Return-Path: Delivered-To: svn-src-vendor@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 A72C1CBF6DD; Tue, 24 Jan 2017 19:18:28 +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 5C272D2A; Tue, 24 Jan 2017 19:18:28 +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 v0OJIRcR072593; Tue, 24 Jan 2017 19:18:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJIRDL072592; Tue, 24 Jan 2017 19:18:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJIRDL072592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312712 - vendor/lldb/lldb-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:28 -0000 Author: dim Date: Tue Jan 24 19:18:27 2017 New Revision: 312712 URL: https://svnweb.freebsd.org/changeset/base/312712 Log: Tag lldb release_40 branch r292951. Added: vendor/lldb/lldb-release_40-r292951/ - copied from r312711, vendor/lldb/dist/ From owner-svn-src-vendor@freebsd.org Tue Jan 24 19:18:25 2017 Return-Path: Delivered-To: svn-src-vendor@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 08C77CBF68F; Tue, 24 Jan 2017 19:18:25 +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 B2781CB5; Tue, 24 Jan 2017 19:18:24 +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 v0OJINWs072547; Tue, 24 Jan 2017 19:18:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0OJINBJ072546; Tue, 24 Jan 2017 19:18:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201701241918.v0OJINBJ072546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 24 Jan 2017 19:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312711 - vendor/lld/lld-release_40-r292951 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2017 19:18:25 -0000 Author: dim Date: Tue Jan 24 19:18:23 2017 New Revision: 312711 URL: https://svnweb.freebsd.org/changeset/base/312711 Log: Tag lld release_40 branch r292951. Added: vendor/lld/lld-release_40-r292951/ - copied from r312710, vendor/lld/dist/ From owner-svn-src-vendor@freebsd.org Thu Jan 26 18:32:16 2017 Return-Path: Delivered-To: svn-src-vendor@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 A6E20CC35F5; Thu, 26 Jan 2017 18:32:16 +0000 (UTC) (envelope-from jkim@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 4500ABA5; Thu, 26 Jan 2017 18:32:16 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QIWFr0042934; Thu, 26 Jan 2017 18:32:15 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QIWCt1042905; Thu, 26 Jan 2017 18:32:12 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701261832.v0QIWCt1042905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 18:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312823 - in vendor-crypto/openssl/dist: . apps crypto crypto/aes/asm crypto/asn1 crypto/bn crypto/bn/asm crypto/cms crypto/dh crypto/dsa crypto/ec crypto/ecdh crypto/err crypto/evp cry... X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 18:32:16 -0000 Author: jkim Date: Thu Jan 26 18:32:12 2017 New Revision: 312823 URL: https://svnweb.freebsd.org/changeset/base/312823 Log: Import OpenSSL 1.0.2k. Modified: vendor-crypto/openssl/dist/CHANGES vendor-crypto/openssl/dist/CONTRIBUTING vendor-crypto/openssl/dist/Configure vendor-crypto/openssl/dist/INSTALL vendor-crypto/openssl/dist/Makefile vendor-crypto/openssl/dist/Makefile.org vendor-crypto/openssl/dist/NEWS vendor-crypto/openssl/dist/README vendor-crypto/openssl/dist/apps/apps.c vendor-crypto/openssl/dist/apps/apps.h vendor-crypto/openssl/dist/apps/ca.c vendor-crypto/openssl/dist/apps/cms.c vendor-crypto/openssl/dist/apps/dgst.c vendor-crypto/openssl/dist/apps/dh.c vendor-crypto/openssl/dist/apps/dhparam.c vendor-crypto/openssl/dist/apps/dsa.c vendor-crypto/openssl/dist/apps/dsaparam.c vendor-crypto/openssl/dist/apps/ec.c vendor-crypto/openssl/dist/apps/ecparam.c vendor-crypto/openssl/dist/apps/enc.c vendor-crypto/openssl/dist/apps/gendh.c vendor-crypto/openssl/dist/apps/gendsa.c vendor-crypto/openssl/dist/apps/genpkey.c vendor-crypto/openssl/dist/apps/genrsa.c vendor-crypto/openssl/dist/apps/pkcs12.c vendor-crypto/openssl/dist/apps/pkcs7.c vendor-crypto/openssl/dist/apps/pkcs8.c vendor-crypto/openssl/dist/apps/pkey.c vendor-crypto/openssl/dist/apps/pkeyparam.c vendor-crypto/openssl/dist/apps/pkeyutl.c vendor-crypto/openssl/dist/apps/prime.c vendor-crypto/openssl/dist/apps/rand.c vendor-crypto/openssl/dist/apps/req.c vendor-crypto/openssl/dist/apps/rsa.c vendor-crypto/openssl/dist/apps/rsautl.c vendor-crypto/openssl/dist/apps/s_cb.c vendor-crypto/openssl/dist/apps/s_client.c vendor-crypto/openssl/dist/apps/s_server.c vendor-crypto/openssl/dist/apps/smime.c vendor-crypto/openssl/dist/apps/speed.c vendor-crypto/openssl/dist/apps/spkac.c vendor-crypto/openssl/dist/apps/srp.c vendor-crypto/openssl/dist/apps/verify.c vendor-crypto/openssl/dist/apps/x509.c vendor-crypto/openssl/dist/crypto/aes/asm/aes-s390x.pl vendor-crypto/openssl/dist/crypto/asn1/p5_pbev2.c vendor-crypto/openssl/dist/crypto/asn1/x_crl.c vendor-crypto/openssl/dist/crypto/bn/asm/x86_64-mont.pl vendor-crypto/openssl/dist/crypto/bn/asm/x86_64-mont5.pl vendor-crypto/openssl/dist/crypto/bn/bn_exp.c vendor-crypto/openssl/dist/crypto/bn/bn_mul.c vendor-crypto/openssl/dist/crypto/bn/bn_prime.c vendor-crypto/openssl/dist/crypto/bn/bn_sqr.c vendor-crypto/openssl/dist/crypto/cms/cms_kari.c vendor-crypto/openssl/dist/crypto/dh/dh_key.c vendor-crypto/openssl/dist/crypto/dsa/dsa_pmeth.c vendor-crypto/openssl/dist/crypto/ec/ec2_mult.c vendor-crypto/openssl/dist/crypto/ecdh/ech_ossl.c vendor-crypto/openssl/dist/crypto/err/err.c vendor-crypto/openssl/dist/crypto/evp/e_aes.c vendor-crypto/openssl/dist/crypto/evp/e_rc4_hmac_md5.c vendor-crypto/openssl/dist/crypto/evp/evp.h vendor-crypto/openssl/dist/crypto/evp/evp_err.c vendor-crypto/openssl/dist/crypto/evp/pmeth_fn.c vendor-crypto/openssl/dist/crypto/evp/pmeth_lib.c vendor-crypto/openssl/dist/crypto/modes/ctr128.c vendor-crypto/openssl/dist/crypto/opensslv.h vendor-crypto/openssl/dist/crypto/perlasm/x86_64-xlate.pl vendor-crypto/openssl/dist/crypto/rsa/rsa_gen.c vendor-crypto/openssl/dist/crypto/rsa/rsa_oaep.c vendor-crypto/openssl/dist/crypto/rsa/rsa_pmeth.c vendor-crypto/openssl/dist/crypto/s390xcap.c vendor-crypto/openssl/dist/crypto/ui/ui_lib.c vendor-crypto/openssl/dist/crypto/ui/ui_openssl.c vendor-crypto/openssl/dist/doc/apps/ocsp.pod vendor-crypto/openssl/dist/doc/crypto/EVP_DigestSignInit.pod vendor-crypto/openssl/dist/doc/crypto/EVP_DigestVerifyInit.pod vendor-crypto/openssl/dist/doc/crypto/RSA_generate_key.pod vendor-crypto/openssl/dist/doc/crypto/X509_NAME_get_index_by_NID.pod vendor-crypto/openssl/dist/doc/crypto/X509_NAME_print_ex.pod vendor-crypto/openssl/dist/doc/ssl/SSL_CTX_set_session_cache_mode.pod vendor-crypto/openssl/dist/doc/ssl/SSL_get_error.pod vendor-crypto/openssl/dist/doc/ssl/SSL_read.pod vendor-crypto/openssl/dist/doc/ssl/SSL_write.pod vendor-crypto/openssl/dist/engines/ccgost/Makefile vendor-crypto/openssl/dist/ssl/bad_dtls_test.c vendor-crypto/openssl/dist/ssl/s23_pkt.c vendor-crypto/openssl/dist/ssl/s2_lib.c vendor-crypto/openssl/dist/ssl/s2_pkt.c vendor-crypto/openssl/dist/ssl/s3_clnt.c vendor-crypto/openssl/dist/ssl/s3_pkt.c vendor-crypto/openssl/dist/ssl/s3_srvr.c vendor-crypto/openssl/dist/ssl/ssl_cert.c vendor-crypto/openssl/dist/ssl/ssl_err.c vendor-crypto/openssl/dist/ssl/ssl_lib.c vendor-crypto/openssl/dist/ssl/ssl_locl.h vendor-crypto/openssl/dist/ssl/ssl_sess.c vendor-crypto/openssl/dist/ssl/t1_lib.c vendor-crypto/openssl/dist/util/domd vendor-crypto/openssl/dist/util/mklink.pl Modified: vendor-crypto/openssl/dist/CHANGES ============================================================================== --- vendor-crypto/openssl/dist/CHANGES Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/CHANGES Thu Jan 26 18:32:12 2017 (r312823) @@ -2,6 +2,67 @@ OpenSSL CHANGES _______________ + Changes between 1.0.2j and 1.0.2k [26 Jan 2017] + + *) Truncated packet could crash via OOB read + + If one side of an SSL/TLS path is running on a 32-bit host and a specific + cipher is being used, then a truncated packet can cause that host to + perform an out-of-bounds read, usually resulting in a crash. + + This issue was reported to OpenSSL by Robert Święcki of Google. + (CVE-2017-3731) + [Andy Polyakov] + + *) BN_mod_exp may produce incorrect results on x86_64 + + There is a carry propagating bug in the x86_64 Montgomery squaring + procedure. No EC algorithms are affected. Analysis suggests that attacks + against RSA and DSA as a result of this defect would be very difficult to + perform and are not believed likely. Attacks against DH are considered just + feasible (although very difficult) because most of the work necessary to + deduce information about a private key may be performed offline. The amount + of resources required for such an attack would be very significant and + likely only accessible to a limited number of attackers. An attacker would + additionally need online access to an unpatched system using the target + private key in a scenario with persistent DH parameters and a private + key that is shared between multiple clients. For example this can occur by + default in OpenSSL DHE based SSL/TLS ciphersuites. Note: This issue is very + similar to CVE-2015-3193 but must be treated as a separate problem. + + This issue was reported to OpenSSL by the OSS-Fuzz project. + (CVE-2017-3732) + [Andy Polyakov] + + *) Montgomery multiplication may produce incorrect results + + There is a carry propagating bug in the Broadwell-specific Montgomery + multiplication procedure that handles input lengths divisible by, but + longer than 256 bits. Analysis suggests that attacks against RSA, DSA + and DH private keys are impossible. This is because the subroutine in + question is not used in operations with the private key itself and an input + of the attacker's direct choice. Otherwise the bug can manifest itself as + transient authentication and key negotiation failures or reproducible + erroneous outcome of public-key operations with specially crafted input. + Among EC algorithms only Brainpool P-512 curves are affected and one + presumably can attack ECDH key negotiation. Impact was not analyzed in + detail, because pre-requisites for attack are considered unlikely. Namely + multiple clients have to choose the curve in question and the server has to + share the private key among them, neither of which is default behaviour. + Even then only clients that chose the curve will be affected. + + This issue was publicly reported as transient failures and was not + initially recognized as a security issue. Thanks to Richard Morgan for + providing reproducible case. + (CVE-2016-7055) + [Andy Polyakov] + + *) OpenSSL now fails if it receives an unrecognised record type in TLS1.0 + or TLS1.1. Previously this only happened in SSLv3 and TLS1.2. This is to + prevent issues where no progress is being made and the peer continually + sends unrecognised record types, using up resources processing them. + [Matt Caswell] + Changes between 1.0.2i and 1.0.2j [26 Sep 2016] *) Missing CRL sanity check Modified: vendor-crypto/openssl/dist/CONTRIBUTING ============================================================================== --- vendor-crypto/openssl/dist/CONTRIBUTING Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/CONTRIBUTING Thu Jan 26 18:32:12 2017 (r312823) @@ -1,4 +1,4 @@ -HOW TO CONTRIBUTE TO PATCHES OpenSSL +HOW TO CONTRIBUTE PATCHES TO OpenSSL ------------------------------------ (Please visit https://www.openssl.org/community/getting-started.html for @@ -11,34 +11,12 @@ OpenSSL community you might want to disc list first. Someone may be already working on the same thing or there may be a good reason as to why that feature isn't implemented. -The best way to submit a patch is to make a pull request on GitHub. -(It is not necessary to send mail to rt@openssl.org to open a ticket!) -If you think the patch could use feedback from the community, please -start a thread on openssl-dev. - -You can also submit patches by sending it as mail to rt@openssl.org. -Please include the word "PATCH" and an explanation of what the patch -does in the subject line. If you do this, our preferred format is "git -format-patch" output. For example to provide a patch file containing the -last commit in your local git repository use the following command: - - % git format-patch --stdout HEAD^ >mydiffs.patch - -Another method of creating an acceptable patch file without using git is as -follows: - - % cd openssl-work - ...make your changes... - % ./Configure dist; make clean - % cd .. - % diff -ur openssl-orig openssl-work >mydiffs.patch - -Note that pull requests are generally easier for the team, and community, to -work with. Pull requests benefit from all of the standard GitHub features, -including code review tools, simpler integration, and CI build support. +To submit a patch, make a pull request on GitHub. If you think the patch +could use feedback from the community, please start a thread on openssl-dev +to discuss it. -No matter how a patch is submitted, the following items will help make -the acceptance and review process faster: +Having addressed the following items before the PR will help make the +acceptance and review process faster: 1. Anything other than trivial contributions will require a contributor licensing agreement, giving us permission to use your code. See @@ -55,21 +33,22 @@ the acceptance and review process faster in the file LICENSE in the source distribution or at https://www.openssl.org/source/license.html - 3. Patches should be as current as possible. When using GitHub, please - expect to have to rebase and update often. Note that we do not accept merge - commits. You will be asked to remove them before a patch is considered - acceptable. + 3. Patches should be as current as possible; expect to have to rebase + often. We do not accept merge commits; You will be asked to remove + them before a patch is considered acceptable. 4. Patches should follow our coding style (see https://www.openssl.org/policies/codingstyle.html) and compile without warnings. Where gcc or clang is availble you should use the --strict-warnings Configure option. OpenSSL compiles on many varied platforms: try to ensure you only use portable features. + Clean builds via Travis and AppVeyor are expected, and done whenever + a PR is created or updated. - 5. When at all possible, patches should include tests. These can either be - added to an existing test, or completely new. Please see test/README - for information on the test framework. - - 6. New features or changed functionality must include documentation. Please - look at the "pod" files in doc/apps, doc/crypto and doc/ssl for examples of - our style. + 5. When at all possible, patches should include tests. These can + either be added to an existing test, or completely new. Please see + test/README for information on the test framework. + + 6. New features or changed functionality must include + documentation. Please look at the "pod" files in doc/apps, doc/crypto + and doc/ssl for examples of our style. Modified: vendor-crypto/openssl/dist/Configure ============================================================================== --- vendor-crypto/openssl/dist/Configure Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/Configure Thu Jan 26 18:32:12 2017 (r312823) @@ -7,6 +7,7 @@ eval 'exec perl -S $0 ${1+"$@"}' require 5.000; use strict; +use File::Compare; # see INSTALL for instructions. @@ -57,12 +58,13 @@ my $usage="Usage: Configure [no- # zlib-dynamic Like "zlib", but the zlib library is expected to be a shared # library and will be loaded in run-time by the OpenSSL library. # sctp include SCTP support -# 386 generate 80386 code # enable-weak-ssl-ciphers # Enable EXPORT and LOW SSLv3 ciphers that are disabled by # default. Note, weak SSLv2 ciphers are unconditionally # disabled. -# no-sse2 disables IA-32 SSE2 code, above option implies no-sse2 +# 386 generate 80386 code in assembly modules +# no-sse2 disables IA-32 SSE2 code in assembly modules, the above +# mentioned '386' option implies this one # no- build without specified algorithm (rsa, idea, rc5, ...) # - + compiler options are passed through # @@ -1792,8 +1794,16 @@ while () } close(IN); close(OUT); -rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; -rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; +if ((compare($Makefile, "$Makefile.new")) + or file_newer('Configure', $Makefile) + or file_newer('config', $Makefile) + or file_newer('Makefile.org', $Makefile)) + { + rename($Makefile,"$Makefile.bak") || die "unable to rename $Makefile\n" if -e $Makefile; + rename("$Makefile.new",$Makefile) || die "unable to rename $Makefile.new\n"; + } +else + { unlink("$Makefile.new"); } print "CC =$cc\n"; print "CFLAG =$cflags\n"; @@ -1985,9 +1995,13 @@ print OUT "#ifdef __cplusplus\n"; print OUT "}\n"; print OUT "#endif\n"; close(OUT); -rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; -rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; - +if (compare("crypto/opensslconf.h.new","crypto/opensslconf.h")) + { + rename("crypto/opensslconf.h","crypto/opensslconf.h.bak") || die "unable to rename crypto/opensslconf.h\n" if -e "crypto/opensslconf.h"; + rename("crypto/opensslconf.h.new","crypto/opensslconf.h") || die "unable to rename crypto/opensslconf.h.new\n"; + } +else + { unlink("crypto/opensslconf.h.new"); } # Fix the date @@ -2289,3 +2303,9 @@ sub test_sanity print STDERR "No sanity errors detected!\n" if $errorcnt == 0; return $errorcnt; } + +sub file_newer + { + my ($file1, $file2) = @_; + return (stat($file1))[9] > (stat($file2))[9] + } Modified: vendor-crypto/openssl/dist/INSTALL ============================================================================== --- vendor-crypto/openssl/dist/INSTALL Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/INSTALL Thu Jan 26 18:32:12 2017 (r312823) @@ -74,24 +74,26 @@ no-asm Do not use assembler code. - 386 Use the 80386 instruction set only (the default x86 code is - more efficient, but requires at least a 486). Note: Use - compiler flags for any other CPU specific configuration, - e.g. "-m32" to build x86 code on an x64 system. - - no-sse2 Exclude SSE2 code pathes. Normally SSE2 extention is - detected at run-time, but the decision whether or not the - machine code will be executed is taken solely on CPU - capability vector. This means that if you happen to run OS - kernel which does not support SSE2 extension on Intel P4 - processor, then your application might be exposed to - "illegal instruction" exception. There might be a way - to enable support in kernel, e.g. FreeBSD kernel can be - compiled with CPU_ENABLE_SSE, and there is a way to - disengage SSE2 code pathes upon application start-up, - but if you aim for wider "audience" running such kernel, - consider no-sse2. Both 386 and no-asm options above imply - no-sse2. + 386 In 32-bit x86 builds, when generating assembly modules, + use the 80386 instruction set only (the default x86 code + is more efficient, but requires at least a 486). Note: + This doesn't affect code generated by compiler, you're + likely to complement configuration command line with + suitable compiler-specific option. + + no-sse2 Exclude SSE2 code paths from 32-bit x86 assembly modules. + Normally SSE2 extension is detected at run-time, but the + decision whether or not the machine code will be executed + is taken solely on CPU capability vector. This means that + if you happen to run OS kernel which does not support SSE2 + extension on Intel P4 processor, then your application + might be exposed to "illegal instruction" exception. + There might be a way to enable support in kernel, e.g. + FreeBSD kernel can be compiled with CPU_ENABLE_SSE, and + there is a way to disengage SSE2 code paths upon application + start-up, but if you aim for wider "audience" running + such kernel, consider no-sse2. Both the 386 and + no-asm options imply no-sse2. no- Build without the specified cipher (bf, cast, des, dh, dsa, hmac, md2, md5, mdc2, rc2, rc4, rc5, rsa, sha). @@ -101,7 +103,12 @@ -Dxxx, -lxxx, -Lxxx, -fxxx, -mXXX, -Kxxx These system specific options will be passed through to the compiler to allow you to define preprocessor symbols, specify additional libraries, - library directories or other compiler options. + library directories or other compiler options. It might be + worth noting that some compilers generate code specifically + for processor the compiler currently executes on. This is + not necessarily what you might have in mind, since it might + be unsuitable for execution on other, typically older, + processor. Consult your compiler documentation. -DHAVE_CRYPTODEV Enable the BSD cryptodev engine even if we are not using BSD. Useful if you are running ocf-linux or something @@ -159,18 +166,18 @@ OpenSSL binary ("openssl"). The libraries will be built in the top-level directory, and the binary will be in the "apps" directory. - If "make" fails, look at the output. There may be reasons for - the failure that aren't problems in OpenSSL itself (like missing - standard headers). If it is a problem with OpenSSL itself, please - report the problem to (note that your - message will be recorded in the request tracker publicly readable - at https://www.openssl.org/community/index.html#bugs and will be - forwarded to a public mailing list). Include the output of "make - report" in your message. Please check out the request tracker. Maybe - the bug was already reported or has already been fixed. + If the build fails, look at the output. There may be reasons + for the failure that aren't problems in OpenSSL itself (like + missing standard headers). If you are having problems you can + get help by sending an email to the openssl-users email list (see + https://www.openssl.org/community/mailinglists.html for details). If + it is a bug with OpenSSL itself, please open an issue on GitHub, at + https://github.com/openssl/openssl/issues. Please review the existing + ones first; maybe the bug was already reported or has already been + fixed. - [If you encounter assembler error messages, try the "no-asm" - configuration option as an immediate fix.] + (If you encounter assembler error messages, try the "no-asm" + configuration option as an immediate fix.) Compiling parts of OpenSSL with gcc and others with the system compiler will result in unresolved symbols on some systems. Modified: vendor-crypto/openssl/dist/Makefile ============================================================================== --- vendor-crypto/openssl/dist/Makefile Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/Makefile Thu Jan 26 18:32:12 2017 (r312823) @@ -4,7 +4,7 @@ ## Makefile for OpenSSL ## -VERSION=1.0.2j +VERSION=1.0.2k MAJOR=1 MINOR=0.2 SHLIB_VERSION_NUMBER=1.0.0 @@ -203,7 +203,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: vendor-crypto/openssl/dist/Makefile.org ============================================================================== --- vendor-crypto/openssl/dist/Makefile.org Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/Makefile.org Thu Jan 26 18:32:12 2017 (r312823) @@ -201,7 +201,8 @@ CLEARENV= TOP= && unset TOP $${LIB+LIB} $${ASFLAGS+ASFLAGS} $${AFLAGS+AFLAGS} \ $${LDCMD+LDCMD} $${LDFLAGS+LDFLAGS} $${SCRIPTS+SCRIPTS} \ $${SHAREDCMD+SHAREDCMD} $${SHAREDFLAGS+SHAREDFLAGS} \ - $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} + $${SHARED_LIB+SHARED_LIB} $${LIBEXTRAS+LIBEXTRAS} \ + $${APPS+APPS} # LC_ALL=C ensures that error [and other] messages are delivered in # same language for uniform treatment. Modified: vendor-crypto/openssl/dist/NEWS ============================================================================== --- vendor-crypto/openssl/dist/NEWS Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/NEWS Thu Jan 26 18:32:12 2017 (r312823) @@ -5,9 +5,15 @@ This file gives a brief overview of the major changes between each OpenSSL release. For more details please read the CHANGES file. + Major changes between OpenSSL 1.0.2j and OpenSSL 1.0.2k [26 Jan 2017] + + o Truncated packet could crash via OOB read (CVE-2017-3731) + o BN_mod_exp may produce incorrect results on x86_64 (CVE-2017-3732) + o Montgomery multiplication may produce incorrect results (CVE-2016-7055) + Major changes between OpenSSL 1.0.2i and OpenSSL 1.0.2j [26 Sep 2016] - o Fix Use After Free for large message sizes (CVE-2016-6309) + o Missing CRL sanity check (CVE-2016-7052) Major changes between OpenSSL 1.0.2h and OpenSSL 1.0.2i [22 Sep 2016] Modified: vendor-crypto/openssl/dist/README ============================================================================== --- vendor-crypto/openssl/dist/README Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/README Thu Jan 26 18:32:12 2017 (r312823) @@ -1,5 +1,5 @@ - OpenSSL 1.0.2j 26 Sep 2016 + OpenSSL 1.0.2k 26 Jan 2017 Copyright (c) 1998-2015 The OpenSSL Project Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson @@ -66,13 +66,13 @@ If you have any problems with OpenSSL then please take the following steps first: - - Download the current snapshot from ftp://ftp.openssl.org/snapshot/ + - Download the latest version from the repository to see if the problem has already been addressed - - Remove ASM versions of libraries + - Configure with no-asm - Remove compiler optimisation flags - If you wish to report a bug then please include the following information in - any bug report: + If you wish to report a bug then please include the following information + and create an issue on GitHub: - On Unix systems: Self-test report generated by 'make report' @@ -84,27 +84,9 @@ - Problem Description (steps that will reproduce the problem, if known) - Stack Traceback (if the application dumps core) - Email the report to: - - rt@openssl.org - - In order to avoid spam, this is a moderated mailing list, and it might - take a day for the ticket to show up. (We also scan posts to make sure - that security disclosures aren't publically posted by mistake.) Mail - to this address is recorded in the public RT (request tracker) database - (see https://www.openssl.org/community/index.html#bugs for details) and - also forwarded the public openssl-dev mailing list. Confidential mail - may be sent to openssl-security@openssl.org (PGP key available from the - key servers). - - Please do NOT use this for general assistance or support queries. Just because something doesn't work the way you expect does not mean it is necessarily a bug in OpenSSL. - You can also make GitHub pull requests. If you do this, please also send - mail to rt@openssl.org with a link to the PR so that we can more easily - keep track of it. - HOW TO CONTRIBUTE TO OpenSSL ---------------------------- @@ -113,7 +95,7 @@ LEGALITIES ---------- - A number of nations, in particular the U.S., restrict the use or export - of cryptography. If you are potentially subject to such restrictions - you should seek competent professional legal advice before attempting to - develop or distribute cryptographic code. + A number of nations restrict the use or export of cryptography. If you + are potentially subject to such restrictions you should seek competent + professional legal advice before attempting to develop or distribute + cryptographic code. Modified: vendor-crypto/openssl/dist/apps/apps.c ============================================================================== --- vendor-crypto/openssl/dist/apps/apps.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/apps.c Thu Jan 26 18:32:12 2017 (r312823) @@ -972,7 +972,10 @@ EVP_PKEY *load_key(BIO *err, const char if (!e) BIO_printf(err, "no engine specified\n"); else { - pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + if (ENGINE_init(e)) { + pkey = ENGINE_load_private_key(e, file, ui_method, &cb_data); + ENGINE_finish(e); + } if (!pkey) { BIO_printf(err, "cannot load %s from engine\n", key_descrip); ERR_print_errors(err); @@ -1532,11 +1535,13 @@ static ENGINE *try_load_engine(BIO *err, } return e; } +#endif ENGINE *setup_engine(BIO *err, const char *engine, int debug) { ENGINE *e = NULL; +#ifndef OPENSSL_NO_ENGINE if (engine) { if (strcmp(engine, "auto") == 0) { BIO_printf(err, "enabling auto ENGINE support\n"); @@ -1561,13 +1566,19 @@ ENGINE *setup_engine(BIO *err, const cha } BIO_printf(err, "engine \"%s\" set.\n", ENGINE_get_id(e)); - - /* Free our "structural" reference. */ - ENGINE_free(e); } +#endif return e; } + +void release_engine(ENGINE *e) +{ +#ifndef OPENSSL_NO_ENGINE + if (e != NULL) + /* Free our "structural" reference. */ + ENGINE_free(e); #endif +} int load_config(BIO *err, CONF *cnf) { Modified: vendor-crypto/openssl/dist/apps/apps.h ============================================================================== --- vendor-crypto/openssl/dist/apps/apps.h Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/apps.h Thu Jan 26 18:32:12 2017 (r312823) @@ -259,9 +259,9 @@ STACK_OF(X509_CRL) *load_crls(BIO *err, const char *pass, ENGINE *e, const char *cert_descrip); X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath); -# ifndef OPENSSL_NO_ENGINE + ENGINE *setup_engine(BIO *err, const char *engine, int debug); -# endif +void release_engine(ENGINE *e); # ifndef OPENSSL_NO_OCSP OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req, Modified: vendor-crypto/openssl/dist/apps/ca.c ============================================================================== --- vendor-crypto/openssl/dist/apps/ca.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/ca.c Thu Jan 26 18:32:12 2017 (r312823) @@ -319,9 +319,7 @@ int MAIN(int argc, char **argv) #define BSIZE 256 MS_STATIC char buf[3][BSIZE]; char *randfile = NULL; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif char *tofree = NULL; DB_ATTR db_attr; @@ -595,9 +593,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, conf)) goto err; -#ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -#endif /* Lets get the config section we are using */ if (section == NULL) { @@ -1485,6 +1481,7 @@ int MAIN(int argc, char **argv) X509_CRL_free(crl); NCONF_free(conf); NCONF_free(extconf); + release_engine(e); OBJ_cleanup(); apps_shutdown(); OPENSSL_EXIT(ret); @@ -2227,7 +2224,6 @@ static int certify_spkac(X509 **xret, ch sk = CONF_get_section(parms, "default"); if (sk_CONF_VALUE_num(sk) == 0) { BIO_printf(bio_err, "no name/value pairs found in %s\n", infile); - CONF_free(parms); goto err; } Modified: vendor-crypto/openssl/dist/apps/cms.c ============================================================================== --- vendor-crypto/openssl/dist/apps/cms.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/cms.c Thu Jan 26 18:32:12 2017 (r312823) @@ -143,9 +143,7 @@ int MAIN(int argc, char **argv) const EVP_MD *sign_md = NULL; int informat = FORMAT_SMIME, outformat = FORMAT_SMIME; int rctformat = FORMAT_SMIME, keyform = FORMAT_PEM; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif unsigned char *secret_key = NULL, *secret_keyid = NULL; unsigned char *pwri_pass = NULL, *pwri_tmp = NULL; size_t secret_keylen = 0, secret_keyidlen = 0; @@ -665,9 +663,7 @@ int MAIN(int argc, char **argv) "cert.pem recipient certificate(s) for encryption\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); @@ -1170,6 +1166,7 @@ int MAIN(int argc, char **argv) EVP_PKEY_free(key); CMS_ContentInfo_free(cms); CMS_ContentInfo_free(rcms); + release_engine(e); BIO_free(rctin); BIO_free(in); BIO_free(indata); Modified: vendor-crypto/openssl/dist/apps/dgst.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dgst.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dgst.c Thu Jan 26 18:32:12 2017 (r312823) @@ -537,6 +537,7 @@ int MAIN(int argc, char **argv) OPENSSL_free(sigbuf); if (bmd != NULL) BIO_free(bmd); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(err); } Modified: vendor-crypto/openssl/dist/apps/dh.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dh.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dh.c Thu Jan 26 18:32:12 2017 (r312823) @@ -94,9 +94,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif apps_startup(); @@ -107,9 +105,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -183,9 +179,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); Modified: vendor-crypto/openssl/dist/apps/dhparam.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dhparam.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dhparam.c Thu Jan 26 18:32:12 2017 (r312823) @@ -159,9 +159,8 @@ int MAIN(int argc, char **argv) int informat, outformat, check = 0, noout = 0, C = 0, ret = 1; char *infile, *outfile, *prog; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; int num = 0, g = 0; apps_startup(); @@ -270,9 +269,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (g && !num) num = DEFBITS; @@ -512,6 +509,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dh != NULL) DH_free(dh); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: vendor-crypto/openssl/dist/apps/dsa.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dsa.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dsa.c Thu Jan 26 18:32:12 2017 (r312823) @@ -106,9 +106,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0; char *infile, *outfile, *prog; -# ifndef OPENSSL_NO_ENGINE char *engine; -# endif char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; int modulus = 0; @@ -124,9 +122,7 @@ int MAIN(int argc, char **argv) if (!load_config(bio_err, NULL)) goto end; -# ifndef OPENSSL_NO_ENGINE engine = NULL; -# endif infile = NULL; outfile = NULL; informat = FORMAT_PEM; @@ -239,9 +235,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -358,6 +352,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: vendor-crypto/openssl/dist/apps/dsaparam.c ============================================================================== --- vendor-crypto/openssl/dist/apps/dsaparam.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/dsaparam.c Thu Jan 26 18:32:12 2017 (r312823) @@ -121,9 +121,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog, *inrand = NULL; int numbits = -1, num, genkey = 0; int need_rand = 0; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; # ifdef GENCB_TEST int timebomb = 0; # endif @@ -263,9 +262,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (need_rand) { app_RAND_load_file(NULL, bio_err, (inrand != NULL)); @@ -433,6 +430,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: vendor-crypto/openssl/dist/apps/ec.c ============================================================================== --- vendor-crypto/openssl/dist/apps/ec.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/ec.c Thu Jan 26 18:32:12 2017 (r312823) @@ -95,6 +95,7 @@ int MAIN(int argc, char **argv) int informat, outformat, text = 0, noout = 0; int pubin = 0, pubout = 0, param_out = 0; char *infile, *outfile, *prog, *engine; + ENGINE *e = NULL; char *passargin = NULL, *passargout = NULL; char *passin = NULL, *passout = NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; @@ -235,9 +236,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { BIO_printf(bio_err, "Error getting passwords\n"); @@ -349,6 +348,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (eckey) EC_KEY_free(eckey); + release_engine(e); if (passin) OPENSSL_free(passin); if (passout) Modified: vendor-crypto/openssl/dist/apps/ecparam.c ============================================================================== --- vendor-crypto/openssl/dist/apps/ecparam.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/ecparam.c Thu Jan 26 18:32:12 2017 (r312823) @@ -131,6 +131,7 @@ int MAIN(int argc, char **argv) BIO *in = NULL, *out = NULL; int informat, outformat, noout = 0, C = 0, ret = 1; char *engine = NULL; + ENGINE *e = NULL; BIGNUM *ec_p = NULL, *ec_a = NULL, *ec_b = NULL, *ec_gen = NULL, *ec_order = NULL, *ec_cofactor = NULL; @@ -311,9 +312,7 @@ int MAIN(int argc, char **argv) } } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (list_curves) { EC_builtin_curve *curves = NULL; @@ -620,12 +619,13 @@ int MAIN(int argc, char **argv) BN_free(ec_cofactor); if (buffer) OPENSSL_free(buffer); + if (group != NULL) + EC_GROUP_free(group); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) BIO_free_all(out); - if (group != NULL) - EC_GROUP_free(group); apps_shutdown(); OPENSSL_EXIT(ret); } Modified: vendor-crypto/openssl/dist/apps/enc.c ============================================================================== --- vendor-crypto/openssl/dist/apps/enc.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/enc.c Thu Jan 26 18:32:12 2017 (r312823) @@ -126,9 +126,8 @@ int MAIN(int argc, char **argv) NULL, *wbio = NULL; #define PROG_NAME_SIZE 39 char pname[PROG_NAME_SIZE + 1]; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; const EVP_MD *dgst = NULL; int non_fips_allow = 0; @@ -322,9 +321,7 @@ int MAIN(int argc, char **argv) argv++; } -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); if (cipher && EVP_CIPHER_flags(cipher) & EVP_CIPH_FLAG_AEAD_CIPHER) { BIO_printf(bio_err, @@ -674,6 +671,7 @@ int MAIN(int argc, char **argv) if (bzl != NULL) BIO_free(bzl); #endif + release_engine(e); if (pass) OPENSSL_free(pass); apps_shutdown(); Modified: vendor-crypto/openssl/dist/apps/gendh.c ============================================================================== --- vendor-crypto/openssl/dist/apps/gendh.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/gendh.c Thu Jan 26 18:32:12 2017 (r312823) @@ -96,9 +96,7 @@ int MAIN(int argc, char **argv) int g = 2; char *outfile = NULL; char *inrand = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif BIO *out = NULL; apps_startup(); @@ -162,9 +160,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, " the random number generator\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE setup_engine(bio_err, engine, 0); -# endif out = BIO_new(BIO_s_file()); if (out == NULL) { Modified: vendor-crypto/openssl/dist/apps/gendsa.c ============================================================================== --- vendor-crypto/openssl/dist/apps/gendsa.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/gendsa.c Thu Jan 26 18:32:12 2017 (r312823) @@ -85,9 +85,8 @@ int MAIN(int argc, char **argv) char *passargout = NULL, *passout = NULL; BIO *out = NULL, *in = NULL; const EVP_CIPHER *enc = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif + ENGINE *e = NULL; apps_startup(); @@ -206,9 +205,7 @@ int MAIN(int argc, char **argv) " - a DSA parameter file as generated by the dsaparam command\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -# endif + e = setup_engine(bio_err, engine, 0); if (!app_passwd(bio_err, NULL, passargout, NULL, &passout)) { BIO_printf(bio_err, "Error getting password\n"); @@ -273,6 +270,7 @@ int MAIN(int argc, char **argv) BIO_free_all(out); if (dsa != NULL) DSA_free(dsa); + release_engine(e); if (passout) OPENSSL_free(passout); apps_shutdown(); Modified: vendor-crypto/openssl/dist/apps/genpkey.c ============================================================================== --- vendor-crypto/openssl/dist/apps/genpkey.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/genpkey.c Thu Jan 26 18:32:12 2017 (r312823) @@ -275,9 +275,9 @@ int MAIN(int argc, char **argv) if (out) BIO_free_all(out); BIO_free(in); + release_engine(e); if (pass) OPENSSL_free(pass); - return ret; } Modified: vendor-crypto/openssl/dist/apps/genrsa.c ============================================================================== --- vendor-crypto/openssl/dist/apps/genrsa.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/genrsa.c Thu Jan 26 18:32:12 2017 (r312823) @@ -91,9 +91,7 @@ int MAIN(int, char **); int MAIN(int argc, char **argv) { BN_GENCB cb; -# ifndef OPENSSL_NO_ENGINE ENGINE *e = NULL; -# endif int ret = 1; int i, num = DEFBITS; long l; @@ -101,9 +99,7 @@ int MAIN(int argc, char **argv) unsigned long f4 = RSA_F4; char *outfile = NULL; char *passargout = NULL, *passout = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif char *inrand = NULL; BIO *out = NULL; BIGNUM *bn = BN_new(); @@ -240,9 +236,7 @@ int MAIN(int argc, char **argv) BIO_printf(bio_err, "Error getting password\n"); goto err; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (outfile == NULL) { BIO_set_fp(out, stdout, BIO_NOCLOSE); @@ -314,6 +308,7 @@ int MAIN(int argc, char **argv) RSA_free(rsa); if (out) BIO_free_all(out); + release_engine(e); if (passout) OPENSSL_free(passout); if (ret != 0) Modified: vendor-crypto/openssl/dist/apps/pkcs12.c ============================================================================== --- vendor-crypto/openssl/dist/apps/pkcs12.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/pkcs12.c Thu Jan 26 18:32:12 2017 (r312823) @@ -129,9 +129,7 @@ int MAIN(int argc, char **argv) char *inrand = NULL; char *macalg = NULL; char *CApath = NULL, *CAfile = NULL; -# ifndef OPENSSL_NO_ENGINE char *engine = NULL; -# endif apps_startup(); @@ -406,9 +404,7 @@ int MAIN(int argc, char **argv) "-LMK Add local machine keyset attribute to private key\n"); goto end; } -# ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); -# endif if (passarg) { if (export_cert) @@ -756,6 +752,7 @@ int MAIN(int argc, char **argv) # ifdef CRYPTO_MDEBUG CRYPTO_remove_all_info(); # endif + release_engine(e); BIO_free(in); BIO_free_all(out); if (canames) @@ -1110,4 +1107,6 @@ static int set_pbe(BIO *err, int *ppbe, return 1; } +#else +static void *dummy = &dummy; #endif Modified: vendor-crypto/openssl/dist/apps/pkcs7.c ============================================================================== --- vendor-crypto/openssl/dist/apps/pkcs7.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/pkcs7.c Thu Jan 26 18:32:12 2017 (r312823) @@ -90,9 +90,8 @@ int MAIN(int argc, char **argv) char *infile, *outfile, *prog; int print_certs = 0, text = 0, noout = 0, p7_print = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif + ENGINE *e = NULL; apps_startup(); @@ -175,9 +174,7 @@ int MAIN(int argc, char **argv) ERR_load_crypto_strings(); -#ifndef OPENSSL_NO_ENGINE - setup_engine(bio_err, engine, 0); -#endif + e = setup_engine(bio_err, engine, 0); in = BIO_new(BIO_s_file()); out = BIO_new(BIO_s_file()); @@ -303,6 +300,7 @@ int MAIN(int argc, char **argv) end: if (p7 != NULL) PKCS7_free(p7); + release_engine(e); if (in != NULL) BIO_free(in); if (out != NULL) Modified: vendor-crypto/openssl/dist/apps/pkcs8.c ============================================================================== --- vendor-crypto/openssl/dist/apps/pkcs8.c Thu Jan 26 18:18:35 2017 (r312822) +++ vendor-crypto/openssl/dist/apps/pkcs8.c Thu Jan 26 18:32:12 2017 (r312823) @@ -87,9 +87,7 @@ int MAIN(int argc, char **argv) char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; int badarg = 0; int ret = 1; -#ifndef OPENSSL_NO_ENGINE char *engine = NULL; -#endif if (bio_err == NULL) bio_err = BIO_new_fp(stderr, BIO_NOCLOSE); @@ -223,9 +221,7 @@ int MAIN(int argc, char **argv) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@freebsd.org Thu Jan 26 18:33:05 2017 Return-Path: Delivered-To: svn-src-vendor@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 64BC6CC3658; Thu, 26 Jan 2017 18:33:05 +0000 (UTC) (envelope-from jkim@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 1874CD21; Thu, 26 Jan 2017 18:33:05 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0QIX46L043026; Thu, 26 Jan 2017 18:33:04 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0QIX4hC043025; Thu, 26 Jan 2017 18:33:04 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201701261833.v0QIX4hC043025@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 26 Jan 2017 18:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r312824 - vendor-crypto/openssl/1.0.2k X-SVN-Group: vendor-crypto MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jan 2017 18:33:05 -0000 Author: jkim Date: Thu Jan 26 18:33:03 2017 New Revision: 312824 URL: https://svnweb.freebsd.org/changeset/base/312824 Log: Tag OpenSSL 1.0.2k. Added: vendor-crypto/openssl/1.0.2k/ - copied from r312823, vendor-crypto/openssl/dist/