diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-13 22:48:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-13 22:48:46 +0000 |
commit | d4f53b373e9e086ac6aefd4540880951b0f881f6 (patch) | |
tree | 5814dec8e3a785f74fffc7011e295335689e72a6 | |
parent | d84b41615e8a9844d0cc26527ec9ef316fdddb84 (diff) |
Two changes:
1) unique globals with the existing "Count" local in Mangler, not with
atomic nonsense. Using atomics will give us nondeterminstic output
from the compiler when using multiple threads, which is bad.
2) Do not mangle an unknown global name with a type suffix. We don't
need this anymore now that llvm ir doesn't have type planes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75541 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/Mangler.cpp | 11 | ||||
-rw-r--r-- | test/CodeGen/X86/2008-04-02-unnamedEH.ll | 3 |
2 files changed, 3 insertions, 11 deletions
diff --git a/lib/VMCore/Mangler.cpp b/lib/VMCore/Mangler.cpp index 1a68b89054..50724f4e42 100644 --- a/lib/VMCore/Mangler.cpp +++ b/lib/VMCore/Mangler.cpp @@ -14,7 +14,6 @@ #include "llvm/Support/Mangler.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/System/Atomic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringMap.h" @@ -151,7 +150,7 @@ std::string Mangler::getValueName(const Value *V) { } -std::string Mangler::getValueName(const GlobalValue *GV, const char * Suffix) { +std::string Mangler::getValueName(const GlobalValue *GV, const char *Suffix) { // Check to see whether we've already named V. std::string &Name = Memo[GV]; if (!Name.empty()) @@ -164,13 +163,7 @@ std::string Mangler::getValueName(const GlobalValue *GV, const char * Suffix) { Name = GV->getNameStart(); // Is an intrinsic function } else if (!GV->hasName()) { // Must mangle the global into a unique ID. - unsigned TypeUniqueID = getTypeID(GV->getType()); - static uint32_t GlobalID = 0; - - unsigned OldID = GlobalID; - sys::AtomicIncrement(&GlobalID); - - Name = "__unnamed_" + utostr(TypeUniqueID) + "_" + utostr(OldID); + Name = "__unnamed_" + utostr(Count++); } else { if (GV->hasPrivateLinkage()) Name = makeNameProper(GV->getName() + Suffix, Prefix, PrivatePrefix); diff --git a/test/CodeGen/X86/2008-04-02-unnamedEH.ll b/test/CodeGen/X86/2008-04-02-unnamedEH.ll index fff75ff660..4d8838bf99 100644 --- a/test/CodeGen/X86/2008-04-02-unnamedEH.ll +++ b/test/CodeGen/X86/2008-04-02-unnamedEH.ll @@ -1,5 +1,4 @@ -; RUN: llvm-as < %s | llc | grep unnamed_1_0.eh -; ModuleID = '<stdin>' +; RUN: llvm-as < %s | llc | grep unnamed_0.eh target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" |