[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:49:57 PST 2024


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

Reverts llvm/llvm-project#77453

>From 038c85ca9733404a67c0f328f268ca0124cf5b17 Mon Sep 17 00:00:00 2001
From: martinboehme <mboehme at google.com>
Date: Wed, 10 Jan 2024 10:49:45 +0100
Subject: [PATCH] Revert "[clang][dataflow] Add an early-out to
 `flowConditionImplies()` / `flowConditionAllows()`. (#77453)"

This reverts commit 03a0bfa96a6eb09c4bbae344ac3aa062339aa730.
---
 clang/include/clang/Analysis/FlowSensitive/Formula.h        | 4 ----
 .../lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp  | 6 ------
 2 files changed, 10 deletions(-)

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);



More information about the cfe-commits mailing list