From 4b6eb0e63c698094db5506763df44cc83c19f643 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 20 Mar 2022 12:40:34 +0100 Subject: Merge llvm-project main llvmorg-14-init-10186-gff7f2cfa959b This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-14-init-10186-gff7f2cfa959b. PR: 261742 MFC after: 2 weeks (cherry picked from commit 349cc55c9796c4596a5b9904cd3281af295f878f) --- .../lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 36 +++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') diff --git a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index de096f95afcb..1d3bb286c882 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1495,7 +1495,7 @@ void TargetLoweringObjectFileMachO::getNameWithPrefix( SmallVectorImpl &OutName, const GlobalValue *GV, const TargetMachine &TM) const { bool CannotUsePrivateLabel = true; - if (auto *GO = GV->getBaseObject()) { + if (auto *GO = GV->getAliaseeObject()) { SectionKind GOKind = TargetLoweringObjectFile::getKindForGlobal(GO, TM); const MCSection *TheSection = SectionForGlobal(GO, GOKind, TM); CannotUsePrivateLabel = @@ -1566,7 +1566,7 @@ static int getSelectionForCOFF(const GlobalValue *GV) { if (const Comdat *C = GV->getComdat()) { const GlobalValue *ComdatKey = getComdatGVForCOFF(GV); if (const auto *GA = dyn_cast(ComdatKey)) - ComdatKey = GA->getBaseObject(); + ComdatKey = GA->getAliaseeObject(); if (ComdatKey == GV) { switch (C->getSelectionKind()) { case Comdat::Any: @@ -1945,7 +1945,7 @@ static std::string APIntToHexString(const APInt &AI) { static std::string scalarConstantToHexString(const Constant *C) { Type *Ty = C->getType(); if (isa(C)) { - return APIntToHexString(APInt::getNullValue(Ty->getPrimitiveSizeInBits())); + return APIntToHexString(APInt::getZero(Ty->getPrimitiveSizeInBits())); } else if (const auto *CFP = dyn_cast(C)) { return APIntToHexString(CFP->getValueAPF().bitcastToAPInt()); } else if (const auto *CI = dyn_cast(C)) { @@ -2417,7 +2417,20 @@ bool TargetLoweringObjectFileXCOFF::shouldPutJumpTableInFunctionSection( MCSection *TargetLoweringObjectFileXCOFF::getSectionForConstant( const DataLayout &DL, SectionKind Kind, const Constant *C, Align &Alignment) const { - //TODO: Enable emiting constant pool to unique sections when we support it. + // TODO: Enable emiting constant pool to unique sections when we support it. + if (Alignment > Align(16)) + report_fatal_error("Alignments greater than 16 not yet supported."); + + if (Alignment == Align(8)) { + assert(ReadOnly8Section && "Section should always be initialized."); + return ReadOnly8Section; + } + + if (Alignment == Align(16)) { + assert(ReadOnly16Section && "Section should always be initialized."); + return ReadOnly16Section; + } + return ReadOnlySection; } @@ -2446,7 +2459,8 @@ MCSection *TargetLoweringObjectFileXCOFF::getStaticDtorSection( const MCExpr *TargetLoweringObjectFileXCOFF::lowerRelativeReference( const GlobalValue *LHS, const GlobalValue *RHS, const TargetMachine &TM) const { - report_fatal_error("XCOFF not yet implemented."); + /* Not implemented yet, but don't crash, return nullptr. */ + return nullptr; } XCOFF::StorageClass @@ -2476,12 +2490,12 @@ TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(const GlobalValue *GV) { MCSymbol *TargetLoweringObjectFileXCOFF::getFunctionEntryPointSymbol( const GlobalValue *Func, const TargetMachine &TM) const { - assert( - (isa(Func) || - (isa(Func) && - isa_and_nonnull(cast(Func)->getBaseObject()))) && - "Func must be a function or an alias which has a function as base " - "object."); + assert((isa(Func) || + (isa(Func) && + isa_and_nonnull( + cast(Func)->getAliaseeObject()))) && + "Func must be a function or an alias which has a function as base " + "object."); SmallString<128> NameStr; NameStr.push_back('.'); -- cgit v1.2.3