Re: [PATCH] D12848: [Static Analyzer] Nullability checker optimization.

2015-09-14 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL247612: [Static Analyzer] Nullability checker optimization. 
(authored by xazax).

Changed prior to commit:
  http://reviews.llvm.org/D12848?vs=34693&id=34725#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12848

Files:
  cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp

Index: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -406,12 +406,17 @@
 /// Cleaning up the program state.
 void NullabilityChecker::checkDeadSymbols(SymbolReaper &SR,
   CheckerContext &C) const {
+  if (!SR.hasDeadSymbols())
+return;
+
   ProgramStateRef State = C.getState();
   NullabilityMapTy Nullabilities = State->get();
   for (NullabilityMapTy::iterator I = Nullabilities.begin(),
   E = Nullabilities.end();
I != E; ++I) {
-if (!SR.isLiveRegion(I->first)) {
+const auto *Region = I->first->getAs();
+assert(Region && "Non-symbolic region is tracked.");
+if (SR.isDead(Region->getSymbol())) {
   State = State->remove(I->first);
 }
   }


Index: cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -406,12 +406,17 @@
 /// Cleaning up the program state.
 void NullabilityChecker::checkDeadSymbols(SymbolReaper &SR,
   CheckerContext &C) const {
+  if (!SR.hasDeadSymbols())
+return;
+
   ProgramStateRef State = C.getState();
   NullabilityMapTy Nullabilities = State->get();
   for (NullabilityMapTy::iterator I = Nullabilities.begin(),
   E = Nullabilities.end();
I != E; ++I) {
-if (!SR.isLiveRegion(I->first)) {
+const auto *Region = I->first->getAs();
+assert(Region && "Non-symbolic region is tracked.");
+if (SR.isDead(Region->getSymbol())) {
   State = State->remove(I->first);
 }
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D12848: [Static Analyzer] Nullability checker optimization.

2015-09-14 Thread Gábor Horváth via cfe-commits
xazax.hun created this revision.
xazax.hun added reviewers: dcoughlin, zaks.anna, jordan_rose.
xazax.hun added a subscriber: cfe-commits.

Right now the nullability checker only tracks symbolic regions. For this reason 
if there are no dead symbols it is safe to skip the precondition checking. I 
also changed to cleanup code to work with symbols directly instead of memory 
regions.

http://reviews.llvm.org/D12848

Files:
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp

Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -395,12 +395,17 @@
 /// Cleaning up the program state.
 void NullabilityChecker::checkDeadSymbols(SymbolReaper &SR,
   CheckerContext &C) const {
+  if (!SR.hasDeadSymbols())
+return;
+
   ProgramStateRef State = C.getState();
   NullabilityMapTy Nullabilities = State->get();
   for (NullabilityMapTy::iterator I = Nullabilities.begin(),
   E = Nullabilities.end();
I != E; ++I) {
-if (!SR.isLiveRegion(I->first)) {
+const auto *Region = I->first->getAs();
+assert(Region && "Non-symbolic region is tracked.");
+if (SR.isDead(Region->getSymbol())) {
   State = State->remove(I->first);
 }
   }


Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -395,12 +395,17 @@
 /// Cleaning up the program state.
 void NullabilityChecker::checkDeadSymbols(SymbolReaper &SR,
   CheckerContext &C) const {
+  if (!SR.hasDeadSymbols())
+return;
+
   ProgramStateRef State = C.getState();
   NullabilityMapTy Nullabilities = State->get();
   for (NullabilityMapTy::iterator I = Nullabilities.begin(),
   E = Nullabilities.end();
I != E; ++I) {
-if (!SR.isLiveRegion(I->first)) {
+const auto *Region = I->first->getAs();
+assert(Region && "Non-symbolic region is tracked.");
+if (SR.isDead(Region->getSymbol())) {
   State = State->remove(I->first);
 }
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits