TargetAsmInfo::SectionForGlobal showed up in a profile. Simplify it a little.
authorDan Gohman <gohman@apple.com>
Tue, 15 Jul 2008 18:37:51 +0000 (18:37 +0000)
committerDan Gohman <gohman@apple.com>
Tue, 15 Jul 2008 18:37:51 +0000 (18:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53639 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetAsmInfo.cpp

index 237b96de1ad4b77661f119018cfafd960e69eed4..2be9440f3b47597484a6955d16325a8a858b921c 100644 (file)
@@ -273,15 +273,13 @@ TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
     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'
   // directive and also append funky flags. Otherwise - section name is just
   // some magic assembler directive.
-  if (S->isNamed())
-    Name = getSwitchToSectionDirective() + Name + PrintSectionFlags(S->Flags);
-
-  return Name;
+  return getSwitchToSectionDirective() + S->Name + PrintSectionFlags(S->Flags);
 }
 
 // Lame default implementation. Calculate the section name for global.