[ConstraintElim] Allow and check preconditions in doesHold.
authorFlorian Hahn <flo@fhahn.com>
Thu, 29 Jun 2023 08:17:37 +0000 (09:17 +0100)
committerFlorian Hahn <flo@fhahn.com>
Thu, 29 Jun 2023 08:17:37 +0000 (09:17 +0100)
Delegate checking of the constraint & its preconditions to the existing
::isValid. This reduces duplication and allows additional optimizations
together with D152730.

llvm/lib/Transforms/Scalar/ConstraintElimination.cpp

index afa554c..864f0a1 100644 (file)
@@ -693,7 +693,7 @@ ConstraintTy::isImpliedBy(const ConstraintSystem &CS) const {
 bool ConstraintInfo::doesHold(CmpInst::Predicate Pred, Value *A,
                               Value *B) const {
   auto R = getConstraintForSolving(Pred, A, B);
-  return R.Preconditions.empty() && !R.empty() &&
+  return R.isValid(*this) &&
          getCS(R.IsSigned).isConditionImplied(R.Coefficients);
 }