diff options
author | Anna Zaks <ganna@apple.com> | 2011-09-23 19:14:09 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-09-23 19:14:09 +0000 |
commit | ff7da05670d3a49da35a99c43f53d14f79e22464 (patch) | |
tree | 6230b299e28e4188566a1e0900088a08dae724af /clang | |
parent | 632bf5f0845f9ab8651e67265ac89b1895805b37 (diff) | |
download | bcm5719-llvm-ff7da05670d3a49da35a99c43f53d14f79e22464.tar.gz bcm5719-llvm-ff7da05670d3a49da35a99c43f53d14f79e22464.zip |
Move immutable map canonization out of the removeDeadBindings loop (via using ImmutableMapRef). Gives ~2% speedup.
llvm-svn: 140403
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/Environment.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp index 0ca11686315..e1b982c08cf 100644 --- a/clang/lib/StaticAnalyzer/Core/Environment.cpp +++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp @@ -159,6 +159,10 @@ EnvironmentManager::removeDeadBindings(Environment Env, MarkLiveCallback CB(SymReaper); ScanReachableSymbols RSScaner(ST, CB); + llvm::ImmutableMapRef<const Stmt*,SVal> + EBMapRef(NewEnv.ExprBindings.getRootWithoutRetain(), + F.getTreeFactory()); + // Iterate over the block-expr bindings. for (Environment::iterator I = Env.begin(), E = Env.end(); I != E; ++I) { @@ -177,7 +181,7 @@ EnvironmentManager::removeDeadBindings(Environment Env, if (SymReaper.isLive(BlkExpr)) { // Copy the binding to the new map. - NewEnv.ExprBindings = F.add(NewEnv.ExprBindings, BlkExpr, X); + EBMapRef = EBMapRef.add(BlkExpr, X); // If the block expr's value is a memory region, then mark that region. if (isa<loc::MemRegionVal>(X)) { @@ -195,7 +199,7 @@ EnvironmentManager::removeDeadBindings(Environment Env, // beginning of itself, but we need its UndefinedVal to determine its // SVal. if (X.isUndef() && cast<UndefinedVal>(X).getData()) - NewEnv.ExprBindings = F.add(NewEnv.ExprBindings, BlkExpr, X); + EBMapRef = EBMapRef.add(BlkExpr, X); } // Go through he deferred locations and add them to the new environment if @@ -203,9 +207,10 @@ EnvironmentManager::removeDeadBindings(Environment Env, for (SmallVectorImpl<std::pair<const Stmt*, SVal> >::iterator I = deferredLocations.begin(), E = deferredLocations.end(); I != E; ++I) { const Stmt *S = (Stmt*) (((uintptr_t) I->first) & (uintptr_t) ~0x1); - if (NewEnv.ExprBindings.lookup(S)) - NewEnv.ExprBindings = F.add(NewEnv.ExprBindings, I->first, I->second); + if (EBMapRef.lookup(S)) + EBMapRef = EBMapRef.add(I->first, I->second); } + NewEnv.ExprBindings = EBMapRef.asImmutableMap(); return NewEnv; } |