Date: Sun, 4 Nov 2018 15:46:30 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r340125 - in projects/clang700-import: . contrib/llvm/include/llvm/Transforms/Utils contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen/AsmPrinter contrib/llvm/lib/Target/X86 contrib/llv... Message-ID: <201811041546.wA4FkUjw093988@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sun Nov 4 15:46:30 2018 New Revision: 340125 URL: https://svnweb.freebsd.org/changeset/base/340125 Log: Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch r346007 (effectively 7.0.1 rc2), resolve conflicts, and bump version numbers. PR: 230240, 230355 Modified: projects/clang700-import/ObsoleteFiles.inc projects/clang700-import/contrib/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h projects/clang700-import/contrib/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp projects/clang700-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp projects/clang700-import/contrib/llvm/lib/Target/X86/X86DomainReassignment.cpp projects/clang700-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp projects/clang700-import/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp projects/clang700-import/contrib/llvm/lib/Transforms/IPO/FunctionImport.cpp projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp projects/clang700-import/contrib/llvm/lib/Transforms/Utils/BuildLibCalls.cpp projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h projects/clang700-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td projects/clang700-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h projects/clang700-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/Driver.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp projects/clang700-import/contrib/llvm/tools/lld/COFF/Chunks.h projects/clang700-import/contrib/llvm/tools/lld/ELF/ScriptParser.cpp projects/clang700-import/contrib/llvm/tools/lld/ELF/Symbols.cpp projects/clang700-import/contrib/llvm/tools/llvm-xray/xray-account.cpp projects/clang700-import/etc/mtree/BSD.debug.dist projects/clang700-import/etc/mtree/BSD.usr.dist projects/clang700-import/lib/clang/headers/Makefile projects/clang700-import/lib/clang/include/clang/Basic/Version.inc projects/clang700-import/lib/clang/include/clang/Config/config.h projects/clang700-import/lib/clang/include/lld/Common/Version.inc projects/clang700-import/lib/clang/include/llvm/Config/config.h projects/clang700-import/lib/clang/include/llvm/Config/llvm-config.h projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h projects/clang700-import/lib/libclang_rt/Makefile.inc projects/clang700-import/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: projects/clang700-import/contrib/compiler-rt/ (props changed) projects/clang700-import/contrib/libc++/ (props changed) projects/clang700-import/contrib/llvm/ (props changed) projects/clang700-import/contrib/llvm/tools/clang/ (props changed) projects/clang700-import/contrib/llvm/tools/lld/ (props changed) projects/clang700-import/contrib/llvm/tools/lldb/ (props changed) Modified: projects/clang700-import/ObsoleteFiles.inc ============================================================================== --- projects/clang700-import/ObsoleteFiles.inc Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/ObsoleteFiles.inc Sun Nov 4 15:46:30 2018 (r340125) @@ -38,7 +38,7 @@ # xargs -n1 | sort | uniq -d; # done -# 2018mmdd: new clang import which bumps version from 6.0.1 to 7.0.0. +# 2018mmdd: new clang import which bumps version from 6.0.1 to 7.0.1. OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/allocator_interface.h OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/asan_interface.h OLD_FILES+=usr/lib/clang/6.0.1/include/sanitizer/common_interface_defs.h Modified: projects/clang700-import/contrib/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h ============================================================================== --- projects/clang700-import/contrib/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h Sun Nov 4 15:46:30 2018 (r340125) @@ -29,6 +29,7 @@ namespace llvm { /// /// Returns true if any attributes were set and false otherwise. bool inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI); + bool inferLibFuncAttributes(Module *M, StringRef Name, const TargetLibraryInfo &TLI); /// Check whether the overloaded unary floating point function /// corresponding to \a Ty is available. Modified: projects/clang700-import/contrib/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -74,9 +74,17 @@ cl::opt<FunctionSummary::ForceSummaryHotnessType, true // Walk through the operands of a given User via worklist iteration and populate // the set of GlobalValue references encountered. Invoked either on an // Instruction or a GlobalVariable (which walks its initializer). -static void findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, +// Return true if any of the operands contains blockaddress. This is important +// to know when computing summary for global var, because if global variable +// references basic block address we can't import it separately from function +// containing that basic block. For simplicity we currently don't import such +// global vars at all. When importing function we aren't interested if any +// instruction in it takes an address of any basic block, because instruction +// can only take an address of basic block located in the same function. +static bool findRefEdges(ModuleSummaryIndex &Index, const User *CurUser, SetVector<ValueInfo> &RefEdges, SmallPtrSet<const User *, 8> &Visited) { + bool HasBlockAddress = false; SmallVector<const User *, 32> Worklist; Worklist.push_back(CurUser); @@ -92,8 +100,10 @@ static void findRefEdges(ModuleSummaryIndex &Index, co const User *Operand = dyn_cast<User>(OI); if (!Operand) continue; - if (isa<BlockAddress>(Operand)) + if (isa<BlockAddress>(Operand)) { + HasBlockAddress = true; continue; + } if (auto *GV = dyn_cast<GlobalValue>(Operand)) { // We have a reference to a global value. This should be added to // the reference set unless it is a callee. Callees are handled @@ -105,6 +115,7 @@ static void findRefEdges(ModuleSummaryIndex &Index, co Worklist.push_back(Operand); } } + return HasBlockAddress; } static CalleeInfo::HotnessType getHotness(uint64_t ProfileCount, @@ -369,7 +380,7 @@ computeVariableSummary(ModuleSummaryIndex &Index, cons DenseSet<GlobalValue::GUID> &CantBePromoted) { SetVector<ValueInfo> RefEdges; SmallPtrSet<const User *, 8> Visited; - findRefEdges(Index, &V, RefEdges, Visited); + bool HasBlockAddress = findRefEdges(Index, &V, RefEdges, Visited); bool NonRenamableLocal = isNonRenamableLocal(V); GlobalValueSummary::GVFlags Flags(V.getLinkage(), NonRenamableLocal, /* Live = */ false, V.isDSOLocal()); @@ -377,6 +388,8 @@ computeVariableSummary(ModuleSummaryIndex &Index, cons llvm::make_unique<GlobalVarSummary>(Flags, RefEdges.takeVector()); if (NonRenamableLocal) CantBePromoted.insert(V.getGUID()); + if (HasBlockAddress) + GVarSummary->setNotEligibleToImport(); Index.addGlobalValueSummary(V, std::move(GVarSummary)); } Modified: projects/clang700-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -2127,7 +2127,7 @@ void DwarfDebug::emitDebugRanges() { auto NoRangesPresent = [this]() { return llvm::all_of( - CUMap, [](const decltype(CUMap)::const_iterator::value_type &Pair) { + CUMap, [](const decltype(CUMap)::value_type &Pair) { return Pair.second->getRangeLists().empty(); }); }; Modified: projects/clang700-import/contrib/llvm/lib/Target/X86/X86DomainReassignment.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Target/X86/X86DomainReassignment.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/Target/X86/X86DomainReassignment.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -217,6 +217,27 @@ class InstrCOPYReplacer : public InstrReplacer { (publ InstrCOPYReplacer(unsigned SrcOpcode, RegDomain DstDomain, unsigned DstOpcode) : InstrReplacer(SrcOpcode, DstOpcode), DstDomain(DstDomain) {} + bool isLegal(const MachineInstr *MI, + const TargetInstrInfo *TII) const override { + if (!InstrConverterBase::isLegal(MI, TII)) + return false; + + // Don't allow copies to/flow GR8/GR16 physical registers. + // FIXME: Is there some better way to support this? + unsigned DstReg = MI->getOperand(0).getReg(); + if (TargetRegisterInfo::isPhysicalRegister(DstReg) && + (X86::GR8RegClass.contains(DstReg) || + X86::GR16RegClass.contains(DstReg))) + return false; + unsigned SrcReg = MI->getOperand(1).getReg(); + if (TargetRegisterInfo::isPhysicalRegister(SrcReg) && + (X86::GR8RegClass.contains(SrcReg) || + X86::GR16RegClass.contains(SrcReg))) + return false; + + return true; + } + double getExtraCost(const MachineInstr *MI, MachineRegisterInfo *MRI) const override { assert(MI->getOpcode() == TargetOpcode::COPY && "Expected a COPY"); Modified: projects/clang700-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -23312,15 +23312,14 @@ static SDValue LowerScalarVariableShift(SDValue Op, Se } // Check cases (mainly 32-bit) where i64 is expanded into high and low parts. - if (VT == MVT::v2i64 && Amt.getOpcode() == ISD::BITCAST && + if (VT == MVT::v2i64 && Amt.getOpcode() == ISD::BITCAST && Amt.getOperand(0).getOpcode() == ISD::BUILD_VECTOR) { Amt = Amt.getOperand(0); - unsigned Ratio = Amt.getSimpleValueType().getVectorNumElements() / - VT.getVectorNumElements(); + unsigned Ratio = 64 / Amt.getScalarValueSizeInBits(); std::vector<SDValue> Vals(Ratio); for (unsigned i = 0; i != Ratio; ++i) Vals[i] = Amt.getOperand(i); - for (unsigned i = Ratio; i != Amt.getNumOperands(); i += Ratio) { + for (unsigned i = Ratio, e = Amt.getNumOperands(); i != e; i += Ratio) { for (unsigned j = 0; j != Ratio; ++j) if (Vals[j] != Amt.getOperand(i + j)) return SDValue(); Modified: projects/clang700-import/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -3109,7 +3109,7 @@ void X86InstrInfo::copyPhysReg(MachineBasicBlock &MBB, LLVM_DEBUG(dbgs() << "Cannot copy " << RI.getName(SrcReg) << " to " << RI.getName(DestReg) << '\n'); - llvm_unreachable("Cannot emit physreg copy instruction"); + report_fatal_error("Cannot emit physreg copy instruction"); } bool X86InstrInfo::isCopyInstr(const MachineInstr &MI, Modified: projects/clang700-import/contrib/llvm/lib/Transforms/IPO/FunctionImport.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Transforms/IPO/FunctionImport.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/Transforms/IPO/FunctionImport.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -258,8 +258,7 @@ static void computeImportForReferencedGlobals( for (auto &RefSummary : VI.getSummaryList()) if (RefSummary->getSummaryKind() == GlobalValueSummary::GlobalVarKind && - // Don't try to import regular LTO summaries added to dummy module. - !RefSummary->modulePath().empty() && + !RefSummary->notEligibleToImport() && !GlobalValue::isInterposableLinkage(RefSummary->linkage()) && RefSummary->refs().empty()) { ImportList[RefSummary->modulePath()].insert(VI.getGUID()); Modified: projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -921,10 +921,11 @@ bool LoopIdiomRecognize::processLoopStridedStore( Type *Int8PtrTy = DestInt8PtrTy; Module *M = TheStore->getModule(); + StringRef FuncName = "memset_pattern16"; Value *MSP = - M->getOrInsertFunction("memset_pattern16", Builder.getVoidTy(), + M->getOrInsertFunction(FuncName, Builder.getVoidTy(), Int8PtrTy, Int8PtrTy, IntPtr); - inferLibFuncAttributes(*M->getFunction("memset_pattern16"), *TLI); + inferLibFuncAttributes(M, FuncName, *TLI); // Otherwise we should form a memset_pattern16. PatternValue is known to be // an constant array of 16-bytes. Plop the value into a mergable global. Modified: projects/clang700-import/contrib/llvm/lib/Transforms/Utils/BuildLibCalls.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Transforms/Utils/BuildLibCalls.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/lib/Transforms/Utils/BuildLibCalls.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -112,6 +112,14 @@ static bool setNonLazyBind(Function &F) { return true; } +bool llvm::inferLibFuncAttributes(Module *M, StringRef Name, + const TargetLibraryInfo &TLI) { + Function *F = M->getFunction(Name); + if (!F) + return false; + return inferLibFuncAttributes(*F, TLI); +} + bool llvm::inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI) { LibFunc TheLibFunc; if (!(TLI.getLibFunc(F, TheLibFunc) && TLI.has(TheLibFunc))) @@ -755,11 +763,12 @@ Value *llvm::emitStrLen(Value *Ptr, IRBuilder<> &B, co return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef StrlenName = TLI->getName(LibFunc_strlen); LLVMContext &Context = B.GetInsertBlock()->getContext(); - Constant *StrLen = M->getOrInsertFunction("strlen", DL.getIntPtrType(Context), + Constant *StrLen = M->getOrInsertFunction(StrlenName, DL.getIntPtrType(Context), B.getInt8PtrTy()); - inferLibFuncAttributes(*M->getFunction("strlen"), *TLI); - CallInst *CI = B.CreateCall(StrLen, castToCStr(Ptr, B), "strlen"); + inferLibFuncAttributes(M, StrlenName, *TLI); + CallInst *CI = B.CreateCall(StrLen, castToCStr(Ptr, B), StrlenName); if (const Function *F = dyn_cast<Function>(StrLen->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -772,13 +781,14 @@ Value *llvm::emitStrChr(Value *Ptr, char C, IRBuilder< return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef StrChrName = TLI->getName(LibFunc_strchr); Type *I8Ptr = B.getInt8PtrTy(); Type *I32Ty = B.getInt32Ty(); Constant *StrChr = - M->getOrInsertFunction("strchr", I8Ptr, I8Ptr, I32Ty); - inferLibFuncAttributes(*M->getFunction("strchr"), *TLI); + M->getOrInsertFunction(StrChrName, I8Ptr, I8Ptr, I32Ty); + inferLibFuncAttributes(M, StrChrName, *TLI); CallInst *CI = B.CreateCall( - StrChr, {castToCStr(Ptr, B), ConstantInt::get(I32Ty, C)}, "strchr"); + StrChr, {castToCStr(Ptr, B), ConstantInt::get(I32Ty, C)}, StrChrName); if (const Function *F = dyn_cast<Function>(StrChr->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); return CI; @@ -790,13 +800,14 @@ Value *llvm::emitStrNCmp(Value *Ptr1, Value *Ptr2, Val return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef StrNCmpName = TLI->getName(LibFunc_strncmp); LLVMContext &Context = B.GetInsertBlock()->getContext(); - Value *StrNCmp = M->getOrInsertFunction("strncmp", B.getInt32Ty(), + Value *StrNCmp = M->getOrInsertFunction(StrNCmpName, B.getInt32Ty(), B.getInt8PtrTy(), B.getInt8PtrTy(), DL.getIntPtrType(Context)); - inferLibFuncAttributes(*M->getFunction("strncmp"), *TLI); + inferLibFuncAttributes(M, StrNCmpName, *TLI); CallInst *CI = B.CreateCall( - StrNCmp, {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, "strncmp"); + StrNCmp, {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, StrNCmpName); if (const Function *F = dyn_cast<Function>(StrNCmp->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -812,7 +823,7 @@ Value *llvm::emitStrCpy(Value *Dst, Value *Src, IRBuil Module *M = B.GetInsertBlock()->getModule(); Type *I8Ptr = B.getInt8PtrTy(); Value *StrCpy = M->getOrInsertFunction(Name, I8Ptr, I8Ptr, I8Ptr); - inferLibFuncAttributes(*M->getFunction(Name), *TLI); + inferLibFuncAttributes(M, Name, *TLI); CallInst *CI = B.CreateCall(StrCpy, {castToCStr(Dst, B), castToCStr(Src, B)}, Name); if (const Function *F = dyn_cast<Function>(StrCpy->stripPointerCasts())) @@ -829,9 +840,9 @@ Value *llvm::emitStrNCpy(Value *Dst, Value *Src, Value Type *I8Ptr = B.getInt8PtrTy(); Value *StrNCpy = M->getOrInsertFunction(Name, I8Ptr, I8Ptr, I8Ptr, Len->getType()); - inferLibFuncAttributes(*M->getFunction(Name), *TLI); + inferLibFuncAttributes(M, Name, *TLI); CallInst *CI = B.CreateCall( - StrNCpy, {castToCStr(Dst, B), castToCStr(Src, B), Len}, "strncpy"); + StrNCpy, {castToCStr(Dst, B), castToCStr(Src, B), Len}, Name); if (const Function *F = dyn_cast<Function>(StrNCpy->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); return CI; @@ -866,12 +877,13 @@ Value *llvm::emitMemChr(Value *Ptr, Value *Val, Value return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef MemChrName = TLI->getName(LibFunc_memchr); LLVMContext &Context = B.GetInsertBlock()->getContext(); - Value *MemChr = M->getOrInsertFunction("memchr", B.getInt8PtrTy(), + Value *MemChr = M->getOrInsertFunction(MemChrName, B.getInt8PtrTy(), B.getInt8PtrTy(), B.getInt32Ty(), DL.getIntPtrType(Context)); - inferLibFuncAttributes(*M->getFunction("memchr"), *TLI); - CallInst *CI = B.CreateCall(MemChr, {castToCStr(Ptr, B), Val, Len}, "memchr"); + inferLibFuncAttributes(M, MemChrName, *TLI); + CallInst *CI = B.CreateCall(MemChr, {castToCStr(Ptr, B), Val, Len}, MemChrName); if (const Function *F = dyn_cast<Function>(MemChr->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -885,13 +897,14 @@ Value *llvm::emitMemCmp(Value *Ptr1, Value *Ptr2, Valu return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef MemCmpName = TLI->getName(LibFunc_memcmp); LLVMContext &Context = B.GetInsertBlock()->getContext(); - Value *MemCmp = M->getOrInsertFunction("memcmp", B.getInt32Ty(), + Value *MemCmp = M->getOrInsertFunction(MemCmpName, B.getInt32Ty(), B.getInt8PtrTy(), B.getInt8PtrTy(), DL.getIntPtrType(Context)); - inferLibFuncAttributes(*M->getFunction("memcmp"), *TLI); + inferLibFuncAttributes(M, MemCmpName, *TLI); CallInst *CI = B.CreateCall( - MemCmp, {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, "memcmp"); + MemCmp, {castToCStr(Ptr1, B), castToCStr(Ptr2, B), Len}, MemCmpName); if (const Function *F = dyn_cast<Function>(MemCmp->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -958,14 +971,15 @@ Value *llvm::emitPutChar(Value *Char, IRBuilder<> &B, return nullptr; Module *M = B.GetInsertBlock()->getModule(); - Value *PutChar = M->getOrInsertFunction("putchar", B.getInt32Ty(), B.getInt32Ty()); - inferLibFuncAttributes(*M->getFunction("putchar"), *TLI); + StringRef PutCharName = TLI->getName(LibFunc_putchar); + Value *PutChar = M->getOrInsertFunction(PutCharName, B.getInt32Ty(), B.getInt32Ty()); + inferLibFuncAttributes(M, PutCharName, *TLI); CallInst *CI = B.CreateCall(PutChar, B.CreateIntCast(Char, B.getInt32Ty(), /*isSigned*/true, "chari"), - "putchar"); + PutCharName); if (const Function *F = dyn_cast<Function>(PutChar->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -978,10 +992,11 @@ Value *llvm::emitPutS(Value *Str, IRBuilder<> &B, return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef PutsName = TLI->getName(LibFunc_puts); Value *PutS = - M->getOrInsertFunction("puts", B.getInt32Ty(), B.getInt8PtrTy()); - inferLibFuncAttributes(*M->getFunction("puts"), *TLI); - CallInst *CI = B.CreateCall(PutS, castToCStr(Str, B), "puts"); + M->getOrInsertFunction(PutsName, B.getInt32Ty(), B.getInt8PtrTy()); + inferLibFuncAttributes(M, PutsName, *TLI); + CallInst *CI = B.CreateCall(PutS, castToCStr(Str, B), PutsName); if (const Function *F = dyn_cast<Function>(PutS->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); return CI; @@ -993,13 +1008,14 @@ Value *llvm::emitFPutC(Value *Char, Value *File, IRBui return nullptr; Module *M = B.GetInsertBlock()->getModule(); - Constant *F = M->getOrInsertFunction("fputc", B.getInt32Ty(), B.getInt32Ty(), + StringRef FPutcName = TLI->getName(LibFunc_fputc); + Constant *F = M->getOrInsertFunction(FPutcName, B.getInt32Ty(), B.getInt32Ty(), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction("fputc"), *TLI); + inferLibFuncAttributes(M, FPutcName, *TLI); Char = B.CreateIntCast(Char, B.getInt32Ty(), /*isSigned*/true, "chari"); - CallInst *CI = B.CreateCall(F, {Char, File}, "fputc"); + CallInst *CI = B.CreateCall(F, {Char, File}, FPutcName); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) CI->setCallingConv(Fn->getCallingConv()); @@ -1012,12 +1028,13 @@ Value *llvm::emitFPutCUnlocked(Value *Char, Value *Fil return nullptr; Module *M = B.GetInsertBlock()->getModule(); - Constant *F = M->getOrInsertFunction("fputc_unlocked", B.getInt32Ty(), + StringRef FPutcUnlockedName = TLI->getName(LibFunc_fputc_unlocked); + Constant *F = M->getOrInsertFunction(FPutcUnlockedName, B.getInt32Ty(), B.getInt32Ty(), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction("fputc_unlocked"), *TLI); + inferLibFuncAttributes(M, FPutcUnlockedName, *TLI); Char = B.CreateIntCast(Char, B.getInt32Ty(), /*isSigned*/ true, "chari"); - CallInst *CI = B.CreateCall(F, {Char, File}, "fputc_unlocked"); + CallInst *CI = B.CreateCall(F, {Char, File}, FPutcUnlockedName); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) CI->setCallingConv(Fn->getCallingConv()); @@ -1034,8 +1051,8 @@ Value *llvm::emitFPutS(Value *Str, Value *File, IRBuil Constant *F = M->getOrInsertFunction( FPutsName, B.getInt32Ty(), B.getInt8PtrTy(), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction(FPutsName), *TLI); - CallInst *CI = B.CreateCall(F, {castToCStr(Str, B), File}, "fputs"); + inferLibFuncAttributes(M, FPutsName, *TLI); + CallInst *CI = B.CreateCall(F, {castToCStr(Str, B), File}, FPutsName); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) CI->setCallingConv(Fn->getCallingConv()); @@ -1052,8 +1069,8 @@ Value *llvm::emitFPutSUnlocked(Value *Str, Value *File Constant *F = M->getOrInsertFunction(FPutsUnlockedName, B.getInt32Ty(), B.getInt8PtrTy(), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction(FPutsUnlockedName), *TLI); - CallInst *CI = B.CreateCall(F, {castToCStr(Str, B), File}, "fputs_unlocked"); + inferLibFuncAttributes(M, FPutsUnlockedName, *TLI); + CallInst *CI = B.CreateCall(F, {castToCStr(Str, B), File}, FPutsUnlockedName); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) CI->setCallingConv(Fn->getCallingConv()); @@ -1073,7 +1090,7 @@ Value *llvm::emitFWrite(Value *Ptr, Value *Size, Value DL.getIntPtrType(Context), DL.getIntPtrType(Context), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction(FWriteName), *TLI); + inferLibFuncAttributes(M, FWriteName, *TLI); CallInst *CI = B.CreateCall(F, {castToCStr(Ptr, B), Size, ConstantInt::get(DL.getIntPtrType(Context), 1), File}); @@ -1089,11 +1106,12 @@ Value *llvm::emitMalloc(Value *Num, IRBuilder<> &B, co return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef MallocName = TLI->getName(LibFunc_malloc); LLVMContext &Context = B.GetInsertBlock()->getContext(); - Value *Malloc = M->getOrInsertFunction("malloc", B.getInt8PtrTy(), + Value *Malloc = M->getOrInsertFunction(MallocName, B.getInt8PtrTy(), DL.getIntPtrType(Context)); - inferLibFuncAttributes(*M->getFunction("malloc"), *TLI); - CallInst *CI = B.CreateCall(Malloc, Num, "malloc"); + inferLibFuncAttributes(M, MallocName, *TLI); + CallInst *CI = B.CreateCall(Malloc, Num, MallocName); if (const Function *F = dyn_cast<Function>(Malloc->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -1107,12 +1125,13 @@ Value *llvm::emitCalloc(Value *Num, Value *Size, const return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef CallocName = TLI.getName(LibFunc_calloc); const DataLayout &DL = M->getDataLayout(); IntegerType *PtrType = DL.getIntPtrType((B.GetInsertBlock()->getContext())); - Value *Calloc = M->getOrInsertFunction("calloc", Attrs, B.getInt8PtrTy(), + Value *Calloc = M->getOrInsertFunction(CallocName, Attrs, B.getInt8PtrTy(), PtrType, PtrType); - inferLibFuncAttributes(*M->getFunction("calloc"), TLI); - CallInst *CI = B.CreateCall(Calloc, {Num, Size}, "calloc"); + inferLibFuncAttributes(M, CallocName, TLI); + CallInst *CI = B.CreateCall(Calloc, {Num, Size}, CallocName); if (const auto *F = dyn_cast<Function>(Calloc->stripPointerCasts())) CI->setCallingConv(F->getCallingConv()); @@ -1134,7 +1153,7 @@ Value *llvm::emitFWriteUnlocked(Value *Ptr, Value *Siz DL.getIntPtrType(Context), DL.getIntPtrType(Context), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction(FWriteUnlockedName), *TLI); + inferLibFuncAttributes(M, FWriteUnlockedName, *TLI); CallInst *CI = B.CreateCall(F, {castToCStr(Ptr, B), Size, N, File}); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) @@ -1148,11 +1167,12 @@ Value *llvm::emitFGetCUnlocked(Value *File, IRBuilder< return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef FGetCUnlockedName = TLI->getName(LibFunc_fgetc_unlocked); Constant *F = - M->getOrInsertFunction("fgetc_unlocked", B.getInt32Ty(), File->getType()); + M->getOrInsertFunction(FGetCUnlockedName, B.getInt32Ty(), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction("fgetc_unlocked"), *TLI); - CallInst *CI = B.CreateCall(F, File, "fgetc_unlocked"); + inferLibFuncAttributes(M, FGetCUnlockedName, *TLI); + CallInst *CI = B.CreateCall(F, File, FGetCUnlockedName); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) CI->setCallingConv(Fn->getCallingConv()); @@ -1165,12 +1185,13 @@ Value *llvm::emitFGetSUnlocked(Value *Str, Value *Size return nullptr; Module *M = B.GetInsertBlock()->getModule(); + StringRef FGetSUnlockedName = TLI->getName(LibFunc_fgets_unlocked); Constant *F = - M->getOrInsertFunction("fgets_unlocked", B.getInt8PtrTy(), + M->getOrInsertFunction(FGetSUnlockedName, B.getInt8PtrTy(), B.getInt8PtrTy(), B.getInt32Ty(), File->getType()); - inferLibFuncAttributes(*M->getFunction("fgets_unlocked"), *TLI); + inferLibFuncAttributes(M, FGetSUnlockedName, *TLI); CallInst *CI = - B.CreateCall(F, {castToCStr(Str, B), Size, File}, "fgets_unlocked"); + B.CreateCall(F, {castToCStr(Str, B), Size, File}, FGetSUnlockedName); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) CI->setCallingConv(Fn->getCallingConv()); @@ -1191,7 +1212,7 @@ Value *llvm::emitFReadUnlocked(Value *Ptr, Value *Size DL.getIntPtrType(Context), DL.getIntPtrType(Context), File->getType()); if (File->getType()->isPointerTy()) - inferLibFuncAttributes(*M->getFunction(FReadUnlockedName), *TLI); + inferLibFuncAttributes(M, FReadUnlockedName, *TLI); CallInst *CI = B.CreateCall(F, {castToCStr(Ptr, B), Size, N, File}); if (const Function *Fn = dyn_cast<Function>(F->stripPointerCasts())) Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/Decl.h Sun Nov 4 15:46:30 2018 (r340125) @@ -2269,8 +2269,7 @@ class FunctionDecl : public DeclaratorDecl, public Dec unsigned getMinRequiredArguments() const; QualType getReturnType() const { - assert(getType()->getAs<FunctionType>() && "Expected a FunctionType!"); - return getType()->getAs<FunctionType>()->getReturnType(); + return getType()->castAs<FunctionType>()->getReturnType(); } /// Attempt to compute an informative source range covering the @@ -2278,14 +2277,22 @@ class FunctionDecl : public DeclaratorDecl, public Dec /// limited representation in the AST. SourceRange getReturnTypeSourceRange() const; + /// Get the declared return type, which may differ from the actual return + /// type if the return type is deduced. + QualType getDeclaredReturnType() const { + auto *TSI = getTypeSourceInfo(); + QualType T = TSI ? TSI->getType() : getType(); + return T->castAs<FunctionType>()->getReturnType(); + } + /// Attempt to compute an informative source range covering the /// function exception specification, if any. SourceRange getExceptionSpecSourceRange() const; /// Determine the type of an expression that calls this function. QualType getCallResultType() const { - assert(getType()->getAs<FunctionType>() && "Expected a FunctionType!"); - return getType()->getAs<FunctionType>()->getCallResultType(getASTContext()); + return getType()->castAs<FunctionType>()->getCallResultType( + getASTContext()); } /// Returns the WarnUnusedResultAttr that is either declared on this Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td Sun Nov 4 15:46:30 2018 (r340125) @@ -802,7 +802,7 @@ def fconstexpr_backtrace_limit_EQ : Joined<["-"], "fco Group<f_Group>; def fno_crash_diagnostics : Flag<["-"], "fno-crash-diagnostics">, Group<f_clang_Group>, Flags<[NoArgumentUnused]>, HelpText<"Disable auto-generation of preprocessed source files and a script for reproduction during a clang crash">; -def fcrash_diagnostics_dir : Joined<["-"], "fcrash-diagnostics-dir=">, Group<f_clang_Group>, Flags<[NoArgumentUnused]>; +def fcrash_diagnostics_dir : Joined<["-"], "fcrash-diagnostics-dir=">, Group<f_clang_Group>, Flags<[NoArgumentUnused, CoreOption]>; def fcreate_profile : Flag<["-"], "fcreate-profile">, Group<f_Group>; def fcxx_exceptions: Flag<["-"], "fcxx-exceptions">, Group<f_Group>, HelpText<"Enable C++ exceptions">, Flags<[CC1Option]>; Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/Sema/Sema.h Sun Nov 4 15:46:30 2018 (r340125) @@ -1950,6 +1950,8 @@ class Sema { (public) FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization); bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl); + bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, + QualType NewT, QualType OldT); void CheckMain(FunctionDecl *FD, const DeclSpec &D); void CheckMSVCRTEntryPoint(FunctionDecl *FD); Attr *getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition); Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/Basic/Version.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_700/final/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_70/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGBuiltin.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -8952,9 +8952,9 @@ llvm::Value *CodeGenFunction::EmitX86CpuSupports(uint3 Builder.CreateAlignedLoad(CpuFeatures, CharUnits::fromQuantity(4)); // Check the value of the bit corresponding to the feature requested. - Value *Bitset = Builder.CreateAnd( - Features, llvm::ConstantInt::get(Int32Ty, FeaturesMask)); - return Builder.CreateICmpNE(Bitset, llvm::ConstantInt::get(Int32Ty, 0)); + Value *Mask = Builder.getInt32(FeaturesMask); + Value *Bitset = Builder.CreateAnd(Features, Mask); + return Builder.CreateICmpEQ(Bitset, Mask); } Value *CodeGenFunction::EmitX86CpuInit() { Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/Driver.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/Driver.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/Driver.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -2998,9 +2998,10 @@ void Driver::BuildActions(Compilation &C, DerivedArgLi Args.eraseArg(options::OPT__SLASH_Yc); YcArg = nullptr; } - if (Args.hasArg(options::OPT__SLASH_Y_)) { - // /Y- disables all pch handling. Rather than check for it everywhere, - // just remove clang-cl pch-related flags here. + if (FinalPhase == phases::Preprocess || Args.hasArg(options::OPT__SLASH_Y_)) { + // If only preprocessing or /Y- is used, all pch handling is disabled. + // Rather than check for it everywhere, just remove clang-cl pch-related + // flags here. Args.eraseArg(options::OPT__SLASH_Fp); Args.eraseArg(options::OPT__SLASH_Yc); Args.eraseArg(options::OPT__SLASH_Yu); Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Gnu.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -237,7 +237,7 @@ static const char *getLDMOption(const llvm::Triple &T, case llvm::Triple::aarch64: return "aarch64linux"; case llvm::Triple::aarch64_be: - return "aarch64_be_linux"; + return "aarch64linuxb"; case llvm::Triple::arm: case llvm::Triple::thumb: return "armelf_linux_eabi"; Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaDecl.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -3249,20 +3249,15 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedD // Redeclarations or specializations of a function or function template // with a declared return type that uses a placeholder type shall also // use that placeholder, not a deduced type. - QualType OldDeclaredReturnType = - (Old->getTypeSourceInfo() - ? Old->getTypeSourceInfo()->getType()->castAs<FunctionType>() - : OldType)->getReturnType(); - QualType NewDeclaredReturnType = - (New->getTypeSourceInfo() - ? New->getTypeSourceInfo()->getType()->castAs<FunctionType>() - : NewType)->getReturnType(); + QualType OldDeclaredReturnType = Old->getDeclaredReturnType(); + QualType NewDeclaredReturnType = New->getDeclaredReturnType(); if (!Context.hasSameType(OldDeclaredReturnType, NewDeclaredReturnType) && - !((NewQType->isDependentType() || OldQType->isDependentType()) && - New->isLocalExternDecl())) { + canFullyTypeCheckRedeclaration(New, Old, NewDeclaredReturnType, + OldDeclaredReturnType)) { QualType ResQT; if (NewDeclaredReturnType->isObjCObjectPointerType() && OldDeclaredReturnType->isObjCObjectPointerType()) + // FIXME: This does the wrong thing for a deduced return type. ResQT = Context.mergeObjCGCQualifiers(NewQType, OldQType); if (ResQT.isNull()) { if (New->isCXXClassMember() && New->isOutOfLine()) @@ -3427,13 +3422,11 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedD if (OldQTypeForComparison == NewQType) return MergeCompatibleFunctionDecls(New, Old, S, MergeTypeWithOld); - if ((NewQType->isDependentType() || OldQType->isDependentType()) && - New->isLocalExternDecl()) { - // It's OK if we couldn't merge types for a local function declaraton - // if either the old or new type is dependent. We'll merge the types - // when we instantiate the function. + // If the types are imprecise (due to dependent constructs in friends or + // local extern declarations), it's OK if they differ. We'll check again + // during instantiation. + if (!canFullyTypeCheckRedeclaration(New, Old, NewQType, OldQType)) return false; - } // Fall through for conflicting redeclarations and redefinitions. } @@ -9336,6 +9329,39 @@ Attr *Sema::getImplicitCodeSegOrSectionAttrForFunction } return nullptr; } + +/// Determines if we can perform a correct type check for \p D as a +/// redeclaration of \p PrevDecl. If not, we can generally still perform a +/// best-effort check. +/// +/// \param NewD The new declaration. +/// \param OldD The old declaration. +/// \param NewT The portion of the type of the new declaration to check. +/// \param OldT The portion of the type of the old declaration to check. +bool Sema::canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, + QualType NewT, QualType OldT) { + if (!NewD->getLexicalDeclContext()->isDependentContext()) + return true; + + // For dependently-typed local extern declarations and friends, we can't + // perform a correct type check in general until instantiation: + // + // int f(); + // template<typename T> void g() { T f(); } + // + // (valid if g() is only instantiated with T = int). + if (NewT->isDependentType() && + (NewD->isLocalExternDecl() || NewD->getFriendObjectKind())) + return false; + + // Similarly, if the previous declaration was a dependent local extern + // declaration, we don't really know its type yet. + if (OldT->isDependentType() && OldD->isLocalExternDecl()) + return false; + + return true; +} + /// Checks if the new declaration declared in dependent context must be /// put in the same redeclaration chain as the specified declaration. /// @@ -9346,20 +9372,30 @@ Attr *Sema::getImplicitCodeSegOrSectionAttrForFunction /// belongs to. /// bool Sema::shouldLinkDependentDeclWithPrevious(Decl *D, Decl *PrevDecl) { - // Any declarations should be put into redeclaration chains except for - // friend declaration in a dependent context that names a function in - // namespace scope. + if (!D->getLexicalDeclContext()->isDependentContext()) + return true; + + // Don't chain dependent friend function definitions until instantiation, to + // permit cases like // - // This allows to compile code like: + // void func(); + // template<typename T> class C1 { friend void func() {} }; + // template<typename T> class C2 { friend void func() {} }; // - // void func(); - // template<typename T> class C1 { friend void func() { } }; - // template<typename T> class C2 { friend void func() { } }; + // ... which is valid if only one of C1 and C2 is ever instantiated. // - // This code snippet is a valid code unless both templates are instantiated. - return !(D->getLexicalDeclContext()->isDependentContext() && - D->getDeclContext()->isFileContext() && - D->getFriendObjectKind() != Decl::FOK_None); + // FIXME: This need only apply to function definitions. For now, we proxy + // this by checking for a file-scope function. We do not want this to apply + // to friend declarations nominating member functions, because that gets in + // the way of access checks. + if (D->getFriendObjectKind() && D->getDeclContext()->isFileContext()) + return false; + + auto *VD = dyn_cast<ValueDecl>(D); + auto *PrevVD = dyn_cast<ValueDecl>(PrevDecl); + return !VD || !PrevVD || + canFullyTypeCheckRedeclaration(VD, PrevVD, VD->getType(), + PrevVD->getType()); } namespace MultiVersioning { Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaOverload.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -1105,7 +1105,8 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl (!TemplateParameterListsAreEqual(NewTemplate->getTemplateParameters(), OldTemplate->getTemplateParameters(), false, TPL_TemplateMatch) || - OldType->getReturnType() != NewType->getReturnType())) + !Context.hasSameType(Old->getDeclaredReturnType(), + New->getDeclaredReturnType()))) return true; // If the function is a class member, its signature includes the Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -8304,6 +8304,8 @@ Sema::CheckMemberSpecialization(NamedDecl *Member, Loo QualType Adjusted = Function->getType(); if (!hasExplicitCallingConv(Adjusted)) Adjusted = adjustCCAndNoReturn(Adjusted, Method->getType()); + // This doesn't handle deduced return types, but both function + // declarations should be undeduced at this point. if (Context.hasSameType(Adjusted, Method->getType())) { FoundInstantiation = *I; Instantiation = Method; Modified: projects/clang700-import/contrib/llvm/tools/lld/COFF/Chunks.h ============================================================================== --- projects/clang700-import/contrib/llvm/tools/lld/COFF/Chunks.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/lld/COFF/Chunks.h Sun Nov 4 15:46:30 2018 (r340125) @@ -345,7 +345,9 @@ class ImportThunkChunkARM64 : public Chunk { (private) // See comments for DefinedLocalImport class. class LocalImportChunk : public Chunk { public: - explicit LocalImportChunk(Defined *S) : Sym(S) {} + explicit LocalImportChunk(Defined *S) : Sym(S) { + Alignment = Config->is64() ? 8 : 4; + } size_t getSize() const override; void getBaserels(std::vector<Baserel> *Res) override; void writeTo(uint8_t *Buf) const override; Modified: projects/clang700-import/contrib/llvm/tools/lld/ELF/ScriptParser.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/lld/ELF/ScriptParser.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -497,6 +497,9 @@ void ScriptParser::readSections() { for (BaseCommand *Cmd : readOverlay()) V.push_back(Cmd); continue; + } else if (Tok == "INCLUDE") { + readInclude(); + continue; } if (BaseCommand *Cmd = readAssignment(Tok)) @@ -778,6 +781,8 @@ OutputSection *ScriptParser::readOutputSectionDescript Cmd->Filler = readFill(); } else if (Tok == "SORT") { readSort(); + } else if (Tok == "INCLUDE") { + readInclude(); } else if (peek() == "(") { Cmd->SectionCommands.push_back(readInputSectionDescription(Tok)); } else { @@ -1404,7 +1409,11 @@ uint64_t ScriptParser::readMemoryAssignment(StringRef void ScriptParser::readMemory() { expect("{"); while (!errorCount() && !consume("}")) { - StringRef Name = next(); + StringRef Tok = next(); + if (Tok == "INCLUDE") { + readInclude(); + continue; + } uint32_t Flags = 0; uint32_t NegFlags = 0; @@ -1419,10 +1428,9 @@ void ScriptParser::readMemory() { uint64_t Length = readMemoryAssignment("LENGTH", "len", "l"); // Add the memory region to the region map. - MemoryRegion *MR = - make<MemoryRegion>(Name, Origin, Length, Flags, NegFlags); - if (!Script->MemoryRegions.insert({Name, MR}).second) - setError("region '" + Name + "' already defined"); + MemoryRegion *MR = make<MemoryRegion>(Tok, Origin, Length, Flags, NegFlags); + if (!Script->MemoryRegions.insert({Tok, MR}).second) + setError("region '" + Tok + "' already defined"); } } Modified: projects/clang700-import/contrib/llvm/tools/lld/ELF/Symbols.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/lld/ELF/Symbols.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/lld/ELF/Symbols.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -209,7 +209,7 @@ uint8_t Symbol::computeBinding() const { return Binding; if (Visibility != STV_DEFAULT && Visibility != STV_PROTECTED) return STB_LOCAL; - if (VersionId == VER_NDX_LOCAL && isDefined()) + if (VersionId == VER_NDX_LOCAL && isDefined() && !IsPreemptible) return STB_LOCAL; if (!Config->GnuUnique && Binding == STB_GNU_UNIQUE) return STB_GLOBAL; Modified: projects/clang700-import/contrib/llvm/tools/llvm-xray/xray-account.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/llvm-xray/xray-account.cpp Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/contrib/llvm/tools/llvm-xray/xray-account.cpp Sun Nov 4 15:46:30 2018 (r340125) @@ -358,8 +358,11 @@ void LatencyAccountant::exportStats(const XRayFileHead break; } - if (AccountTop > 0) - Results.erase(Results.begin() + AccountTop.getValue(), Results.end()); + if (AccountTop > 0) { + auto MaxTop = + std::min(AccountTop.getValue(), static_cast<int>(Results.size())); + Results.erase(Results.begin() + MaxTop, Results.end()); + } for (const auto &R : Results) Fn(std::get<0>(R), std::get<1>(R), std::get<2>(R)); Modified: projects/clang700-import/etc/mtree/BSD.debug.dist ============================================================================== --- projects/clang700-import/etc/mtree/BSD.debug.dist Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/etc/mtree/BSD.debug.dist Sun Nov 4 15:46:30 2018 (r340125) @@ -29,7 +29,7 @@ .. lib clang - 7.0.0 + 7.0.1 lib freebsd .. Modified: projects/clang700-import/etc/mtree/BSD.usr.dist ============================================================================== --- projects/clang700-import/etc/mtree/BSD.usr.dist Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/etc/mtree/BSD.usr.dist Sun Nov 4 15:46:30 2018 (r340125) @@ -25,7 +25,7 @@ aout .. clang - 7.0.0 + 7.0.1 include sanitizer .. Modified: projects/clang700-import/lib/clang/headers/Makefile ============================================================================== --- projects/clang700-import/lib/clang/headers/Makefile Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/clang/headers/Makefile Sun Nov 4 15:46:30 2018 (r340125) @@ -4,7 +4,7 @@ .PATH: ${CLANG_SRCS}/lib/Headers -INCSDIR= ${LIBDIR}/clang/7.0.0/include +INCSDIR= ${LIBDIR}/clang/7.0.1/include GENINCS+= arm_fp16.h GENINCS+= arm_neon.h Modified: projects/clang700-import/lib/clang/include/clang/Basic/Version.inc ============================================================================== --- projects/clang700-import/lib/clang/include/clang/Basic/Version.inc Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/clang/include/clang/Basic/Version.inc Sun Nov 4 15:46:30 2018 (r340125) @@ -1,11 +1,11 @@ /* $FreeBSD$ */ -#define CLANG_VERSION 7.0.0 -#define CLANG_VERSION_STRING "7.0.0" +#define CLANG_VERSION 7.0.1 +#define CLANG_VERSION_STRING "7.0.1" #define CLANG_VERSION_MAJOR 7 #define CLANG_VERSION_MINOR 0 -#define CLANG_VERSION_PATCHLEVEL 0 +#define CLANG_VERSION_PATCHLEVEL 1 #define CLANG_VENDOR "FreeBSD " -#define SVN_REVISION "342383" +#define SVN_REVISION "346007" Modified: projects/clang700-import/lib/clang/include/clang/Config/config.h ============================================================================== --- projects/clang700-import/lib/clang/include/clang/Config/config.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/clang/include/clang/Config/config.h Sun Nov 4 15:46:30 2018 (r340125) @@ -62,7 +62,7 @@ #define CLANG_HAVE_RLIMITS 1 /* The LLVM product name and version */ -#define BACKEND_PACKAGE_STRING "LLVM 7.0.0" +#define BACKEND_PACKAGE_STRING "LLVM 7.0.1" /* Linker version detected at compile time. */ /* #undef HOST_LINK_VERSION */ Modified: projects/clang700-import/lib/clang/include/lld/Common/Version.inc ============================================================================== --- projects/clang700-import/lib/clang/include/lld/Common/Version.inc Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/clang/include/lld/Common/Version.inc Sun Nov 4 15:46:30 2018 (r340125) @@ -1,10 +1,10 @@ // $FreeBSD$ -#define LLD_VERSION 7.0.0 -#define LLD_VERSION_STRING "7.0.0" +#define LLD_VERSION 7.0.1 +#define LLD_VERSION_STRING "7.0.1" #define LLD_VERSION_MAJOR 7 #define LLD_VERSION_MINOR 0 #define LLD_REPOSITORY_STRING "FreeBSD" // <Upstream revision at import>-<Local identifier in __FreeBSD_version style> -#define LLD_REVISION_STRING "342383-1300001" +#define LLD_REVISION_STRING "346007-1300001" Modified: projects/clang700-import/lib/clang/include/llvm/Config/config.h ============================================================================== --- projects/clang700-import/lib/clang/include/llvm/Config/config.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/clang/include/llvm/Config/config.h Sun Nov 4 15:46:30 2018 (r340125) @@ -321,10 +321,10 @@ #define PACKAGE_NAME "LLVM" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "LLVM 7.0.0" +#define PACKAGE_STRING "LLVM 7.0.1" /* Define to the version of this package. */ -#define PACKAGE_VERSION "7.0.0" +#define PACKAGE_VERSION "7.0.1" /* Define to the vendor of this package. */ /* #undef PACKAGE_VENDOR */ Modified: projects/clang700-import/lib/clang/include/llvm/Config/llvm-config.h ============================================================================== --- projects/clang700-import/lib/clang/include/llvm/Config/llvm-config.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/clang/include/llvm/Config/llvm-config.h Sun Nov 4 15:46:30 2018 (r340125) @@ -76,7 +76,7 @@ #define LLVM_VERSION_PATCH 0 /* LLVM version string */ -#define LLVM_VERSION_STRING "7.0.0" +#define LLVM_VERSION_STRING "7.0.1" /* Whether LLVM records statistics for use with GetStatistics(), * PrintStatistics() or PrintStatisticsJSON() Modified: projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h ============================================================================== --- projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/clang/include/llvm/Support/VCSRevision.h Sun Nov 4 15:46:30 2018 (r340125) @@ -1,2 +1,2 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "svn-r342383" +#define LLVM_REVISION "svn-r346007" Modified: projects/clang700-import/lib/libclang_rt/Makefile.inc ============================================================================== --- projects/clang700-import/lib/libclang_rt/Makefile.inc Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/lib/libclang_rt/Makefile.inc Sun Nov 4 15:46:30 2018 (r340125) @@ -14,7 +14,7 @@ CRTSRC= ${SRCTOP}/contrib/compiler-rt .PATH: ${CRTSRC}/lib -CLANGDIR= /usr/lib/clang/7.0.0 +CLANGDIR= /usr/lib/clang/7.0.1 LIBDIR= ${CLANGDIR}/lib/freebsd SHLIBDIR= ${LIBDIR} Modified: projects/clang700-import/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- projects/clang700-import/tools/build/mk/OptionalObsoleteFiles.inc Sun Nov 4 14:42:30 2018 (r340124) +++ projects/clang700-import/tools/build/mk/OptionalObsoleteFiles.inc Sun Nov 4 15:46:30 2018 (r340125) @@ -1336,157 +1336,157 @@ OLD_FILES+=usr/bin/clang-cpp OLD_FILES+=usr/bin/clang-tblgen OLD_FILES+=usr/bin/llvm-objdump OLD_FILES+=usr/bin/llvm-tblgen -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/allocator_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/asan_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/common_interface_defs.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/coverage_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/dfsan_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/esan_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/hwasan_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/linux_syscall_hooks.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/lsan_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/msan_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/netbsd_syscall_hooks.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/scudo_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/tsan_interface.h -OLD_FILES+=usr/lib/clang/7.0.0/include/sanitizer/tsan_interface_atomic.h -OLD_DIRS+=usr/lib/clang/7.0.0/include/sanitizer -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_builtin_vars.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_cmath.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_complex_builtins.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_device_functions.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_intrinsics.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_libdevice_declares.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_math_forward_declares.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__clang_cuda_runtime_wrapper.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__stddef_max_align_t.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__wmmintrin_aes.h -OLD_FILES+=usr/lib/clang/7.0.0/include/__wmmintrin_pclmul.h -OLD_FILES+=usr/lib/clang/7.0.0/include/adxintrin.h -OLD_FILES+=usr/lib/clang/7.0.0/include/altivec.h -OLD_FILES+=usr/lib/clang/7.0.0/include/ammintrin.h -OLD_FILES+=usr/lib/clang/7.0.0/include/arm64intr.h -OLD_FILES+=usr/lib/clang/7.0.0/include/arm_acle.h -OLD_FILES+=usr/lib/clang/7.0.0/include/arm_fp16.h *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811041546.wA4FkUjw093988>