[llvm] [ConstraintElim] Optimize usub.sat intrinsic based on known constraints (PR #135744)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 15 07:22:55 PDT 2025
================
@@ -1137,12 +1137,15 @@ void State::addInfoFor(BasicBlock &BB) {
FactOrCheck::getCheck(DT.getNode(&BB), cast<CallInst>(&I)));
// TODO: Check if it is possible to instead only added the min/max facts
// when simplifying uses of the min/max intrinsics.
- if (!isGuaranteedNotToBePoison(&I))
- break;
+ if (isGuaranteedNotToBePoison(&I))
+ WorkList.push_back(FactOrCheck::getInstFact(DT.getNode(&BB), &I));
+ break;
+ case Intrinsic::usub_sat:
+ WorkList.push_back(
+ FactOrCheck::getCheck(DT.getNode(&BB), cast<CallInst>(&I)));
[[fallthrough]];
case Intrinsic::abs:
case Intrinsic::uadd_sat:
- case Intrinsic::usub_sat:
WorkList.push_back(FactOrCheck::getInstFact(DT.getNode(&BB), &I));
----------------
dtcxzyw wrote:
You can add `noundef` to parameters to avoid test regressions.
https://github.com/llvm/llvm-project/pull/135744
More information about the llvm-commits
mailing list