Date: Sat, 18 Aug 2018 12:11:17 +0000 (UTC) From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r338014 - in projects/clang700-import: contrib/libc++/include contrib/llvm/lib/Analysis contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/lib/Target/PowerPC contrib/llvm/lib/Target/X86... Message-ID: <201808181211.w7ICBH31032092@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dim Date: Sat Aug 18 12:11:17 2018 New Revision: 338014 URL: https://svnweb.freebsd.org/changeset/base/338014 Log: Merge llvm, clang, lld, lldb, compiler-rt and libc++ release_70 branch r339999, resolve conflicts, and bump version numbers. PR: 230240,230355 Modified: projects/clang700-import/contrib/libc++/include/__config projects/clang700-import/contrib/libc++/include/cstdlib projects/clang700-import/contrib/libc++/include/ctime projects/clang700-import/contrib/libc++/include/new projects/clang700-import/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp projects/clang700-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp projects/clang700-import/contrib/llvm/lib/Analysis/MemorySSA.cpp projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp projects/clang700-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp projects/clang700-import/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td projects/clang700-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td projects/clang700-import/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/AST/DeclPrinter.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/AST/OpenMPClause.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGException.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGObjCRuntime.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGObjCRuntime.h projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.h projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGStmtOpenMP.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CodeGenFunction.h projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Driver/ToolChains/Darwin.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Frontend/InitPreprocessor.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaExprCXX.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaOpenMP.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Serialization/ASTReaderStmt.cpp projects/clang700-import/contrib/llvm/tools/clang/lib/Serialization/ASTWriterStmt.cpp projects/clang700-import/contrib/llvm/tools/lld/COFF/Driver.cpp projects/clang700-import/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp projects/clang700-import/contrib/llvm/tools/lld/docs/ReleaseNotes.rst projects/clang700-import/lib/clang/include/clang/Basic/Version.inc projects/clang700-import/lib/clang/include/lld/Common/Version.inc projects/clang700-import/lib/clang/include/lldb/Host/Config.h projects/clang700-import/lib/clang/include/llvm/Config/config.h projects/clang700-import/lib/clang/include/llvm/Config/llvm-config.h Directory Properties: projects/clang700-import/contrib/compiler-rt/ (props changed) projects/clang700-import/contrib/libc++/ (props changed) projects/clang700-import/contrib/llvm/ (props changed) projects/clang700-import/contrib/llvm/tools/clang/ (props changed) projects/clang700-import/contrib/llvm/tools/lld/ (props changed) projects/clang700-import/contrib/llvm/tools/lldb/ (props changed) Modified: projects/clang700-import/contrib/libc++/include/__config ============================================================================== --- projects/clang700-import/contrib/libc++/include/__config Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/libc++/include/__config Sat Aug 18 12:11:17 2018 (r338014) @@ -328,6 +328,31 @@ # define _LIBCPP_NO_CFI #endif +#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L +# if defined(__FreeBSD__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__Fuchsia__) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_TIMESPEC_GET +# define _LIBCPP_HAS_C11_FEATURES +# elif defined(__linux__) +# if !defined(_LIBCPP_HAS_MUSL_LIBC) +# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) +# define _LIBCPP_HAS_QUICK_EXIT +# endif +# if _LIBCPP_GLIBC_PREREQ(2, 17) +# define _LIBCPP_HAS_C11_FEATURES +# define _LIBCPP_HAS_TIMESPEC_GET +# endif +# else // defined(_LIBCPP_HAS_MUSL_LIBC) +# define _LIBCPP_HAS_QUICK_EXIT +# define _LIBCPP_HAS_TIMESPEC_GET +# define _LIBCPP_HAS_C11_FEATURES +# endif +# endif // __linux__ +#endif + #if defined(_LIBCPP_COMPILER_CLANG) // _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for @@ -430,28 +455,6 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES #endif -#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L -# if defined(__FreeBSD__) -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_C11_FEATURES -# elif defined(__Fuchsia__) -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_C11_FEATURES -# elif defined(__linux__) -# if !defined(_LIBCPP_HAS_MUSL_LIBC) -# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__) -# define _LIBCPP_HAS_QUICK_EXIT -# endif -# if _LIBCPP_GLIBC_PREREQ(2, 17) -# define _LIBCPP_HAS_C11_FEATURES -# endif -# else // defined(_LIBCPP_HAS_MUSL_LIBC) -# define _LIBCPP_HAS_QUICK_EXIT -# define _LIBCPP_HAS_C11_FEATURES -# endif -# endif // __linux__ -#endif - #if !(__has_feature(cxx_noexcept)) #define _LIBCPP_HAS_NO_NOEXCEPT #endif @@ -801,8 +804,20 @@ namespace std { # define _LIBCPP_INTERNAL_LINKAGE _LIBCPP_ALWAYS_INLINE #endif +#ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU +# ifndef _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT +# define _LIBCPP_HIDE_FROM_ABI_PER_TU 0 +# else +# define _LIBCPP_HIDE_FROM_ABI_PER_TU 1 +# endif +#endif + #ifndef _LIBCPP_HIDE_FROM_ABI -# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +# if _LIBCPP_HIDE_FROM_ABI_PER_TU +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE +# else +# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_ALWAYS_INLINE +# endif #endif // Just so we can migrate to _LIBCPP_HIDE_FROM_ABI gradually. @@ -991,6 +1006,11 @@ template <unsigned> struct __static_assert_check {}; # endif #endif // defined(__APPLE__) +#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \ + !defined(_LIBCPP_BUILDING_LIBRARY) && \ + (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606) +# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +#endif #if defined(__APPLE__) || defined(__FreeBSD__) #define _LIBCPP_HAS_DEFAULTRUNELOCALE Modified: projects/clang700-import/contrib/libc++/include/cstdlib ============================================================================== --- projects/clang700-import/contrib/libc++/include/cstdlib Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/libc++/include/cstdlib Sat Aug 18 12:11:17 2018 (r338014) @@ -151,11 +151,11 @@ using ::mbtowc; using ::wctomb; using ::mbstowcs; using ::wcstombs; -#ifdef _LIBCPP_HAS_QUICK_EXIT +#if !defined(_LIBCPP_CXX03_LANG) && defined(_LIBCPP_HAS_QUICK_EXIT) using ::at_quick_exit; using ::quick_exit; #endif -#ifdef _LIBCPP_HAS_C11_FEATURES +#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) using ::aligned_alloc; #endif Modified: projects/clang700-import/contrib/libc++/include/ctime ============================================================================== --- projects/clang700-import/contrib/libc++/include/ctime Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/libc++/include/ctime Sat Aug 18 12:11:17 2018 (r338014) @@ -73,7 +73,7 @@ using ::gmtime; using ::localtime; #endif using ::strftime; -#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_C11_FEATURES) +#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) using ::timespec_get; #endif Modified: projects/clang700-import/contrib/libc++/include/new ============================================================================== --- projects/clang700-import/contrib/libc++/include/new Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/libc++/include/new Sat Aug 18 12:11:17 2018 (r338014) @@ -108,13 +108,6 @@ void operator delete[](void* ptr, void*) noexcept; # define _LIBCPP_HAS_NO_SIZED_DEALLOCATION #endif -#if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) && \ - (!(defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_STD_VER > 14 || \ - (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606))) -# define _LIBCPP_HAS_NO_ALIGNED_ALLOCATION -#endif - - #if !__has_builtin(__builtin_operator_new) || \ __has_builtin(__builtin_operator_new) < 201802L || \ defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \ Modified: projects/clang700-import/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/Analysis/BasicAliasAnalysis.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -801,14 +801,15 @@ ModRefInfo BasicAAResult::getModRefInfo(ImmutableCallS const Value *Object = GetUnderlyingObject(Loc.Ptr, DL); - // If this is a tail call and Loc.Ptr points to a stack location, we know that - // the tail call cannot access or modify the local stack. - // We cannot exclude byval arguments here; these belong to the caller of - // the current function not to the current function, and a tail callee - // may reference them. + // Calls marked 'tail' cannot read or write allocas from the current frame + // because the current frame might be destroyed by the time they run. However, + // a tail call may use an alloca with byval. Calling with byval copies the + // contents of the alloca into argument registers or stack slots, so there is + // no lifetime issue. if (isa<AllocaInst>(Object)) if (const CallInst *CI = dyn_cast<CallInst>(CS.getInstruction())) - if (CI->isTailCall()) + if (CI->isTailCall() && + !CI->getAttributes().hasAttrSomewhere(Attribute::ByVal)) return ModRefInfo::NoModRef; // If the pointer is to a locally allocated object that does not escape, Modified: projects/clang700-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/Analysis/InstructionSimplify.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -1338,7 +1338,7 @@ static Value *SimplifyLShrInst(Value *Op0, Value *Op1, const KnownBits YKnown = computeKnownBits(Y, Q.DL, 0, Q.AC, Q.CxtI, Q.DT); const unsigned Width = Op0->getType()->getScalarSizeInBits(); const unsigned EffWidthY = Width - YKnown.countMinLeadingZeros(); - if (EffWidthY <= ShRAmt->getZExtValue()) + if (ShRAmt->uge(EffWidthY)) return X; } @@ -1878,9 +1878,9 @@ static Value *SimplifyAndInst(Value *Op0, Value *Op1, match(Op0, m_c_Or(m_CombineAnd(m_NUWShl(m_Value(X), m_APInt(ShAmt)), m_Value(XShifted)), m_Value(Y)))) { - const unsigned ShftCnt = ShAmt->getZExtValue(); - const KnownBits YKnown = computeKnownBits(Y, Q.DL, 0, Q.AC, Q.CxtI, Q.DT); const unsigned Width = Op0->getType()->getScalarSizeInBits(); + const unsigned ShftCnt = ShAmt->getLimitedValue(Width); + const KnownBits YKnown = computeKnownBits(Y, Q.DL, 0, Q.AC, Q.CxtI, Q.DT); const unsigned EffWidthY = Width - YKnown.countMinLeadingZeros(); if (EffWidthY <= ShftCnt) { const KnownBits XKnown = computeKnownBits(X, Q.DL, 0, Q.AC, Q.CxtI, Modified: projects/clang700-import/contrib/llvm/lib/Analysis/MemorySSA.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Analysis/MemorySSA.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/Analysis/MemorySSA.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -258,13 +258,18 @@ static ClobberAlias instructionClobbersQuery(MemoryDef if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(DefInst)) { // These intrinsics will show up as affecting memory, but they are just - // markers. + // markers, mostly. + // + // FIXME: We probably don't actually want MemorySSA to model these at all + // (including creating MemoryAccesses for them): we just end up inventing + // clobbers where they don't really exist at all. Please see D43269 for + // context. switch (II->getIntrinsicID()) { case Intrinsic::lifetime_start: if (UseCS) return {false, NoAlias}; AR = AA.alias(MemoryLocation(II->getArgOperand(1)), UseLoc); - return {AR == MustAlias, AR}; + return {AR != NoAlias, AR}; case Intrinsic::lifetime_end: case Intrinsic::invariant_start: case Intrinsic::invariant_end: Modified: projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -1778,15 +1778,16 @@ SDValue DAGTypeLegalizer::PromoteFloatOp_BITCAST(SDNod SDValue Op = N->getOperand(0); EVT OpVT = Op->getValueType(0); - EVT IVT = EVT::getIntegerVT(*DAG.getContext(), OpVT.getSizeInBits()); - assert (IVT == N->getValueType(0) && "Bitcast to type of different size"); - SDValue Promoted = GetPromotedFloat(N->getOperand(0)); EVT PromotedVT = Promoted->getValueType(0); // Convert the promoted float value to the desired IVT. - return DAG.getNode(GetPromotionOpcode(PromotedVT, OpVT), SDLoc(N), IVT, - Promoted); + EVT IVT = EVT::getIntegerVT(*DAG.getContext(), OpVT.getSizeInBits()); + SDValue Convert = DAG.getNode(GetPromotionOpcode(PromotedVT, OpVT), SDLoc(N), + IVT, Promoted); + // The final result type might not be an scalar so we need a bitcast. The + // bitcast will be further legalized if needed. + return DAG.getBitcast(N->getValueType(0), Convert); } // Promote Operand 1 of FCOPYSIGN. Operand 0 ought to be handled by @@ -1941,8 +1942,12 @@ void DAGTypeLegalizer::PromoteFloatResult(SDNode *N, u SDValue DAGTypeLegalizer::PromoteFloatRes_BITCAST(SDNode *N) { EVT VT = N->getValueType(0); EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT); - return DAG.getNode(GetPromotionOpcode(VT, NVT), SDLoc(N), NVT, - N->getOperand(0)); + // Input type isn't guaranteed to be a scalar int so bitcast if not. The + // bitcast will be legalized further if necessary. + EVT IVT = EVT::getIntegerVT(*DAG.getContext(), + N->getOperand(0).getValueType().getSizeInBits()); + SDValue Cast = DAG.getBitcast(IVT, N->getOperand(0)); + return DAG.getNode(GetPromotionOpcode(VT, NVT), SDLoc(N), NVT, Cast); } SDValue DAGTypeLegalizer::PromoteFloatRes_ConstantFP(SDNode *N) { Modified: projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -269,8 +269,8 @@ SDValue DAGTypeLegalizer::PromoteIntRes_BITCAST(SDNode return DAG.getNode(ISD::ANY_EXTEND, dl, NOutVT, GetSoftenedFloat(InOp)); case TargetLowering::TypePromoteFloat: { // Convert the promoted float by hand. - SDValue PromotedOp = GetPromotedFloat(InOp); - return DAG.getNode(ISD::FP_TO_FP16, dl, NOutVT, PromotedOp); + if (!NOutVT.isVector()) + return DAG.getNode(ISD::FP_TO_FP16, dl, NOutVT, GetPromotedFloat(InOp)); break; } case TargetLowering::TypeExpandInteger: Modified: projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -2374,7 +2374,7 @@ void SelectionDAG::computeKnownBits(SDValue Op, KnownB if (SubIdx && SubIdx->getAPIntValue().ule(NumSrcElts - NumElts)) { // Offset the demanded elts by the subvector index. uint64_t Idx = SubIdx->getZExtValue(); - APInt DemandedSrc = DemandedElts.zext(NumSrcElts).shl(Idx); + APInt DemandedSrc = DemandedElts.zextOrSelf(NumSrcElts).shl(Idx); computeKnownBits(Src, Known, DemandedSrc, Depth + 1); } else { computeKnownBits(Src, Known, Depth + 1); @@ -3533,7 +3533,7 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, if (SubIdx && SubIdx->getAPIntValue().ule(NumSrcElts - NumElts)) { // Offset the demanded elts by the subvector index. uint64_t Idx = SubIdx->getZExtValue(); - APInt DemandedSrc = DemandedElts.zext(NumSrcElts).shl(Idx); + APInt DemandedSrc = DemandedElts.zextOrSelf(NumSrcElts).shl(Idx); return ComputeNumSignBits(Src, DemandedSrc, Depth + 1); } return ComputeNumSignBits(Src, Depth + 1); Modified: projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -7768,10 +7768,29 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCall SDValue Val = RetValRegs.getCopyFromRegs(DAG, FuncInfo, getCurSDLoc(), Chain, &Flag, CS.getInstruction()); - // FIXME: Why don't we do this for inline asms with MRVs? - if (CS.getType()->isSingleValueType() && CS.getType()->isSized()) { - EVT ResultType = TLI.getValueType(DAG.getDataLayout(), CS.getType()); - + llvm::Type *CSResultType = CS.getType(); + unsigned numRet; + ArrayRef<Type *> ResultTypes; + SmallVector<SDValue, 1> ResultValues(1); + if (CSResultType->isSingleValueType()) { + numRet = 1; + ResultValues[0] = Val; + ResultTypes = makeArrayRef(CSResultType); + } else { + numRet = CSResultType->getNumContainedTypes(); + assert(Val->getNumOperands() == numRet && + "Mismatch in number of output operands in asm result"); + ResultTypes = CSResultType->subtypes(); + ArrayRef<SDUse> ValueUses = Val->ops(); + ResultValues.resize(numRet); + std::transform(ValueUses.begin(), ValueUses.end(), ResultValues.begin(), + [](const SDUse &u) -> SDValue { return u.get(); }); + } + SmallVector<EVT, 1> ResultVTs(numRet); + for (unsigned i = 0; i < numRet; i++) { + EVT ResultVT = TLI.getValueType(DAG.getDataLayout(), ResultTypes[i]); + SDValue Val = ResultValues[i]; + assert(ResultTypes[i]->isSized() && "Unexpected unsized type"); // If the type of the inline asm call site return value is different but // has same size as the type of the asm output bitcast it. One example // of this is for vectors with different width / number of elements. @@ -7782,22 +7801,24 @@ void SelectionDAGBuilder::visitInlineAsm(ImmutableCall // This can also happen for a return value that disagrees with the // register class it is put in, eg. a double in a general-purpose // register on a 32-bit machine. - if (ResultType != Val.getValueType() && - ResultType.getSizeInBits() == Val.getValueSizeInBits()) { - Val = DAG.getNode(ISD::BITCAST, getCurSDLoc(), - ResultType, Val); - - } else if (ResultType != Val.getValueType() && - ResultType.isInteger() && Val.getValueType().isInteger()) { - // If a result value was tied to an input value, the computed result may - // have a wider width than the expected result. Extract the relevant - // portion. - Val = DAG.getNode(ISD::TRUNCATE, getCurSDLoc(), ResultType, Val); + if (ResultVT != Val.getValueType() && + ResultVT.getSizeInBits() == Val.getValueSizeInBits()) + Val = DAG.getNode(ISD::BITCAST, getCurSDLoc(), ResultVT, Val); + else if (ResultVT != Val.getValueType() && ResultVT.isInteger() && + Val.getValueType().isInteger()) { + // If a result value was tied to an input value, the computed result + // may have a wider width than the expected result. Extract the + // relevant portion. + Val = DAG.getNode(ISD::TRUNCATE, getCurSDLoc(), ResultVT, Val); } - assert(ResultType == Val.getValueType() && "Asm result value mismatch!"); + assert(ResultVT == Val.getValueType() && "Asm result value mismatch!"); + ResultVTs[i] = ResultVT; + ResultValues[i] = Val; } + Val = DAG.getNode(ISD::MERGE_VALUES, getCurSDLoc(), + DAG.getVTList(ResultVTs), ResultValues); setValue(CS.getInstruction(), Val); // Don't need to use this as a chain in this case. if (!IA->hasSideEffects() && !hasMemory && IndirectStoresToEmit.empty()) Modified: projects/clang700-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/Target/PowerPC/PPCISelLowering.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -12007,10 +12007,15 @@ static SDValue combineBVOfVecSExt(SDNode *N, Selection auto isSExtOfVecExtract = [&](SDValue Op) -> bool { if (!Op) return false; - if (Op.getOpcode() != ISD::SIGN_EXTEND) + if (Op.getOpcode() != ISD::SIGN_EXTEND && + Op.getOpcode() != ISD::SIGN_EXTEND_INREG) return false; + // A SIGN_EXTEND_INREG might be fed by an ANY_EXTEND to produce a value + // of the right width. SDValue Extract = Op.getOperand(0); + if (Extract.getOpcode() == ISD::ANY_EXTEND) + Extract = Extract.getOperand(0); if (Extract.getOpcode() != ISD::EXTRACT_VECTOR_ELT) return false; @@ -12098,8 +12103,10 @@ SDValue PPCTargetLowering::DAGCombineBuildVector(SDNod return Reduced; // If we're building a vector out of extended elements from another vector - // we have P9 vector integer extend instructions. - if (Subtarget.hasP9Altivec()) { + // we have P9 vector integer extend instructions. The code assumes legal + // input types (i.e. it can't handle things like v4i16) so do not run before + // legalization. + if (Subtarget.hasP9Altivec() && !DCI.isBeforeLegalize()) { Reduced = combineBVOfVecSExt(N, DAG); if (Reduced) return Reduced; Modified: projects/clang700-import/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -97,6 +97,7 @@ class X86FlagsCopyLoweringPass : public MachineFunctio private: MachineRegisterInfo *MRI; + const X86Subtarget *Subtarget; const X86InstrInfo *TII; const TargetRegisterInfo *TRI; const TargetRegisterClass *PromoteRC; @@ -346,10 +347,10 @@ bool X86FlagsCopyLoweringPass::runOnMachineFunction(Ma LLVM_DEBUG(dbgs() << "********** " << getPassName() << " : " << MF.getName() << " **********\n"); - auto &Subtarget = MF.getSubtarget<X86Subtarget>(); + Subtarget = &MF.getSubtarget<X86Subtarget>(); MRI = &MF.getRegInfo(); - TII = Subtarget.getInstrInfo(); - TRI = Subtarget.getRegisterInfo(); + TII = Subtarget->getInstrInfo(); + TRI = Subtarget->getRegisterInfo(); MDT = &getAnalysis<MachineDominatorTree>(); PromoteRC = &X86::GR8RegClass; @@ -960,10 +961,14 @@ void X86FlagsCopyLoweringPass::rewriteSetCarryExtended .addReg(Reg) .addImm(SubRegIdx[OrigRegSize]); } else if (OrigRegSize > TargetRegSize) { - BuildMI(MBB, SetPos, SetLoc, TII->get(TargetOpcode::EXTRACT_SUBREG), + if (TargetRegSize == 1 && !Subtarget->is64Bit()) { + // Need to constrain the register class. + MRI->constrainRegClass(Reg, &X86::GR32_ABCDRegClass); + } + + BuildMI(MBB, SetPos, SetLoc, TII->get(TargetOpcode::COPY), NewReg) - .addReg(Reg) - .addImm(SubRegIdx[TargetRegSize]); + .addReg(Reg, 0, SubRegIdx[TargetRegSize]); } else { BuildMI(MBB, SetPos, SetLoc, TII->get(TargetOpcode::COPY), NewReg) .addReg(Reg); Modified: projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -3109,14 +3109,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { } if (NeedToShuffleReuses) { // TODO: Merge this shuffle with the ReorderShuffleMask. - if (!E->ReorderIndices.empty()) + if (E->ReorderIndices.empty()) Builder.SetInsertPoint(VL0); - else if (auto *I = dyn_cast<Instruction>(V)) - Builder.SetInsertPoint(I->getParent(), - std::next(I->getIterator())); - else - Builder.SetInsertPoint(&F->getEntryBlock(), - F->getEntryBlock().getFirstInsertionPt()); V = Builder.CreateShuffleVector(V, UndefValue::get(VecTy), E->ReuseShuffleIndices, "shuffle"); } Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/ASTContext.h Sat Aug 18 12:11:17 2018 (r338014) @@ -2718,7 +2718,7 @@ class ASTContext : public RefCountedBase<ASTContext> { /// predicate. void forEachMultiversionedFunctionVersion( const FunctionDecl *FD, - llvm::function_ref<void(const FunctionDecl *)> Pred) const; + llvm::function_ref<void(FunctionDecl *)> Pred) const; const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD); Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/AST/OpenMPClause.h Sat Aug 18 12:11:17 2018 (r338014) @@ -922,8 +922,11 @@ class OMPScheduleClause : public OMPClause, public OMP /// \endcode /// In this example directive '#pragma omp for' has 'ordered' clause with /// parameter 2. -class OMPOrderedClause : public OMPClause { +class OMPOrderedClause final + : public OMPClause, + private llvm::TrailingObjects<OMPOrderedClause, Expr *> { friend class OMPClauseReader; + friend TrailingObjects; /// Location of '('. SourceLocation LParenLoc; @@ -931,6 +934,26 @@ class OMPOrderedClause : public OMPClause { /// Number of for-loops. Stmt *NumForLoops = nullptr; + /// Real number of loops. + unsigned NumberOfLoops = 0; + + /// Build 'ordered' clause. + /// + /// \param Num Expression, possibly associated with this clause. + /// \param NumLoops Number of loops, associated with this clause. + /// \param StartLoc Starting location of the clause. + /// \param LParenLoc Location of '('. + /// \param EndLoc Ending location of the clause. + OMPOrderedClause(Expr *Num, unsigned NumLoops, SourceLocation StartLoc, + SourceLocation LParenLoc, SourceLocation EndLoc) + : OMPClause(OMPC_ordered, StartLoc, EndLoc), LParenLoc(LParenLoc), + NumForLoops(Num), NumberOfLoops(NumLoops) {} + + /// Build an empty clause. + explicit OMPOrderedClause(unsigned NumLoops) + : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()), + NumberOfLoops(NumLoops) {} + /// Set the number of associated for-loops. void setNumForLoops(Expr *Num) { NumForLoops = Num; } @@ -938,17 +961,17 @@ class OMPOrderedClause : public OMPClause { /// Build 'ordered' clause. /// /// \param Num Expression, possibly associated with this clause. + /// \param NumLoops Number of loops, associated with this clause. /// \param StartLoc Starting location of the clause. /// \param LParenLoc Location of '('. /// \param EndLoc Ending location of the clause. - OMPOrderedClause(Expr *Num, SourceLocation StartLoc, - SourceLocation LParenLoc, SourceLocation EndLoc) - : OMPClause(OMPC_ordered, StartLoc, EndLoc), LParenLoc(LParenLoc), - NumForLoops(Num) {} + static OMPOrderedClause *Create(const ASTContext &C, Expr *Num, + unsigned NumLoops, SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation EndLoc); /// Build an empty clause. - explicit OMPOrderedClause() - : OMPClause(OMPC_ordered, SourceLocation(), SourceLocation()) {} + static OMPOrderedClause* CreateEmpty(const ASTContext &C, unsigned NumLoops); /// Sets the location of '('. void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } @@ -959,6 +982,17 @@ class OMPOrderedClause : public OMPClause { /// Return the number of associated for-loops. Expr *getNumForLoops() const { return cast_or_null<Expr>(NumForLoops); } + /// Set number of iterations for the specified loop. + void setLoopNumIterations(unsigned NumLoop, Expr *NumIterations); + /// Get number of iterations for all the loops. + ArrayRef<Expr *> getLoopNumIterations() const; + + /// Set loop counter for the specified loop. + void setLoopCounter(unsigned NumLoop, Expr *Counter); + /// Get loops counter for the specified loop. + Expr *getLoopCunter(unsigned NumLoop); + const Expr *getLoopCunter(unsigned NumLoop) const; + child_range children() { return child_range(&NumForLoops, &NumForLoops + 1); } static bool classof(const OMPClause *T) { @@ -3087,24 +3121,32 @@ class OMPDependClause final /// Colon location. SourceLocation ColonLoc; + /// Number of loops, associated with the depend clause. + unsigned NumLoops = 0; + /// Build clause with number of variables \a N. /// /// \param StartLoc Starting location of the clause. /// \param LParenLoc Location of '('. /// \param EndLoc Ending location of the clause. /// \param N Number of the variables in the clause. + /// \param NumLoops Number of loops that is associated with this depend + /// clause. OMPDependClause(SourceLocation StartLoc, SourceLocation LParenLoc, - SourceLocation EndLoc, unsigned N) + SourceLocation EndLoc, unsigned N, unsigned NumLoops) : OMPVarListClause<OMPDependClause>(OMPC_depend, StartLoc, LParenLoc, - EndLoc, N) {} + EndLoc, N), NumLoops(NumLoops) {} /// Build an empty clause. /// /// \param N Number of variables. - explicit OMPDependClause(unsigned N) + /// \param NumLoops Number of loops that is associated with this depend + /// clause. + explicit OMPDependClause(unsigned N, unsigned NumLoops) : OMPVarListClause<OMPDependClause>(OMPC_depend, SourceLocation(), SourceLocation(), SourceLocation(), - N) {} + N), + NumLoops(NumLoops) {} /// Set dependency kind. void setDependencyKind(OpenMPDependClauseKind K) { DepKind = K; } @@ -3126,16 +3168,23 @@ class OMPDependClause final /// \param DepLoc Location of the dependency type. /// \param ColonLoc Colon location. /// \param VL List of references to the variables. - static OMPDependClause * - Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, - SourceLocation EndLoc, OpenMPDependClauseKind DepKind, - SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL); + /// \param NumLoops Number of loops that is associated with this depend + /// clause. + static OMPDependClause *Create(const ASTContext &C, SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation EndLoc, + OpenMPDependClauseKind DepKind, + SourceLocation DepLoc, SourceLocation ColonLoc, + ArrayRef<Expr *> VL, unsigned NumLoops); /// Creates an empty clause with \a N variables. /// /// \param C AST context. /// \param N The number of variables. - static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N); + /// \param NumLoops Number of loops that is associated with this depend + /// clause. + static OMPDependClause *CreateEmpty(const ASTContext &C, unsigned N, + unsigned NumLoops); /// Get dependency type. OpenMPDependClauseKind getDependencyKind() const { return DepKind; } @@ -3146,15 +3195,16 @@ class OMPDependClause final /// Get colon location. SourceLocation getColonLoc() const { return ColonLoc; } - /// Set the loop counter value for the depend clauses with 'sink|source' kind - /// of dependency. Required for codegen. - void setCounterValue(Expr *V); + /// Get number of loops associated with the clause. + unsigned getNumLoops() const { return NumLoops; } - /// Get the loop counter value. - Expr *getCounterValue(); + /// Set the loop data for the depend clauses with 'sink|source' kind of + /// dependency. + void setLoopData(unsigned NumLoop, Expr *Cnt); - /// Get the loop counter value. - const Expr *getCounterValue() const; + /// Get the loop data. + Expr *getLoopData(unsigned NumLoop); + const Expr *getLoopData(unsigned NumLoop) const; child_range children() { return child_range(reinterpret_cast<Stmt **>(varlist_begin()), Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/Attr.td Sat Aug 18 12:11:17 2018 (r338014) @@ -2938,9 +2938,10 @@ def OMPDeclareSimdDecl : Attr { }]; } -def OMPDeclareTargetDecl : Attr { +def OMPDeclareTargetDecl : InheritableAttr { let Spellings = [Pragma<"omp", "declare target">]; let SemaHandler = 0; + let Subjects = SubjectList<[Function, SharedVar]>; let Documentation = [OMPDeclareTargetDocs]; let Args = [ EnumArgument<"MapType", "MapTypeTy", @@ -2952,6 +2953,15 @@ def OMPDeclareTargetDecl : Attr { // Use fake syntax because it is for testing and debugging purpose only. if (getMapType() != MT_To) OS << ' ' << ConvertMapTypeTyToStr(getMapType()); + } + static llvm::Optional<MapTypeTy> + isDeclareTargetDeclaration(const ValueDecl *VD) { + if (!VD->hasAttrs()) + return llvm::None; + if (const auto *Attr = VD->getAttr<OMPDeclareTargetDeclAttr>()) + return Attr->getMapType(); + + return llvm::None; } }]; } Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticGroups.td Sat Aug 18 12:11:17 2018 (r338014) @@ -364,7 +364,6 @@ def NonVirtualDtor : DiagGroup<"non-virtual-dtor">; def NullPointerArithmetic : DiagGroup<"null-pointer-arithmetic">; def : DiagGroup<"effc++", [NonVirtualDtor]>; def OveralignedType : DiagGroup<"over-aligned">; -def AlignedAllocationUnavailable : DiagGroup<"aligned-allocation-unavailable">; def OldStyleCast : DiagGroup<"old-style-cast">; def : DiagGroup<"old-style-definition">; def OutOfLineDeclaration : DiagGroup<"out-of-line-declaration">; Modified: projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td Sat Aug 18 12:11:17 2018 (r338014) @@ -6465,12 +6465,12 @@ def warn_overaligned_type : Warning< "type %0 requires %1 bytes of alignment and the default allocator only " "guarantees %2 bytes">, InGroup<OveralignedType>, DefaultIgnore; -def warn_aligned_allocation_unavailable :Warning< +def err_aligned_allocation_unavailable : Error< "aligned %select{allocation|deallocation}0 function of type '%1' is only " - "available on %2 %3 or newer">, InGroup<AlignedAllocationUnavailable>, DefaultError; + "available on %2 %3 or newer">; def note_silence_unligned_allocation_unavailable : Note< "if you supply your own aligned allocation functions, use " - "-Wno-aligned-allocation-unavailable to silence this diagnostic">; + "-faligned-allocation to silence this diagnostic">; def err_conditional_void_nonvoid : Error< "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand " 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 Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/include/clang/Driver/Options.td Sat Aug 18 12:11:17 2018 (r338014) @@ -1488,7 +1488,7 @@ def fobjc_weak : Flag<["-"], "fobjc-weak">, Group<f_Gr HelpText<"Enable ARC-style weak references in Objective-C">; // Objective-C ABI options. -def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group<f_Group>, Flags<[CC1Option]>, +def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group<f_Group>, Flags<[CC1Option, CoreOption]>, HelpText<"Specify the target Objective-C runtime kind and version">; def fobjc_abi_version_EQ : Joined<["-"], "fobjc-abi-version=">, Group<f_Group>; def fobjc_nonfragile_abi_version_EQ : Joined<["-"], "fobjc-nonfragile-abi-version=">, Group<f_Group>; Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/AST/ASTContext.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -9798,20 +9798,16 @@ bool ASTContext::DeclMustBeEmitted(const Decl *D) { return true; // If the decl is marked as `declare target`, it should be emitted. - for (const auto *Decl : D->redecls()) { - if (!Decl->hasAttrs()) - continue; - if (const auto *Attr = Decl->getAttr<OMPDeclareTargetDeclAttr>()) - if (Attr->getMapType() != OMPDeclareTargetDeclAttr::MT_Link) - return true; - } + if (const llvm::Optional<OMPDeclareTargetDeclAttr::MapTypeTy> Res = + OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD)) + return *Res != OMPDeclareTargetDeclAttr::MT_Link; return false; } void ASTContext::forEachMultiversionedFunctionVersion( const FunctionDecl *FD, - llvm::function_ref<void(const FunctionDecl *)> Pred) const { + llvm::function_ref<void(FunctionDecl *)> Pred) const { assert(FD->isMultiVersion() && "Only valid for multiversioned functions"); llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls; FD = FD->getCanonicalDecl(); Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/AST/DeclPrinter.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/AST/DeclPrinter.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/AST/DeclPrinter.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -1091,6 +1091,10 @@ void DeclPrinter::VisitFunctionTemplateDecl(FunctionTe printTemplateParameters(FD->getTemplateParameterList(I)); } VisitRedeclarableTemplateDecl(D); + // Declare target attribute is special one, natural spelling for the pragma + // assumes "ending" construct so print it here. + if (D->getTemplatedDecl()->hasAttr<OMPDeclareTargetDeclAttr>()) + Out << "#pragma omp end declare target\n"; // Never print "instantiations" for deduction guides (they don't really // have them). Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/AST/MicrosoftMangle.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -445,7 +445,7 @@ void MicrosoftCXXNameMangler::mangle(const NamedDecl * mangleFunctionEncoding(FD, Context.shouldMangleDeclName(FD)); else if (const VarDecl *VD = dyn_cast<VarDecl>(D)) mangleVariableEncoding(VD); - else + else if (!isa<ObjCInterfaceDecl>(D)) llvm_unreachable("Tried to mangle unexpected NamedDecl!"); } @@ -1884,13 +1884,13 @@ void MicrosoftCXXNameMangler::mangleType(const Builtin llvm_unreachable("placeholder types shouldn't get to name mangling"); case BuiltinType::ObjCId: - mangleArtificalTagType(TTK_Struct, "objc_object"); + mangleArtificalTagType(TTK_Struct, ".objc_object"); break; case BuiltinType::ObjCClass: - mangleArtificalTagType(TTK_Struct, "objc_class"); + mangleArtificalTagType(TTK_Struct, ".objc_class"); break; case BuiltinType::ObjCSel: - mangleArtificalTagType(TTK_Struct, "objc_selector"); + mangleArtificalTagType(TTK_Struct, ".objc_selector"); break; #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ @@ -2570,9 +2570,10 @@ void MicrosoftCXXNameMangler::mangleType(const Depende void MicrosoftCXXNameMangler::mangleType(const ObjCInterfaceType *T, Qualifiers, SourceRange) { - // ObjC interfaces have structs underlying them. + // ObjC interfaces are mangled as if they were structs with a name that is + // not a valid C/C++ identifier mangleTagTypeKind(TTK_Struct); - mangleName(T->getDecl()); + mangle(T->getDecl(), ".objc_cls_"); } void MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *T, Qualifiers, @@ -2590,11 +2591,11 @@ void MicrosoftCXXNameMangler::mangleType(const ObjCObj Out << "?$"; if (T->isObjCId()) - mangleSourceName("objc_object"); + mangleSourceName(".objc_object"); else if (T->isObjCClass()) - mangleSourceName("objc_class"); + mangleSourceName(".objc_class"); else - mangleSourceName(T->getInterface()->getName()); + mangleSourceName((".objc_cls_" + T->getInterface()->getName()).str()); for (const auto &Q : T->quals()) mangleObjCProtocol(Q); Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/AST/OpenMPClause.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/AST/OpenMPClause.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/AST/OpenMPClause.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -181,6 +181,57 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate return nullptr; } +OMPOrderedClause *OMPOrderedClause::Create(const ASTContext &C, Expr *Num, + unsigned NumLoops, + SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation EndLoc) { + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops)); + auto *Clause = + new (Mem) OMPOrderedClause(Num, NumLoops, StartLoc, LParenLoc, EndLoc); + for (unsigned I = 0; I < NumLoops; ++I) { + Clause->setLoopNumIterations(I, nullptr); + Clause->setLoopCounter(I, nullptr); + } + return Clause; +} + +OMPOrderedClause *OMPOrderedClause::CreateEmpty(const ASTContext &C, + unsigned NumLoops) { + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(2 * NumLoops)); + auto *Clause = new (Mem) OMPOrderedClause(NumLoops); + for (unsigned I = 0; I < NumLoops; ++I) { + Clause->setLoopNumIterations(I, nullptr); + Clause->setLoopCounter(I, nullptr); + } + return Clause; +} + +void OMPOrderedClause::setLoopNumIterations(unsigned NumLoop, + Expr *NumIterations) { + assert(NumLoop < NumberOfLoops && "out of loops number."); + getTrailingObjects<Expr *>()[NumLoop] = NumIterations; +} + +ArrayRef<Expr *> OMPOrderedClause::getLoopNumIterations() const { + return llvm::makeArrayRef(getTrailingObjects<Expr *>(), NumberOfLoops); +} + +void OMPOrderedClause::setLoopCounter(unsigned NumLoop, Expr *Counter) { + assert(NumLoop < NumberOfLoops && "out of loops number."); + getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop] = Counter; +} + +Expr *OMPOrderedClause::getLoopCunter(unsigned NumLoop) { + assert(NumLoop < NumberOfLoops && "out of loops number."); + return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop]; +} + +const Expr *OMPOrderedClause::getLoopCunter(unsigned NumLoop) const { + assert(NumLoop < NumberOfLoops && "out of loops number."); + return getTrailingObjects<Expr *>()[NumberOfLoops + NumLoop]; +} + void OMPPrivateClause::setPrivateCopies(ArrayRef<Expr *> VL) { assert(VL.size() == varlist_size() && "Number of private copies is not the same as the preallocated buffer"); @@ -653,44 +704,58 @@ OMPFlushClause *OMPFlushClause::CreateEmpty(const ASTC return new (Mem) OMPFlushClause(N); } -OMPDependClause *OMPDependClause::Create( - const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, - SourceLocation EndLoc, OpenMPDependClauseKind DepKind, - SourceLocation DepLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VL) { - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + 1)); - OMPDependClause *Clause = - new (Mem) OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size()); +OMPDependClause * +OMPDependClause::Create(const ASTContext &C, SourceLocation StartLoc, + SourceLocation LParenLoc, SourceLocation EndLoc, + OpenMPDependClauseKind DepKind, SourceLocation DepLoc, + SourceLocation ColonLoc, ArrayRef<Expr *> VL, + unsigned NumLoops) { + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size() + NumLoops)); + OMPDependClause *Clause = new (Mem) + OMPDependClause(StartLoc, LParenLoc, EndLoc, VL.size(), NumLoops); Clause->setVarRefs(VL); Clause->setDependencyKind(DepKind); Clause->setDependencyLoc(DepLoc); Clause->setColonLoc(ColonLoc); - Clause->setCounterValue(nullptr); + for (unsigned I = 0 ; I < NumLoops; ++I) + Clause->setLoopData(I, nullptr); return Clause; } -OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext &C, unsigned N) { - void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N + 1)); - return new (Mem) OMPDependClause(N); +OMPDependClause *OMPDependClause::CreateEmpty(const ASTContext &C, unsigned N, + unsigned NumLoops) { + void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N + NumLoops)); + return new (Mem) OMPDependClause(N, NumLoops); } -void OMPDependClause::setCounterValue(Expr *V) { - assert(getDependencyKind() == OMPC_DEPEND_sink || - getDependencyKind() == OMPC_DEPEND_source || V == nullptr); - *getVarRefs().end() = V; +void OMPDependClause::setLoopData(unsigned NumLoop, Expr *Cnt) { + assert((getDependencyKind() == OMPC_DEPEND_sink || + getDependencyKind() == OMPC_DEPEND_source) && + NumLoop < NumLoops && + "Expected sink or source depend + loop index must be less number of " + "loops."); + auto It = std::next(getVarRefs().end(), NumLoop); + *It = Cnt; } -const Expr *OMPDependClause::getCounterValue() const { - auto *V = *getVarRefs().end(); - assert(getDependencyKind() == OMPC_DEPEND_sink || - getDependencyKind() == OMPC_DEPEND_source || V == nullptr); - return V; +Expr *OMPDependClause::getLoopData(unsigned NumLoop) { + assert((getDependencyKind() == OMPC_DEPEND_sink || + getDependencyKind() == OMPC_DEPEND_source) && + NumLoop < NumLoops && + "Expected sink or source depend + loop index must be less number of " + "loops."); + auto It = std::next(getVarRefs().end(), NumLoop); + return *It; } -Expr *OMPDependClause::getCounterValue() { - auto *V = *getVarRefs().end(); - assert(getDependencyKind() == OMPC_DEPEND_sink || - getDependencyKind() == OMPC_DEPEND_source || V == nullptr); - return V; +const Expr *OMPDependClause::getLoopData(unsigned NumLoop) const { + assert((getDependencyKind() == OMPC_DEPEND_sink || + getDependencyKind() == OMPC_DEPEND_source) && + NumLoop < NumLoops && + "Expected sink or source depend + loop index must be less number of " + "loops."); + auto It = std::next(getVarRefs().end(), NumLoop); + return *It; } unsigned OMPClauseMappableExprCommon::getComponentsTotalNumber( Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGException.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGException.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGException.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -1829,7 +1829,7 @@ void CodeGenFunction::startOutlinedSEHHelper(CodeGenFu SmallString<128> Name; { llvm::raw_svector_ostream OS(Name); - const FunctionDecl *ParentSEHFn = ParentCGF.CurSEHParent; + const NamedDecl *ParentSEHFn = ParentCGF.CurSEHParent; assert(ParentSEHFn && "No CurSEHParent!"); MangleContext &Mangler = CGM.getCXXABI().getMangleContext(); if (IsFilter) @@ -1970,6 +1970,11 @@ llvm::Value *CodeGenFunction::EmitSEHAbnormalTerminati // helper. auto AI = CurFn->arg_begin(); return Builder.CreateZExt(&*AI, Int32Ty); +} + +void CodeGenFunction::pushSEHCleanup(CleanupKind Kind, + llvm::Function *FinallyFunc) { + EHStack.pushCleanup<PerformSEHFinally>(Kind, FinallyFunc); } void CodeGenFunction::EnterSEHTryStmt(const SEHTryStmt &S) { Modified: projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp ============================================================================== --- projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp Sat Aug 18 10:58:44 2018 (r338013) +++ projects/clang700-import/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp Sat Aug 18 12:11:17 2018 (r338014) @@ -18,6 +18,7 @@ #include "CGCleanup.h" #include "CodeGenFunction.h" #include "CodeGenModule.h" +#include "CGCXXABI.h" #include "clang/CodeGen/ConstantInitBuilder.h" #include "clang/AST/ASTContext.h" #include "clang/AST/Decl.h" @@ -178,6 +179,9 @@ class CGObjCGNU : public CGObjCRuntime { (protected) /// runtime provides some LLVM passes that can use this to do things like /// automatic IMP caching and speculative inlining. unsigned msgSendMDKind; + /// Does the current target use SEH-based exceptions? False implies + /// Itanium-style DWARF unwinding. + bool usesSEHExceptions; /// Helper to check if we are targeting a specific runtime version or later. bool isRuntime(ObjCRuntime::Kind kind, unsigned major, unsigned minor=0) { @@ -217,6 +221,7 @@ class CGObjCGNU : public CGObjCRuntime { (protected) llvm::Constant *value = llvm::ConstantDataArray::getString(VMContext,Str); auto *GV = new llvm::GlobalVariable(TheModule, value->getType(), true, llvm::GlobalValue::LinkOnceODRLinkage, value, name); + GV->setComdat(TheModule.getOrInsertComdat(name)); if (Private) GV->setVisibility(llvm::GlobalValue::HiddenVisibility); ConstStr = GV; @@ -510,8 +515,8 @@ class CGObjCGNU : public CGObjCRuntime { (protected) /// Returns a selector with the specified type encoding. An empty string is /// used to return an untyped selector (with the types field set to NULL). - virtual llvm::Value *GetSelector(CodeGenFunction &CGF, Selector Sel, - const std::string &TypeEncoding); + virtual llvm::Value *GetTypedSelector(CodeGenFunction &CGF, Selector Sel, + const std::string &TypeEncoding); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808181211.w7ICBH31032092>