[llvm] [ConstraintElim] Add facts implied by llvm.abs (PR #73189)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 28 02:25:52 PST 2023
================
@@ -984,32 +984,37 @@ void State::addInfoFor(BasicBlock &BB) {
continue;
}
- if (match(&I, m_Intrinsic<Intrinsic::ssub_with_overflow>())) {
+ auto *II = dyn_cast<IntrinsicInst>(&I);
+ Intrinsic::ID ID = II ? II->getIntrinsicID() : Intrinsic::not_intrinsic;
+ switch (ID) {
+ case Intrinsic::assume:
+ Value *A, *B;
+ CmpInst::Predicate Pred;
+ if (match(I.getOperand(0), m_ICmp(Pred, m_Value(A), m_Value(B)))) {
+ if (GuaranteedToExecute) {
+ // The assume is guaranteed to execute when BB is entered, hence Cond
+ // holds on entry to BB.
+ WorkList.emplace_back(FactOrCheck::getConditionFact(
+ DT.getNode(I.getParent()), Pred, A, B));
+ } else {
+ WorkList.emplace_back(
+ FactOrCheck::getInstFact(DT.getNode(I.getParent()), &I));
+ }
+ }
+ break;
+ case Intrinsic::ssub_with_overflow:
WorkList.push_back(
----------------
fhahn wrote:
might be good to add a comment here that we queue ssub_with_overflow for simplification and below we queue the intrinsics to add extra info.
https://github.com/llvm/llvm-project/pull/73189
More information about the llvm-commits
mailing list