diff options
author | Sam McCall <sam.mccall@gmail.com> | 2023-06-22 02:05:12 +0200 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2023-07-05 14:06:48 +0200 |
commit | 71579569f4399d3cf6bc618dcd449b5388d749cc (patch) | |
tree | f33efb20a4326de892c8f2229b6369daa0d22400 /clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp | |
parent | 8a3fdf7b908978625e9a7e57fbb443e4e6f98976 (diff) | |
download | llvm-71579569f4399d3cf6bc618dcd449b5388d749cc.zip llvm-71579569f4399d3cf6bc618dcd449b5388d749cc.tar.gz llvm-71579569f4399d3cf6bc618dcd449b5388d749cc.tar.bz2 |
[dataflow] use true/false literals in formulas, rather than variables
And simplify formulas containing true/false
It's unclear to me how useful this is, it does make formulas more
conveniently self-contained now (we can usefully print them without
carrying around the "true/false" labels)
(while here, simplify !!X to X, too)
Differential Revision: https://reviews.llvm.org/D153485
Diffstat (limited to 'clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp')
-rw-r--r-- | clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp index a807ef8..2971df6 100644 --- a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp +++ b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp @@ -131,8 +131,6 @@ DataflowAnalysisContext::joinFlowConditions(Atom FirstToken, Solver::Result DataflowAnalysisContext::querySolver( llvm::SetVector<const Formula *> Constraints) { - Constraints.insert(&arena().makeLiteral(true)); - Constraints.insert(&arena().makeNot(arena().makeLiteral(false))); return S->solve(Constraints.getArrayRef()); } @@ -201,13 +199,8 @@ void DataflowAnalysisContext::dumpFlowCondition(Atom Token, llvm::DenseSet<Atom> VisitedTokens; addTransitiveFlowConditionConstraints(Token, Constraints, VisitedTokens); - // TODO: have formulas know about true/false directly instead - Atom True = arena().makeLiteral(true).getAtom(); - Atom False = arena().makeLiteral(false).getAtom(); - Formula::AtomNames Names = {{False, "false"}, {True, "true"}}; - for (const auto *Constraint : Constraints) { - Constraint->print(OS, &Names); + Constraint->print(OS); OS << "\n"; } } |