forked from OSchip/llvm-project
[ConstraintElimination] Simplify logic for using inverse predicate (NFC)
Recent improvements to the code structure mean we don't need to reset the condition's predicate in the IR and later restore it. Remove the restorer logic.
This commit is contained in:
parent
9bcda47afc
commit
bdfe986d66
|
@ -852,25 +852,13 @@ static bool eliminateConstraints(Function &F, DominatorTree &DT) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// Set up a function to restore the predicate at the end of the scope if it
|
||||
// has been negated. Negate the predicate in-place, if required.
|
||||
auto *CI = dyn_cast<ICmpInst>(CB.Condition);
|
||||
auto PredicateRestorer = make_scope_exit([CI, &CB]() {
|
||||
if (CB.Not && CI)
|
||||
CI->setPredicate(CI->getInversePredicate());
|
||||
});
|
||||
if (CB.Not) {
|
||||
if (CI) {
|
||||
CI->setPredicate(CI->getInversePredicate());
|
||||
} else {
|
||||
LLVM_DEBUG(dbgs() << "Can only negate compares so far.\n");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
ICmpInst::Predicate Pred;
|
||||
Value *A, *B;
|
||||
if (match(CB.Condition, m_ICmp(Pred, m_Value(A), m_Value(B)))) {
|
||||
// Use the inverse predicate if required.
|
||||
if (CB.Not)
|
||||
Pred = CmpInst::getInversePredicate(Pred);
|
||||
|
||||
Info.addFact(Pred, A, B, CB.NumIn, CB.NumOut, DFSInStack);
|
||||
Info.transferToOtherSystem(Pred, A, B, CB.NumIn, CB.NumOut, DFSInStack);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue