ymandel created this revision. ymandel added reviewers: xazax.hun, li.zhe.hua, sgatev. Herald added subscribers: tschuett, steakhal, rnkovacs. Herald added a project: All. ymandel requested review of this revision. Herald added a project: clang.
Currently, the maximum number of iterations of the loop for finding the fixpoint of the dataflow analysis is set at 2^16. When things go wrong in an analysis, this can be far too large. This patch changes the limit to be proportional to the size of the CFG, which will generally be far smaller than 2^16. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D126316 Files: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp =================================================================== --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -332,8 +332,9 @@ // FIXME: Consider making the maximum number of iterations configurable. // FIXME: Set up statistics (see llvm/ADT/Statistic.h) to count average number // of iterations, number of functions that time out, etc. + static constexpr uint32_t MaxAverageVisitsPerBlock = 4; + const uint32_t MaxIterations = MaxAverageVisitsPerBlock * BlockStates.size(); uint32_t Iterations = 0; - static constexpr uint32_t MaxIterations = 1 << 16; while (const CFGBlock *Block = Worklist.dequeue()) { if (++Iterations > MaxIterations) { return llvm::createStringError(std::errc::timed_out,
Index: clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp =================================================================== --- clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -332,8 +332,9 @@ // FIXME: Consider making the maximum number of iterations configurable. // FIXME: Set up statistics (see llvm/ADT/Statistic.h) to count average number // of iterations, number of functions that time out, etc. + static constexpr uint32_t MaxAverageVisitsPerBlock = 4; + const uint32_t MaxIterations = MaxAverageVisitsPerBlock * BlockStates.size(); uint32_t Iterations = 0; - static constexpr uint32_t MaxIterations = 1 << 16; while (const CFGBlock *Block = Worklist.dequeue()) { if (++Iterations > MaxIterations) { return llvm::createStringError(std::errc::timed_out,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits