From f3243fc70f4b153b86fdd867052748667482efde Mon Sep 17 00:00:00 2001 From: patrick Date: Sun, 24 Dec 2017 23:19:13 +0000 Subject: [PATCH] Merge LLVM 5.0.1 release. --- .../Target/AArch64/AArch64ISelLowering.cpp | 19 ++++++++++++++----- .../clang/Basic/DiagnosticSemaKinds.td | 2 +- gnu/llvm/tools/clang/lib/Basic/Targets.cpp | 11 ++++++++--- .../clang/lib/Driver/ToolChains/Clang.cpp | 6 +++++- gnu/llvm/tools/lld/ELF/SyntheticSections.cpp | 12 +++++++++--- 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index 8e14150318c..99b7f0ccb01 100644 --- a/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/gnu/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -9347,11 +9347,20 @@ static SDValue replaceZeroVectorStore(SelectionDAG &DAG, StoreSDNode &St) { return SDValue(); } - // Use WZR/XZR here to prevent DAGCombiner::MergeConsecutiveStores from - // undoing this transformation. - SDValue SplatVal = VT.getVectorElementType().getSizeInBits() == 32 - ? DAG.getRegister(AArch64::WZR, MVT::i32) - : DAG.getRegister(AArch64::XZR, MVT::i64); + // Use a CopyFromReg WZR/XZR here to prevent + // DAGCombiner::MergeConsecutiveStores from undoing this transformation. + SDLoc DL(&St); + unsigned ZeroReg; + EVT ZeroVT; + if (VT.getVectorElementType().getSizeInBits() == 32) { + ZeroReg = AArch64::WZR; + ZeroVT = MVT::i32; + } else { + ZeroReg = AArch64::XZR; + ZeroVT = MVT::i64; + } + SDValue SplatVal = + DAG.getCopyFromReg(DAG.getEntryNode(), DL, ZeroReg, ZeroVT); return splitStoreSplat(DAG, St, SplatVal, NumVecElts); } diff --git a/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td b/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td index e7c3c89b676..4d53d4de68d 100644 --- a/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/gnu/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -8830,7 +8830,7 @@ def err_omp_firstprivate_distribute_in_teams_reduction : Error< def err_omp_depend_clause_thread_simd : Error< "'depend' clauses cannot be mixed with '%0' clause">; def err_omp_depend_sink_expected_loop_iteration : Error< - "expected %0 loop iteration variable">; + "expected%select{| %1}0 loop iteration variable">; def err_omp_depend_sink_unexpected_expr : Error< "unexpected expression: number of expressions is larger than the number of associated loops">; def err_omp_depend_sink_expected_plus_minus : Error< diff --git a/gnu/llvm/tools/clang/lib/Basic/Targets.cpp b/gnu/llvm/tools/clang/lib/Basic/Targets.cpp index 5d75aa5a752..b33ab135816 100644 --- a/gnu/llvm/tools/clang/lib/Basic/Targets.cpp +++ b/gnu/llvm/tools/clang/lib/Basic/Targets.cpp @@ -2169,7 +2169,7 @@ class AMDGPUTargetInfo final : public TargetInfo { public: AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple) , - GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600), + GPU(isAMDGCN(Triple) ? GK_GFX6 : parseR600Name(Opts.CPU)), hasFP64(false), hasFMAF(false), hasLDEXPF(false), @@ -2179,6 +2179,12 @@ public: hasFMAF = true; hasLDEXPF = true; } + if (getTriple().getArch() == llvm::Triple::r600) { + if (GPU == GK_EVERGREEN_DOUBLE_OPS || GPU == GK_CAYMAN) { + hasFMAF = true; + } + } + auto IsGenericZero = isGenericZero(Triple); resetDataLayout(getTriple().getArch() == llvm::Triple::amdgcn ? (IsGenericZero ? DataLayoutStringSIGenericIsZero : @@ -9350,8 +9356,7 @@ public: WIntType = SignedInt; Char32Type = UnsignedLong; SigAtomicType = SignedChar; - resetDataLayout("e-p:16:16:16-i8:8:8-i16:16:16-i32:32:32-i64:64:64" - "-f32:32:32-f64:64:64-n8"); + resetDataLayout("e-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8"); } void getTargetDefines(const LangOptions &Opts, diff --git a/gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp b/gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp index 83185d5b959..7cd9b3bdca9 100644 --- a/gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp +++ b/gnu/llvm/tools/clang/lib/Driver/ToolChains/Clang.cpp @@ -2227,8 +2227,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } CmdArgs.push_back("-mthread-model"); - if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) + if (Arg *A = Args.getLastArg(options::OPT_mthread_model)) { + if (!getToolChain().isThreadModelSupported(A->getValue())) + D.Diag(diag::err_drv_invalid_thread_model_for_target) + << A->getValue() << A->getAsString(Args); CmdArgs.push_back(A->getValue()); + } else CmdArgs.push_back(Args.MakeArgString(getToolChain().getThreadModel())); diff --git a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp index 4bbec4ab34b..a67b039ddf2 100644 --- a/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp +++ b/gnu/llvm/tools/lld/ELF/SyntheticSections.cpp @@ -427,10 +427,11 @@ CieRecord *EhFrameSection::addCie(EhSectionPiece &Piece, &Sec->template getFile()->getRelocTargetSym(Rels[FirstRelI]); // Search for an existing CIE by CIE contents/relocation target pair. - CieRecord *Cie = &CieMap[{Piece.data(), Personality}]; + CieRecord *&Cie = CieMap[{Piece.data(), Personality}]; // If not found, create a new one. - if (Cie->Piece == nullptr) { + if (!Cie) { + Cie = make(); Cie->Piece = &Piece; Cies.push_back(Cie); } @@ -522,9 +523,14 @@ template static void writeCieFde(uint8_t *Buf, ArrayRef D) { memcpy(Buf, D.data(), D.size()); + size_t Aligned = alignTo(D.size(), sizeof(typename ELFT::uint)); + + // Zero-clear trailing padding if it exists. + memset(Buf + D.size(), 0, Aligned - D.size()); + // Fix the size field. -4 since size does not include the size field itself. const endianness E = ELFT::TargetEndianness; - write32(Buf, alignTo(D.size(), sizeof(typename ELFT::uint)) - 4); + write32(Buf, Aligned - 4); } template void EhFrameSection::finalizeContents() { -- 2.20.1