[llvm] r219575 - AssumptionTracker: Don't create temporary CallbackVHs.

Benjamin Kramer benny.kra at googlemail.com
Sat Oct 11 12:13:01 PDT 2014


Author: d0k
Date: Sat Oct 11 14:13:01 2014
New Revision: 219575

URL: http://llvm.org/viewvc/llvm-project?rev=219575&view=rev
Log:
AssumptionTracker: Don't create temporary CallbackVHs.

Those are expensive to create in cold cache scenarios. NFC.

Modified:
    llvm/trunk/include/llvm/Analysis/AssumptionTracker.h
    llvm/trunk/lib/Analysis/AssumptionTracker.cpp

Modified: llvm/trunk/include/llvm/Analysis/AssumptionTracker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/AssumptionTracker.h?rev=219575&r1=219574&r2=219575&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/AssumptionTracker.h (original)
+++ llvm/trunk/include/llvm/Analysis/AssumptionTracker.h Sat Oct 11 14:13:01 2014
@@ -99,7 +99,7 @@ public:
   typedef iterator_range<assumption_iterator> assumption_range;
 
   inline assumption_range assumptions(Function *F) {
-    FunctionCallsMap::iterator I = CachedAssumeCalls.find(F);
+    FunctionCallsMap::iterator I = CachedAssumeCalls.find_as(F);
     if (I == CachedAssumeCalls.end()) {
       I = scanFunction(F);
     }

Modified: llvm/trunk/lib/Analysis/AssumptionTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AssumptionTracker.cpp?rev=219575&r1=219574&r2=219575&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AssumptionTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AssumptionTracker.cpp Sat Oct 11 14:13:01 2014
@@ -29,12 +29,14 @@ void AssumptionTracker::FunctionCallback
 }
 
 void AssumptionTracker::forgetCachedAssumptions(Function *F) {
-  CachedAssumeCalls.erase(F);
+  auto I = CachedAssumeCalls.find_as(F);
+  if (I != CachedAssumeCalls.end())
+    CachedAssumeCalls.erase(I);
 }
 
 void AssumptionTracker::CallCallbackVH::deleted() {
   assert(F && "delete callback called on dummy handle");
-  FunctionCallsMap::iterator I = AT->CachedAssumeCalls.find(F);
+  FunctionCallsMap::iterator I = AT->CachedAssumeCalls.find_as(F);
   assert(I != AT->CachedAssumeCalls.end() &&
          "Function cleared from the map without removing the values?");
 
@@ -88,7 +90,7 @@ void AssumptionTracker::registerAssumpti
   Function *F = CI->getParent()->getParent();
   assert(F && "Cannot register @llvm.assume call not in a function");
 
-  FunctionCallsMap::iterator I = CachedAssumeCalls.find(F);
+  FunctionCallsMap::iterator I = CachedAssumeCalls.find_as(F);
   if (I == CachedAssumeCalls.end()) {
     // If this function has not already been scanned, then don't do anything
     // here. This intrinsic will be found, if it still exists, if the list of





More information about the llvm-commits mailing list