[llvm] r282674 - Remove the default constructor and count variable from the Mangler since

Eric Christopher via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 19:03:50 PDT 2016


Author: echristo
Date: Wed Sep 28 21:03:50 2016
New Revision: 282674

URL: http://llvm.org/viewvc/llvm-project?rev=282674&view=rev
Log:
Remove the default constructor and count variable from the Mangler since
we can just use the size of the DenseMap as a unique counter.

Modified:
    llvm/trunk/include/llvm/IR/Mangler.h
    llvm/trunk/lib/IR/Mangler.cpp

Modified: llvm/trunk/include/llvm/IR/Mangler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Mangler.h?rev=282674&r1=282673&r2=282674&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Mangler.h (original)
+++ llvm/trunk/include/llvm/IR/Mangler.h Wed Sep 28 21:03:50 2016
@@ -29,12 +29,7 @@ class Mangler {
   /// This keeps track of the number we give to anonymous ones.
   mutable DenseMap<const GlobalValue*, unsigned> 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.

Modified: llvm/trunk/lib/IR/Mangler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Mangler.cpp?rev=282674&r1=282673&r2=282674&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Mangler.cpp (original)
+++ llvm/trunk/lib/IR/Mangler.cpp Wed Sep 28 21:03:50 2016
@@ -121,7 +121,7 @@ void Mangler::getNameWithPrefix(raw_ostr
     // 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);




More information about the llvm-commits mailing list