[llvm] 53a059c - [PassInstrumentation] Use DenseMap to store class->pass map (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 21 03:23:22 PDT 2024


Author: Nikita Popov
Date: 2024-06-21T12:23:14+02:00
New Revision: 53a059ca76b0a6a0dff731e5acc7d51e5a62546c

URL: https://github.com/llvm/llvm-project/commit/53a059ca76b0a6a0dff731e5acc7d51e5a62546c
DIFF: https://github.com/llvm/llvm-project/commit/53a059ca76b0a6a0dff731e5acc7d51e5a62546c.diff

LOG: [PassInstrumentation] Use DenseMap to store class->pass map (NFC)

It's okay to store the StringRef for the class name without
creating a separate copy inside the map, so use DenseMap instead
of StringMap.

Added: 
    

Modified: 
    llvm/include/llvm/IR/PassInstrumentation.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/PassInstrumentation.h b/llvm/include/llvm/IR/PassInstrumentation.h
index 2869aaba79344..ff5e54427814d 100644
--- a/llvm/include/llvm/IR/PassInstrumentation.h
+++ b/llvm/include/llvm/IR/PassInstrumentation.h
@@ -52,7 +52,7 @@
 #include "llvm/ADT/Any.h"
 #include "llvm/ADT/FunctionExtras.h"
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/IR/PassManager.h"
 #include <type_traits>
 #include <vector>
@@ -185,7 +185,7 @@ class PassInstrumentationCallbacks {
   SmallVector<llvm::unique_function<AnalysesClearedFunc>, 4>
       AnalysesClearedCallbacks;
 
-  StringMap<std::string> ClassToPassName;
+  DenseMap<StringRef, std::string> ClassToPassName;
 };
 
 /// This class provides instrumentation entry points for the Pass Manager,


        


More information about the llvm-commits mailing list