From 45faea454dfdd4fae4187cad5626c6cf0cf29ddd Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 13 Jan 2010 19:05:36 +0000 Subject: [PATCH] don't call getNameWithPrefix repeatedly and unnecesarily. llvm-svn: 93333 --- llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index 93019d067cb0..da2957267615 100644 --- a/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/llvm/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -69,6 +69,8 @@ namespace { void Init(const GlobalValue *GV, Mangler *Mang) { // Already initialized. if (!StubName.empty()) return; + + // Get the names. StubName = Mang->getMangledName(GV, "$stub", true); LazyPtrName = Mang->getMangledName(GV, "$lazy_ptr", true); AnonSymbolName = Mang->getMangledName(GV, "$stub$tmp", true); @@ -81,13 +83,13 @@ namespace { SmallString<128> TmpStr; Mang->getNameWithPrefix(TmpStr, GVName + "$stub", Mangler::Private); StubSym = Ctx.GetOrCreateSymbol(TmpStr.str()); - TmpStr.clear(); - - Mang->getNameWithPrefix(TmpStr, GVName + "$lazy_ptr", Mangler::Private); + TmpStr.erase(TmpStr.end()-5, TmpStr.end()); // Remove $stub + + TmpStr += "$lazy_ptr"; LazyPtrSym = Ctx.GetOrCreateSymbol(TmpStr.str()); - TmpStr.clear(); + TmpStr.erase(TmpStr.end()-9, TmpStr.end()); // Remove $lazy_ptr - Mang->getNameWithPrefix(TmpStr, GVName + "$stub$tmp", Mangler::Private); + TmpStr += "$stub$tmp"; AnonSymbolSym = Ctx.GetOrCreateSymbol(TmpStr.str()); }