[PATCH] D152067: [ConstraintElimination] Handle equality predicates

Antonio Frighetto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 02:17:22 PDT 2023


antoniofrighetto added a comment.

We may do that, and eventually ending up with the following:

  auto CondImpliedStatus = R.isImpliedBy(CSToUse);
  
  if (CondImpliedStatus == ConditionImpliedTy::ConditionTrue) {
    Changed = ReplaceCmpWithConstant(Cmp, true);
  } else if (CondImpliedStatus == ConditionImpliedTy::ConditionFalse) {
    Changed = ReplaceCmpWithConstant(Cmp, false);
  }
  
  // Compute the negated separately.
  auto Negated = ConstraintSystem::negate(R.Coefficients);
  auto IsNegatedImplied =
      !Negated.empty() && CSToUse.isConditionImplied(Negated);
  
  if (IsNegatedImplied) {
    Changed = ReplaceCmpWithConstant(Cmp, false);
  }

in `checkAndReplaceCondition`, as we would still need to compute the negated separately (`reproducer-remarks-debug.ll` seems to be complaining). Perhaps we slightly lose some of the clarity / self-documenting that comes with distinguishing between `EqualityTrue`, `ConditionTrue` (may assist in debugging), though, likewise, that shouldn't be really that much of a problem. Could that work?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152067/new/

https://reviews.llvm.org/D152067



More information about the llvm-commits mailing list