[clang][dataflow] Optimize flow condition representation
authorStanislav Gatev <sgatev@google.com>
Mon, 25 Apr 2022 15:23:42 +0000 (15:23 +0000)
committerStanislav Gatev <sgatev@google.com>
Sun, 1 May 2022 16:25:29 +0000 (16:25 +0000)
commit955a05a2782ee19d6f4bce6bf5d1c4a8f591f0f3
treecca88619a8517bcf1d8655010edd5a212f495ed6
parent980f41d7c45d93e4624838c4f8e80095b6184d61
[clang][dataflow] Optimize flow condition representation

Enable efficient implementation of context-aware joining of distinct
boolean values. It can be used to join distinct boolean values while
preserving flow condition information.

Flow conditions are represented as Token <=> Clause iff formulas. To
perform context-aware joining, one can simply add the tokens of flow
conditions to the formula when joining distinct boolean values, e.g:
`makeOr(makeAnd(FC1, Val1), makeAnd(FC2, Val2))`. This significantly
simplifies the implementation of `Environment::join`.

This patch removes the `DataflowAnalysisContext::getSolver` method.
The `DataflowAnalysisContext::flowConditionImplies` method should be
used instead.

Reviewed-by: ymandel, xazax.hun
Differential Revision: https://reviews.llvm.org/D124395
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/unittests/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp