[llvm] [InstCombine] Remove INT_MIN poison check from abs(X) u< C --> X + (C-1) u<= 2*(C-1) fold. (PR #219264)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 28 03:20:04 PDT 2026
================
@@ -4443,13 +4441,15 @@ Instruction *InstCombinerImpl::foldICmpIntrinsicWithConstant(ICmpInst &Cmp,
ConstantInt::get(Ty, 2 * C));
}
- // If abs(INT_MIN) is poison and C >= 1:
+ // If C >= 1:
// abs(X) u< C --> X + (C - 1) u<= 2 * (C - 1)
- if (IsIntMinPoison && Pred == CmpInst::ICMP_ULT && C.sge(1)) {
+ // Note: works for both cases:
+ // abs(INT_MIN, true) returns poison.
+ // abs(INT_MIN, false) returns INT_MIN causing both forms to return false.
----------------
tadeuszjt wrote:
Fixed in the latest push
https://github.com/llvm/llvm-project/pull/219264
More information about the llvm-commits
mailing list