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.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ConstraintSystem.cpp b/llvm/lib/Analysis/ConstraintSystem.cpp
index d5b15e7..3df1184 100644
--- a/llvm/lib/Analysis/ConstraintSystem.cpp
+++ b/llvm/lib/Analysis/ConstraintSystem.cpp
@@ -140,6 +140,11 @@ bool ConstraintSystem::mayHaveSolution() {
}
bool ConstraintSystem::isConditionImplied(SmallVector<int64_t, 8> R) {
+ // If all variable coefficients are 0, we have 'C >= 0'. If the constant is >=
+ // 0, R is always true, regardless of the system.
+ if (all_of(makeArrayRef(R).drop_front(1), [](int64_t C) { return C == 0; }))
+ return R[0] >= 0;
+
// 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);