diff options
author | Adrian Prantl <aprantl@apple.com> | 2016-11-11 22:09:25 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2016-11-11 22:09:25 +0000 |
commit | feb16c84dcdea64bc32a8bb903ccd325fdf12b67 (patch) | |
tree | 43d71cf02f9385a5e1e43e32293d0e3fffb32340 | |
parent | 2322de66feacf6e359be2e87894b7cabed93ee81 (diff) |
Simplify code and address review comments (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286644 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/GlobalMerge.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/CodeGen/GlobalMerge.cpp b/lib/CodeGen/GlobalMerge.cpp index c3d49c035a4..1ea53493994 100644 --- a/lib/CodeGen/GlobalMerge.cpp +++ b/lib/CodeGen/GlobalMerge.cpp @@ -425,7 +425,6 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals, DEBUG(dbgs() << " Trying to merge set, starts with #" << GlobalSet.find_first() << "\n"); - StringRef ExternalName; ssize_t i = GlobalSet.find_first(); while (i != -1) { ssize_t j = 0; @@ -434,6 +433,7 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals, std::vector<Constant*> Inits; bool HasExternal = false; + StringRef FirstExternalName; for (j = i; j != -1; j = GlobalSet.find_next(j)) { Type *Ty = Globals[j]->getValueType(); MergedSize += DL.getTypeAllocSize(Ty); @@ -445,8 +445,7 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals, if (Globals[j]->hasExternalLinkage() && !HasExternal) { HasExternal = true; - auto *TheFirstExternal = Globals[j]; - ExternalName = TheFirstExternal->getName(); + FirstExternalName = Globals[j]->getName(); } } @@ -466,7 +465,7 @@ bool GlobalMerge::doMerge(const SmallVectorImpl<GlobalVariable *> &Globals, // _MergedGlobals symbols. Twine MergedName = (IsMachO && HasExternal) - ? "_MergedGlobals_" + ExternalName + ? "_MergedGlobals_" + FirstExternalName : "_MergedGlobals"; auto MergedLinkage = IsMachO ? Linkage : GlobalValue::PrivateLinkage; auto *MergedGV = new GlobalVariable( |