[PATCH] D26642: [analyzer] Minor optimizaiton: avoid setting state if unchanged
Dominic Chen via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 14 15:34:26 PST 2016
ddcc created this revision.
ddcc added reviewers: zaks.anna, dcoughlin.
ddcc added a subscriber: cfe-commits.
Split out optimization from https://reviews.llvm.org/D26061
https://reviews.llvm.org/D26642
Files:
lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
Index: lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
===================================================================
--- lib/StaticAnalyzer/Core/RangeConstraintManager.cpp
+++ 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26642.77897.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161114/3ced78fe/attachment.bin>
More information about the cfe-commits
mailing list