[InstCombine] Fold icmps comparing uadd_sat with a constant
This patch is a continuation of D154206. It introduces a fold for the operation "uadd_sat(X, C) pred C2" where "C" and "C2" are constants. The fold is: uadd_sat(X, C) pred C2 => (X >= ~C) || ((X + C) pred C2) -> when (UINT_MAX pred C2) is true => (X < ~C) && ((X + C) pred C2) -> when (UINT_MAX pred C2) is false This patch also generalizes the fold to work with any saturating intrinsic as long as the saturating value is known. Proofs: https://alive2.llvm.org/ce/z/wWeirP Differential Revision: https://reviews.llvm.org/D154565
Loading
Please sign in to comment