aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstraintSystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/ConstraintSystem.cpp')
-rw-r--r--llvm/lib/Analysis/ConstraintSystem.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ConstraintSystem.cpp b/llvm/lib/Analysis/ConstraintSystem.cpp
index 21115fc..818cfe0 100644
--- a/llvm/lib/Analysis/ConstraintSystem.cpp
+++ b/llvm/lib/Analysis/ConstraintSystem.cpp
@@ -140,3 +140,13 @@ bool ConstraintSystem::mayHaveSolution() {
LLVM_DEBUG(dbgs() << (HasSolution ? "sat" : "unsat") << "\n");
return HasSolution;
}
+
+bool ConstraintSystem::isConditionImplied(SmallVector<int64_t, 8> R) {
+ // If there is no solution with the negation of R added to the system, the
+ // condition must hold based on the existing constraints.
+ R = ConstraintSystem::negate(R);
+
+ auto NewSystem = *this;
+ NewSystem.addVariableRow(R);
+ return !NewSystem.mayHaveSolution();
+}