summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-07-20 18:52:34 +0000
committerTed Kremenek <kremenek@apple.com>2009-07-20 18:52:34 +0000
commit619eece3477cc133348fe2bb5973ed8544fa5bb4 (patch)
tree82625b018ecaaca0efdece7d46c9bd507bb8738d
parent47d2859b3e27c3ce904ac62249d4297e6bf9726d (diff)
downloadbcm5719-llvm-619eece3477cc133348fe2bb5973ed8544fa5bb4.tar.gz
bcm5719-llvm-619eece3477cc133348fe2bb5973ed8544fa5bb4.zip
Update DataflowSolver to handle the case where a successor/predecessor block
could be NULL. This allows the solver to handle optimized CFGs where branches can be determined during CFG-construction to be infeasible. llvm-svn: 76452
-rw-r--r--clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h b/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h
index a9b96a81872..e44bf3262bd 100644
--- a/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h
+++ b/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h
@@ -194,9 +194,9 @@ private:
while (!WorkList.isEmpty()) {
const CFGBlock* B = WorkList.dequeue();
- ProcessMerge(cfg,B);
+ ProcessMerge(cfg, B);
ProcessBlock(B, recordStmtValues, AnalysisDirTag());
- UpdateEdges(cfg,B,TF.getVal());
+ UpdateEdges(cfg, B, TF.getVal());
}
}
@@ -211,16 +211,22 @@ private:
bool firstMerge = true;
for (PrevBItr I=ItrTraits::PrevBegin(B),E=ItrTraits::PrevEnd(B); I!=E; ++I){
+
+ CFGBlock *PrevBlk = *I;
+
+ if (!PrevBlk)
+ continue;
typename EdgeDataMapTy::iterator EI =
- M.find(ItrTraits::PrevEdge(B, *I));
+ M.find(ItrTraits::PrevEdge(B, PrevBlk));
if (EI != M.end()) {
if (firstMerge) {
firstMerge = false;
V.copyValues(EI->second);
}
- else Merge(V,EI->second);
+ else
+ Merge(V, EI->second);
}
}
@@ -263,7 +269,8 @@ private:
// forward/backward analysis respectively)
void UpdateEdges(CFG& cfg, const CFGBlock* B, ValTy& V) {
for (NextBItr I=ItrTraits::NextBegin(B), E=ItrTraits::NextEnd(B); I!=E; ++I)
- UpdateEdgeValue(ItrTraits::NextEdge(B, *I),V,*I);
+ if (CFGBlock *NextBlk = *I)
+ UpdateEdgeValue(ItrTraits::NextEdge(B, NextBlk),V, NextBlk);
}
/// UpdateEdgeValue - Update the value associated with a given edge.
OpenPOWER on IntegriCloud