linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [SPARSE 0/4] fix/improve canonicalization of signed compares
@ 2021-04-18 15:32 Luc Van Oostenryck
  2021-04-18 15:32 ` [SPARSE 1/4] canonicalize constant signed compares toward zero Luc Van Oostenryck
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luc Van Oostenryck @ 2021-04-18 15:32 UTC (permalink / raw)
  To: linux-sparse; +Cc: Linus Torvalds, Luc Van Oostenryck

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-18 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-18 15:32 [SPARSE 0/4] fix/improve canonicalization of signed compares Luc Van Oostenryck
2021-04-18 15:32 ` [SPARSE 1/4] canonicalize constant signed compares toward zero Luc Van Oostenryck
2021-04-18 15:32 ` [SPARSE 2/4] add testcases for AND(x > 0, x <= C) --> x u<= C Luc Van Oostenryck
2021-04-18 15:32 ` [SPARSE 3/4] add helper is_positive() Luc Van Oostenryck
2021-04-18 15:32 ` [SPARSE 4/4] simplify AND(x >= 0, x < C) --> (unsigned)x < C Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).