Date: Sun, 4 Nov 2018 14:41:47 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r340116 - in vendor/llvm/dist-release_70: . include/llvm/Transforms/Utils lib/Analysis lib/CodeGen/AsmPrinter lib/Target/X86 lib/Transforms/IPO lib/Transforms/Scalar lib/Transforms/Util... Message-ID: <201811041441.wA4EflF5060830@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sun Nov 4 14:41:47 2018 New Revision: 340116 URL: https://svnweb.freebsd.org/changeset/base/340116 Log: Vendor import of llvm release_70 branch r346007: https://llvm.org/svn/llvm-project/llvm/branches/release_70@346007 Added: vendor/llvm/dist-release_70/test/CodeGen/X86/pr38803.ll vendor/llvm/dist-release_70/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll vendor/llvm/dist-release_70/test/ThinLTO/X86/globals-import-blockaddr.ll vendor/llvm/dist-release_70/test/Transforms/InstCombine/pr39177.ll vendor/llvm/dist-release_70/utils/lit/lit/builtin_commands/__init__.py (contents, props changed) Modified: vendor/llvm/dist-release_70/CMakeLists.txt vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp vendor/llvm/dist-release_70/lib/CodeGen/AsmPrinter/DwarfDebug.cpp vendor/llvm/dist-release_70/lib/Target/X86/X86DomainReassignment.cpp vendor/llvm/dist-release_70/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist-release_70/lib/Target/X86/X86InstrInfo.cpp vendor/llvm/dist-release_70/lib/Transforms/IPO/FunctionImport.cpp vendor/llvm/dist-release_70/lib/Transforms/Scalar/LoopIdiomRecognize.cpp vendor/llvm/dist-release_70/lib/Transforms/Utils/BuildLibCalls.cpp vendor/llvm/dist-release_70/test/CodeGen/X86/known-signbits-vector.ll vendor/llvm/dist-release_70/tools/llvm-xray/xray-account.cpp vendor/llvm/dist-release_70/utils/lit/lit/__init__.py Modified: vendor/llvm/dist-release_70/CMakeLists.txt ============================================================================== --- vendor/llvm/dist-release_70/CMakeLists.txt Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/CMakeLists.txt Sun Nov 4 14:41:47 2018 (r340116) @@ -29,7 +29,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR) set(LLVM_VERSION_MINOR 0) endif() if(NOT DEFINED LLVM_VERSION_PATCH) - set(LLVM_VERSION_PATCH 0) + set(LLVM_VERSION_PATCH 1) endif() if(NOT DEFINED LLVM_VERSION_SUFFIX) set(LLVM_VERSION_SUFFIX "") Modified: vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h ============================================================================== --- vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/include/llvm/Transforms/Utils/BuildLibCalls.h Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/Analysis/ModuleSummaryAnalysis.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/CodeGen/AsmPrinter/DwarfDebug.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/Target/X86/X86DomainReassignment.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Target/X86/X86DomainReassignment.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/Target/X86/X86DomainReassignment.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Target/X86/X86ISelLowering.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/Target/X86/X86ISelLowering.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/Target/X86/X86InstrInfo.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Target/X86/X86InstrInfo.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/Target/X86/X86InstrInfo.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/Transforms/IPO/FunctionImport.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Transforms/IPO/FunctionImport.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/Transforms/IPO/FunctionImport.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/Transforms/Scalar/LoopIdiomRecognize.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/Transforms/Scalar/LoopIdiomRecognize.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/lib/Transforms/Utils/BuildLibCalls.cpp ============================================================================== --- vendor/llvm/dist-release_70/lib/Transforms/Utils/BuildLibCalls.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/lib/Transforms/Utils/BuildLibCalls.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/test/CodeGen/X86/known-signbits-vector.ll ============================================================================== --- vendor/llvm/dist-release_70/test/CodeGen/X86/known-signbits-vector.ll Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/test/CodeGen/X86/known-signbits-vector.ll Sun Nov 4 14:41:47 2018 (r340116) @@ -381,19 +381,26 @@ define <4 x float> @signbits_ashr_sext_select_shuffle_ ; X32-NEXT: movl %esp, %ebp ; X32-NEXT: andl $-16, %esp ; X32-NEXT: subl $16, %esp +; X32-NEXT: vmovdqa {{.*#+}} xmm3 = [33,0,63,0] +; X32-NEXT: vmovdqa {{.*#+}} xmm4 = [0,2147483648,0,2147483648] +; X32-NEXT: vpsrlq %xmm3, %xmm4, %xmm5 +; X32-NEXT: vpshufd {{.*#+}} xmm6 = xmm3[2,3,0,1] +; X32-NEXT: vpsrlq %xmm6, %xmm4, %xmm4 +; X32-NEXT: vpblendw {{.*#+}} xmm4 = xmm5[0,1,2,3],xmm4[4,5,6,7] +; X32-NEXT: vextractf128 $1, %ymm2, %xmm5 +; X32-NEXT: vpsrlq %xmm6, %xmm5, %xmm7 +; X32-NEXT: vpsrlq %xmm3, %xmm5, %xmm5 +; X32-NEXT: vpblendw {{.*#+}} xmm5 = xmm5[0,1,2,3],xmm7[4,5,6,7] +; X32-NEXT: vpsrlq %xmm6, %xmm2, %xmm6 +; X32-NEXT: vpsrlq %xmm3, %xmm2, %xmm2 +; X32-NEXT: vpblendw {{.*#+}} xmm2 = xmm2[0,1,2,3],xmm6[4,5,6,7] ; X32-NEXT: vpmovsxdq 16(%ebp), %xmm3 +; X32-NEXT: vpxor %xmm4, %xmm5, %xmm5 +; X32-NEXT: vpsubq %xmm4, %xmm5, %xmm5 +; X32-NEXT: vpxor %xmm4, %xmm2, %xmm2 +; X32-NEXT: vpsubq %xmm4, %xmm2, %xmm2 ; X32-NEXT: vpmovsxdq 8(%ebp), %xmm4 -; X32-NEXT: vmovdqa {{.*#+}} xmm5 = [33,0,63,0] -; X32-NEXT: vmovdqa {{.*#+}} xmm6 = [0,2147483648,0,2147483648] -; X32-NEXT: vpsrlq %xmm5, %xmm6, %xmm6 -; X32-NEXT: vextractf128 $1, %ymm2, %xmm7 -; X32-NEXT: vpsrlq %xmm5, %xmm7, %xmm7 -; X32-NEXT: vpxor %xmm6, %xmm7, %xmm7 -; X32-NEXT: vpsubq %xmm6, %xmm7, %xmm7 -; X32-NEXT: vpsrlq %xmm5, %xmm2, %xmm2 -; X32-NEXT: vpxor %xmm6, %xmm2, %xmm2 -; X32-NEXT: vpsubq %xmm6, %xmm2, %xmm2 -; X32-NEXT: vinsertf128 $1, %xmm7, %ymm2, %ymm2 +; X32-NEXT: vinsertf128 $1, %xmm5, %ymm2, %ymm2 ; X32-NEXT: vinsertf128 $1, %xmm3, %ymm4, %ymm3 ; X32-NEXT: vextractf128 $1, %ymm1, %xmm4 ; X32-NEXT: vextractf128 $1, %ymm0, %xmm5 Added: vendor/llvm/dist-release_70/test/CodeGen/X86/pr38803.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_70/test/CodeGen/X86/pr38803.ll Sun Nov 4 14:41:47 2018 (r340116) @@ -0,0 +1,48 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc < %s -mcpu=skylake-avx512 -mtriple=x86_64-unknown-unknown | FileCheck %s + +@b = local_unnamed_addr global i32 0, align 4 +@c = local_unnamed_addr global i32 0, align 4 +@d = local_unnamed_addr global float 0.000000e+00, align 4 + +define float @_Z3fn2v() { +; CHECK-LABEL: _Z3fn2v: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: pushq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 16 +; CHECK-NEXT: callq _Z1av +; CHECK-NEXT: # kill: def $al killed $al def $eax +; CHECK-NEXT: kmovd %eax, %k1 +; CHECK-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero +; CHECK-NEXT: vmovss %xmm0, %xmm0, %xmm0 {%k1} {z} +; CHECK-NEXT: cmpl $0, {{.*}}(%rip) +; CHECK-NEXT: je .LBB0_2 +; CHECK-NEXT: # %bb.1: # %if.then +; CHECK-NEXT: vcvtsi2ssl {{.*}}(%rip), %xmm1, %xmm1 +; CHECK-NEXT: kmovd %eax, %k1 +; CHECK-NEXT: vxorps %xmm2, %xmm2, %xmm2 +; CHECK-NEXT: vmovss %xmm2, %xmm0, %xmm1 {%k1} +; CHECK-NEXT: vmovss %xmm1, {{.*}}(%rip) +; CHECK-NEXT: .LBB0_2: # %if.end +; CHECK-NEXT: popq %rax +; CHECK-NEXT: .cfi_def_cfa_offset 8 +; CHECK-NEXT: retq +entry: + %call = tail call zeroext i1 @_Z1av() + %cond = select i1 %call, float 7.500000e-01, float 0.000000e+00 + %0 = load i32, i32* @c, align 4 + %tobool2 = icmp eq i32 %0, 0 + br i1 %tobool2, label %if.end, label %if.then + +if.then: ; preds = %entry + %1 = load i32, i32* @b, align 4 + %2 = sitofp i32 %1 to float + %conv5 = select i1 %call, float 0.000000e+00, float %2 + store float %conv5, float* @d, align 4 + br label %if.end + +if.end: ; preds = %entry, %if.then + ret float %cond +} + +declare zeroext i1 @_Z1av() Added: vendor/llvm/dist-release_70/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_70/test/ThinLTO/X86/Inputs/globals-import-blockaddr.ll Sun Nov 4 14:41:47 2018 (r340116) @@ -0,0 +1,12 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@label_addr = internal constant [1 x i8*] [i8* blockaddress(@foo, %lb)], align 8 + +; Function Attrs: noinline norecurse nounwind optnone uwtable +define dso_local [1 x i8*]* @foo() { + br label %lb + +lb: + ret [1 x i8*]* @label_addr +} Added: vendor/llvm/dist-release_70/test/ThinLTO/X86/globals-import-blockaddr.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_70/test/ThinLTO/X86/globals-import-blockaddr.ll Sun Nov 4 14:41:47 2018 (r340116) @@ -0,0 +1,18 @@ +; RUN: opt -module-summary %s -o %t1.bc +; RUN: opt -module-summary %p/Inputs/globals-import-blockaddr.ll -o %t2.bc +; RUN: llvm-lto2 run -save-temps %t1.bc -r=%t1.bc,foo,l -r=%t1.bc,main,pl %t2.bc -r=%t2.bc,foo,pl -o %t3 +; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s + +; Verify that we haven't imported GV containing blockaddress +; CHECK: @label_addr.llvm.0 = external hidden constant + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +declare dso_local [1 x i8*]* @foo(); + +define dso_local i32 @main() { + %p = call [1 x i8*]* @foo() + %v = ptrtoint [1 x i8*]* %p to i32 + ret i32 %v +} Added: vendor/llvm/dist-release_70/test/Transforms/InstCombine/pr39177.ll ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist-release_70/test/Transforms/InstCombine/pr39177.ll Sun Nov 4 14:41:47 2018 (r340116) @@ -0,0 +1,44 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -instcombine -S | FileCheck %s + +%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] } +%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } + +@stderr = external global %struct._IO_FILE*, align 8 +@.str = private constant [8 x i8] c"crash!\0A\00", align 1 + +@fwrite = alias i64 (i8*, i64, i64, %struct._IO_FILE*), i64 (i8*, i64, i64, %struct._IO_FILE*)* @__fwrite_alias + +define i64 @__fwrite_alias(i8* %ptr, i64 %size, i64 %n, %struct._IO_FILE* %s) { +; CHECK-LABEL: @__fwrite_alias( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret i64 0 +; +entry: + %ptr.addr = alloca i8*, align 8 + %size.addr = alloca i64, align 8 + %n.addr = alloca i64, align 8 + %s.addr = alloca %struct._IO_FILE*, align 8 + store i8* %ptr, i8** %ptr.addr, align 8 + store i64 %size, i64* %size.addr, align 8 + store i64 %n, i64* %n.addr, align 8 + store %struct._IO_FILE* %s, %struct._IO_FILE** %s.addr, align 8 + ret i64 0 +} + +define void @foo() { +; CHECK-LABEL: @foo( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = load %struct._IO_FILE*, %struct._IO_FILE** @stderr, align 8 +; CHECK-NEXT: [[TMP1:%.*]] = call i64 @__fwrite_alias(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7, i64 1, %struct._IO_FILE* [[TMP0]]) +; CHECK-NEXT: ret void +; +entry: + %retval = alloca i32, align 4 + store i32 0, i32* %retval, align 4 + %0 = load %struct._IO_FILE*, %struct._IO_FILE** @stderr, align 8 + %call = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0)) + ret void +} + +declare i32 @fprintf(%struct._IO_FILE*, i8*, ...) Modified: vendor/llvm/dist-release_70/tools/llvm-xray/xray-account.cpp ============================================================================== --- vendor/llvm/dist-release_70/tools/llvm-xray/xray-account.cpp Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/tools/llvm-xray/xray-account.cpp Sun Nov 4 14:41:47 2018 (r340116) @@ -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: vendor/llvm/dist-release_70/utils/lit/lit/__init__.py ============================================================================== --- vendor/llvm/dist-release_70/utils/lit/lit/__init__.py Sun Nov 4 14:11:38 2018 (r340115) +++ vendor/llvm/dist-release_70/utils/lit/lit/__init__.py Sun Nov 4 14:41:47 2018 (r340116) @@ -2,7 +2,7 @@ __author__ = 'Daniel Dunbar' __email__ = 'daniel@minormatter.com' -__versioninfo__ = (0, 7, 0) +__versioninfo__ = (0, 7, 1) __version__ = '.'.join(str(v) for v in __versioninfo__) + 'dev' __all__ = [] Added: vendor/llvm/dist-release_70/utils/lit/lit/builtin_commands/__init__.py ==============================================================================
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811041441.wA4EflF5060830>