XChy wrote: Similar patterns like `a > 0 ? a < 0 : 1` could be considered here, [proof](https://alive2.llvm.org/ce/z/y4QP3Z). I think this patch could be expressed in a more general way based on ConstantRange. https://github.com/llvm/llvm-project/pull/69961