TargetAsmInfo::SectionForGlobal showed up in a profile. Simplify it a little.

llvm-svn: 53639
This commit is contained in:
Dan Gohman 2008-07-15 18:37:51 +00:00
parent c4400b8618
commit 8cf62e122f

View File

@ -273,15 +273,13 @@ TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
S = SelectSectionForGlobal(GV); S = SelectSectionForGlobal(GV);
} }
std::string Name = S->Name; if (!S->isNamed())
return S->Name;
// If section is named we need to switch into it via special '.section' // If section is named we need to switch into it via special '.section'
// directive and also append funky flags. Otherwise - section name is just // directive and also append funky flags. Otherwise - section name is just
// some magic assembler directive. // some magic assembler directive.
if (S->isNamed()) return getSwitchToSectionDirective() + S->Name + PrintSectionFlags(S->Flags);
Name = getSwitchToSectionDirective() + Name + PrintSectionFlags(S->Flags);
return Name;
} }
// Lame default implementation. Calculate the section name for global. // Lame default implementation. Calculate the section name for global.