This revision was automatically updated to reflect the committed changes.
Closed by commit rL286925: [analyzer] Minor optimization: avoid setting state
if unchanged (authored by ddcc).
Changed prior to commit:
https://reviews.llvm.org/D26642?vs=77897&id=77929#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26642
Files:
cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
Index: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -398,17 +398,19 @@
ProgramStateRef
RangeConstraintManager::removeDeadBindings(ProgramStateRef state,
SymbolReaper& SymReaper) {
-
+ bool Changed = false;
ConstraintRangeTy CR = state->get<ConstraintRange>();
- ConstraintRangeTy::Factory& CRFactory =
state->get_context<ConstraintRange>();
+ ConstraintRangeTy::Factory &CRFactory =
state->get_context<ConstraintRange>();
for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) {
SymbolRef sym = I.getKey();
- if (SymReaper.maybeDead(sym))
+ if (SymReaper.maybeDead(sym)) {
+ Changed = true;
CR = CRFactory.remove(CR, sym);
+ }
}
- return state->set<ConstraintRange>(CR);
+ return Changed ? state->set<ConstraintRange>(CR) : state;
}
RangeSet
Index: cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
@@ -398,17 +398,19 @@
ProgramStateRef
RangeConstraintManager::removeDeadBindings(ProgramStateRef state,
SymbolReaper& SymReaper) {
-
+ bool Changed = false;
ConstraintRangeTy CR = state->get<ConstraintRange>();
- ConstraintRangeTy::Factory& CRFactory = state->get_context<ConstraintRange>();
+ ConstraintRangeTy::Factory &CRFactory = state->get_context<ConstraintRange>();
for (ConstraintRangeTy::iterator I = CR.begin(), E = CR.end(); I != E; ++I) {
SymbolRef sym = I.getKey();
- if (SymReaper.maybeDead(sym))
+ if (SymReaper.maybeDead(sym)) {
+ Changed = true;
CR = CRFactory.remove(CR, sym);
+ }
}
- return state->set<ConstraintRange>(CR);
+ return Changed ? state->set<ConstraintRange>(CR) : state;
}
RangeSet
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits