[clang] Revert "[clang][dataflow] Add an early-out to `flowConditionImplies()` / `flowConditionAllows()`." (PR #77570)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 10 01:50:24 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (martinboehme)

<details>
<summary>Changes</summary>

Reverts llvm/llvm-project#<!-- -->77453

---
Full diff: https://github.com/llvm/llvm-project/pull/77570.diff


2 Files Affected:

- (modified) clang/include/clang/Analysis/FlowSensitive/Formula.h (-4) 
- (modified) clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp (-6) 


``````````diff
diff --git a/clang/include/clang/Analysis/FlowSensitive/Formula.h b/clang/include/clang/Analysis/FlowSensitive/Formula.h
index 0e6352403a832f..982e400c1deff1 100644
--- a/clang/include/clang/Analysis/FlowSensitive/Formula.h
+++ b/clang/include/clang/Analysis/FlowSensitive/Formula.h
@@ -75,10 +75,6 @@ class alignas(const Formula *) Formula {
     return static_cast<bool>(Value);
   }
 
-  bool isLiteral(bool b) const {
-    return kind() == Literal && static_cast<bool>(Value) == b;
-  }
-
   ArrayRef<const Formula *> operands() const {
     return ArrayRef(reinterpret_cast<Formula *const *>(this + 1),
                     numOperands(kind()));
diff --git a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
index 500fbb39955d20..fa114979c8e326 100644
--- a/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
+++ b/clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp
@@ -174,9 +174,6 @@ Solver::Result DataflowAnalysisContext::querySolver(
 
 bool DataflowAnalysisContext::flowConditionImplies(Atom Token,
                                                    const Formula &F) {
-  if (F.isLiteral(true))
-    return true;
-
   // Returns true if and only if truth assignment of the flow condition implies
   // that `F` is also true. We prove whether or not this property holds by
   // reducing the problem to satisfiability checking. In other words, we attempt
@@ -191,9 +188,6 @@ bool DataflowAnalysisContext::flowConditionImplies(Atom Token,
 
 bool DataflowAnalysisContext::flowConditionAllows(Atom Token,
                                                   const Formula &F) {
-  if (F.isLiteral(true))
-    return true;
-
   llvm::SetVector<const Formula *> Constraints;
   Constraints.insert(&arena().makeAtomRef(Token));
   Constraints.insert(&F);

``````````

</details>


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


More information about the cfe-commits mailing list