[clang] [clang][dataflow] Make cap on block visits configurable by caller. (PR #77481)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 00:17:18 PST 2024


================
@@ -186,6 +186,14 @@ template <typename LatticeT> struct DataflowAnalysisState {
 /// the dataflow analysis cannot be performed successfully. Otherwise, calls
 /// `PostVisitCFG` on each CFG element with the final analysis results at that
 /// program point.
+///
+/// `MaxBlockVisits` caps the number of block visits during analysis. It doesn't
+/// distinguish between repeat visits to the same block and visits to distinct
+/// blocks. This parameter is a backstop to prevent infintite loops, in the case
+/// of bugs in the lattice and/or transfer functions that prevent the analysis
+/// from converging. The default value is essentially arbitrary -- large enough
+/// to accomodate what seems like any reasonable CFG, but still small enough to
+/// limit the cost of hitting the limit.
----------------
martinboehme wrote:

This comment is duplicated several times below. This feels a bit boilerplate-y, and the copies are likely to go out of sync over time. Maybe keep the full comment in only one central location, and in the other locations put just a short description that references the central comment?

https://github.com/llvm/llvm-project/pull/77481


More information about the cfe-commits mailing list