diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-09-23 18:02:10 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-09-23 18:02:10 +0000 |
| commit | 577acbf5c2b51da82208eb910569f704347ade7f (patch) | |
| tree | cd761a04a8fa71588d1e50feac7391b32d72e273 | |
| parent | d0921de8b071e6433ba49d3d12b67f1bda83e11a (diff) | |
| download | llvm-577acbf5c2b51da82208eb910569f704347ade7f.zip llvm-577acbf5c2b51da82208eb910569f704347ade7f.tar.gz llvm-577acbf5c2b51da82208eb910569f704347ade7f.tar.bz2 | |
Fix PR 2819: Compute dataflow values for all CFG blocks by not relying on having the "Exit" block being reachable by all (or any) of the blocks in the CFG.
llvm-svn: 56492
| -rw-r--r-- | clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h b/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h index 169417c..0ed4c86 100644 --- a/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h +++ b/clang/include/clang/Analysis/FlowSensitive/DataflowSolver.h @@ -187,7 +187,10 @@ private: /// SolveDataflowEquations - Perform the actual worklist algorithm /// to compute dataflow values. void SolveDataflowEquations(CFG& cfg, bool recordStmtValues) { - EnqueueFirstBlock(cfg,AnalysisDirTag()); + // Enqueue all blocks to ensure the dataflow values are computed + // for every block. Not all blocks are guaranteed to reach the exit block. + for (CFG::iterator I=cfg.begin(), E=cfg.end(); I!=E; ++I) + WorkList.enqueue(&*I); while (!WorkList.isEmpty()) { const CFGBlock* B = WorkList.dequeue(); @@ -195,14 +198,6 @@ private: ProcessBlock(B, recordStmtValues, AnalysisDirTag()); UpdateEdges(cfg,B,TF.getVal()); } - } - - void EnqueueFirstBlock(const CFG& cfg, dataflow::forward_analysis_tag) { - WorkList.enqueue(&cfg.getEntry()); - } - - void EnqueueFirstBlock(const CFG& cfg, dataflow::backward_analysis_tag) { - WorkList.enqueue(&cfg.getExit()); } void ResetValues(CFG& cfg, ValTy& V, const CFGBlock* B, |
