Skip to content

Commit 3eed23d

Browse files
authored
[clang][dataflow] Remove DataflowAnalysisContext::flowConditionIsTautology(). (#69601)
It's only used in its own unit tests.
1 parent 0374bbb commit 3eed23d

File tree

3 files changed

+0
-40
lines changed

3 files changed

+0
-40
lines changed

clang/include/clang/Analysis/FlowSensitive/DataflowAnalysisContext.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,6 @@ class DataflowAnalysisContext {
133133
/// identified by `Token` imply that `Val` is true.
134134
bool flowConditionImplies(Atom Token, const Formula &);
135135

136-
/// Returns true if and only if the constraints of the flow condition
137-
/// identified by `Token` are always true.
138-
bool flowConditionIsTautology(Atom Token);
139-
140136
/// Returns true if `Val1` is equivalent to `Val2`.
141137
/// Note: This function doesn't take into account constraints on `Val1` and
142138
/// `Val2` imposed by the flow condition.

clang/lib/Analysis/FlowSensitive/DataflowAnalysisContext.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,6 @@ bool DataflowAnalysisContext::flowConditionImplies(Atom Token,
158158
return isUnsatisfiable(std::move(Constraints));
159159
}
160160

161-
bool DataflowAnalysisContext::flowConditionIsTautology(Atom Token) {
162-
// Returns true if and only if we cannot prove that the flow condition can
163-
// ever be false.
164-
llvm::SetVector<const Formula *> Constraints;
165-
Constraints.insert(&arena().makeNot(arena().makeAtomRef(Token)));
166-
addTransitiveFlowConditionConstraints(Token, Constraints);
167-
return isUnsatisfiable(std::move(Constraints));
168-
}
169-
170161
bool DataflowAnalysisContext::equivalentFormulas(const Formula &Val1,
171162
const Formula &Val2) {
172163
llvm::SetVector<const Formula *> Constraints;

clang/unittests/Analysis/FlowSensitive/DataflowAnalysisContextTest.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -99,33 +99,6 @@ TEST_F(DataflowAnalysisContextTest, JoinFlowConditions) {
9999
EXPECT_TRUE(Context.flowConditionImplies(FC3, C3));
100100
}
101101

102-
TEST_F(DataflowAnalysisContextTest, FlowConditionTautologies) {
103-
// Fresh flow condition with empty/no constraints is always true.
104-
Atom FC1 = A.makeFlowConditionToken();
105-
EXPECT_TRUE(Context.flowConditionIsTautology(FC1));
106-
107-
// Literal `true` is always true.
108-
Atom FC2 = A.makeFlowConditionToken();
109-
Context.addFlowConditionConstraint(FC2, A.makeLiteral(true));
110-
EXPECT_TRUE(Context.flowConditionIsTautology(FC2));
111-
112-
// Literal `false` is never true.
113-
Atom FC3 = A.makeFlowConditionToken();
114-
Context.addFlowConditionConstraint(FC3, A.makeLiteral(false));
115-
EXPECT_FALSE(Context.flowConditionIsTautology(FC3));
116-
117-
// We can't prove that an arbitrary bool A is always true...
118-
auto &C1 = A.makeAtomRef(A.makeAtom());
119-
Atom FC4 = A.makeFlowConditionToken();
120-
Context.addFlowConditionConstraint(FC4, C1);
121-
EXPECT_FALSE(Context.flowConditionIsTautology(FC4));
122-
123-
// ... but we can prove A || !A is true.
124-
Atom FC5 = A.makeFlowConditionToken();
125-
Context.addFlowConditionConstraint(FC5, A.makeOr(C1, A.makeNot(C1)));
126-
EXPECT_TRUE(Context.flowConditionIsTautology(FC5));
127-
}
128-
129102
TEST_F(DataflowAnalysisContextTest, EquivBoolVals) {
130103
auto &X = A.makeAtomRef(A.makeAtom());
131104
auto &Y = A.makeAtomRef(A.makeAtom());

0 commit comments

Comments
 (0)