From 1c3bb79864f45bd3c6dfc1563d72a2eb89f03a3a Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 29 Sep 2016 02:03:50 +0000 Subject: [PATCH] Remove the default constructor and count variable from the Mangler since we can just use the size of the DenseMap as a unique counter. llvm-svn: 282674 --- llvm/include/llvm/IR/Mangler.h | 5 ----- llvm/lib/IR/Mangler.cpp | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/llvm/include/llvm/IR/Mangler.h b/llvm/include/llvm/IR/Mangler.h index 349218e..0eb91a3 100644 --- a/llvm/include/llvm/IR/Mangler.h +++ b/llvm/include/llvm/IR/Mangler.h @@ -29,12 +29,7 @@ class Mangler { /// This keeps track of the number we give to anonymous ones. mutable DenseMap AnonGlobalIDs; - /// This simple counter is used to unique value names. - mutable unsigned NextAnonGlobalID; - public: - Mangler() : NextAnonGlobalID(1) {} - /// Print the appropriate prefix and the specified global variable's name. /// If the global variable doesn't have a name, this fills in a unique name /// for the global. diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp index ddf024d..41e11b3 100644 --- a/llvm/lib/IR/Mangler.cpp +++ b/llvm/lib/IR/Mangler.cpp @@ -121,7 +121,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV, // already. unsigned &ID = AnonGlobalIDs[GV]; if (ID == 0) - ID = NextAnonGlobalID++; + ID = AnonGlobalIDs.size(); // Must mangle the global into a unique ID. getNameWithPrefixImpl(OS, "__unnamed_" + Twine(ID), DL, PrefixTy); -- 2.7.4