[PATCH] D135397: [clang][dataflow] Add support for a Top value in boolean formulas.
Dmitri Gribenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 7 11:19:42 PDT 2022
gribozavr2 accepted this revision.
gribozavr2 added inline comments.
================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h:157
+ TopValue &createTop() {
+ return takeOwnership(std::make_unique<TopValue>());
+ }
----------------
ymandel wrote:
> xazax.hun wrote:
> > gribozavr2 wrote:
> > > Should we be creating a new top every time, or should it be a singleton like true and false?
> > >
> > > It seems like we explicitly don't care about its identity (or else it would be isomorphic to AtomicBool).
> > Good point, a singleton Top might actually simplify some parts of the code.
> Good question. That was my initial implementation, but it ran into the problem that the solver (in `buildBooleanFormula`) maps each unique (by pointer) subexpression into a fresh SAT variable in . If we use a singleton Top, we need to modify that algorithm appropriately. I'm open to suggestions, though, because of the advantages of a singleton Top.
>
> If we assume that a given `Top` is never actually shared in a boolean formula (unlike other subexpressions, which may be shared), then we can use a singleton and special case it in `buildBooleanFormula`. I think that's a good assumption, but am not sure. Thoughts?
I see. Could you add some direct tests for the SAT solver with formulas that include Top to check the behavior we care about?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135397/new/
https://reviews.llvm.org/D135397
More information about the cfe-commits
mailing list