This series contains the following: 1) signed compares against a constant are now canonicalized towards 0 so that (x >= 0) doesn't become (x > -1) 2) a signed compare like (x >= 0 && x <= C) is simplified into the unsigned compare: (x <= C) This series is also available for review and testing at: git://git.kernel.org/pub/scm/devel/sparse/sparse.git optim-and-cmp Luc Van Oostenryck (4): canonicalize constant signed compares toward zero add testcases for AND(x > 0, x <= C) --> x u<= C add helper is_positive() simplify AND(x >= 0, x < C) --> (unsigned)x < C linearize.h | 5 ++ simplify.c | 45 +++++++++++++--- validation/optim/canonical-cmp-zero.c | 74 +++++++++++++++++++++++++++ validation/optim/range-check1.c | 16 ++++++ validation/optim/range-check2.c | 14 +++++ 5 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 validation/optim/canonical-cmp-zero.c create mode 100644 validation/optim/range-check1.c create mode 100644 validation/optim/range-check2.c base-commit: eb4cdd21b7d0cedbbeff7f70e24473706ccce5a6 -- 2.31.1