[llvm] r242956 - [GMR] Continue my quest to remove linked datastructures from GMR, NFC.

Chandler Carruth chandlerc at gmail.com
Wed Jul 22 15:32:34 PDT 2015

Author: chandlerc
Date: Wed Jul 22 17:32:34 2015
New Revision: 242956

URL: http://llvm.org/viewvc/llvm-project?rev=242956&view=rev
[GMR] Continue my quest to remove linked datastructures from GMR, NFC.

This replaces the next-to-last std::map with a DenseMap. While DenseMap
doesn't yet make tons of sense (there are 32 bytes or so in the value
type), my next change will reduce the value type to a single pointer --
we only need a pointer and 3 bits, and that is exactly what we can have.


Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=242956&r1=242955&r2=242956&view=diff
--- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Wed Jul 22 17:32:34 2015
@@ -101,7 +101,7 @@ class GlobalsModRef : public ModulePass,
   /// FunctionInfo - For each function, keep track of what globals are
   /// modified or read.
-  std::map<const Function *, FunctionRecord> FunctionInfo;
+  DenseMap<const Function *, FunctionRecord> FunctionInfo;
   /// Handle to clear this analysis on deletion of values.
   struct DeletionCallbackHandle final : CallbackVH {
@@ -227,8 +227,7 @@ private:
   /// getFunctionInfo - Return the function info for the function, or null if
   /// we don't have anything useful to say about it.
   FunctionRecord *getFunctionInfo(const Function *F) {
-    std::map<const Function *, FunctionRecord>::iterator I =
-        FunctionInfo.find(F);
+    auto I = FunctionInfo.find(F);
     if (I != FunctionInfo.end())
       return &I->second;
     return nullptr;

More information about the llvm-commits mailing list