From: Benjamin Kramer Date: Sat, 11 Oct 2014 19:13:01 +0000 (+0000) Subject: AssumptionTracker: Don't create temporary CallbackVHs. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8daea6b323f060fbb6e773765224f37fadc8fab1;p=oota-llvm.git AssumptionTracker: Don't create temporary CallbackVHs. Those are expensive to create in cold cache scenarios. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219575 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/AssumptionTracker.h b/include/llvm/Analysis/AssumptionTracker.h index 80ae513f4f9..5a050a8abf5 100644 --- a/include/llvm/Analysis/AssumptionTracker.h +++ b/include/llvm/Analysis/AssumptionTracker.h @@ -99,7 +99,7 @@ public: typedef iterator_range 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); } diff --git a/lib/Analysis/AssumptionTracker.cpp b/lib/Analysis/AssumptionTracker.cpp index 3441030e49e..b62f17b015c 100644 --- a/lib/Analysis/AssumptionTracker.cpp +++ b/lib/Analysis/AssumptionTracker.cpp @@ -29,12 +29,14 @@ void AssumptionTracker::FunctionCallbackVH::deleted() { } 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::registerAssumption(CallInst *CI) { 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