[llvm] [InstCombine] Fold npos select around umin (PR #202748)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 11:56:49 PDT 2026
================
@@ -4526,6 +4526,29 @@ static Value *simplifyWithOpsReplaced(Value *V,
return ConstantInt::get(I->getType(), 0);
}
+
+ // umin(-1, x) -> x
+ // umin(x, -1) -> x
+ if (auto *MMI = dyn_cast<MinMaxIntrinsic>(II)) {
+ if (MMI->getIntrinsicID() == Intrinsic::umin) {
----------------
nikic wrote:
This generalizes to other min/max intrinsics. Can you please add an API similar to MinMaxIntrinsic::getSaturationPoint() for this? E.g. MinMaxIntrinsic::getIdentity(). I'm kind of surprised it doesn't exist yet.
https://github.com/llvm/llvm-project/pull/202748
More information about the llvm-commits
mailing list