From a79c08f373bd7de75ebc5eda28d4b074ce390b1c Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 14 Oct 2016 17:28:23 +0000 Subject: [PATCH] Revert "In preparation for removing getNameWithPrefix off of TargetMachine," as it's causing sanitizer/memory issues until I can track down this set. This reverts commit r284203 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284252 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 9 +-------- lib/Target/TargetMachine.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index b8339eefd9c..edaa778a605 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -301,7 +301,7 @@ selectELFSectionForGlobal(MCContext &Ctx, const GlobalValue *GV, if (EmitUniqueSection && UniqueSectionNames) { Name.push_back('.'); - Mang.getNameWithPrefix(Name, GV, false); + TM.getNameWithPrefix(Name, GV, Mang, true); } unsigned UniqueID = MCContext::GenericSectionID; if (EmitUniqueSection && !UniqueSectionNames) { @@ -817,13 +817,6 @@ static bool canUsePrivateLabel(const MCAsmInfo &AsmInfo, void TargetLoweringObjectFileMachO::getNameWithPrefix( SmallVectorImpl &OutName, const GlobalValue *GV, const TargetMachine &TM) const { - if (!GV->hasPrivateLinkage()) { - // Simple case: If GV is not private, it is not important to find out if - // private labels are legal in this case or not. - getMangler().getNameWithPrefix(OutName, GV, false); - return; - } - SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GV, TM); const MCSection *TheSection = SectionForGlobal(GV, GVKind, TM); bool CannotUsePrivateLabel = diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 28c9f370fb5..792280af84d 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -203,13 +203,19 @@ TargetIRAnalysis TargetMachine::getTargetIRAnalysis() { void TargetMachine::getNameWithPrefix(SmallVectorImpl &Name, const GlobalValue *GV, Mangler &Mang, bool MayAlwaysUsePrivate) const { + if (MayAlwaysUsePrivate || !GV->hasPrivateLinkage()) { + // Simple case: If GV is not private, it is not important to find out if + // private labels are legal in this case or not. + Mang.getNameWithPrefix(Name, GV, false); + return; + } const TargetLoweringObjectFile *TLOF = getObjFileLowering(); TLOF->getNameWithPrefix(Name, GV, *this); } MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang) const { SmallString<128> NameStr; + getNameWithPrefix(NameStr, GV, Mang); const TargetLoweringObjectFile *TLOF = getObjFileLowering(); - TLOF->getNameWithPrefix(NameStr, GV, *this); return TLOF->getContext().getOrCreateSymbol(NameStr); } -- 2.11.0