This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize a >= 0 && a < b if VR info says b >= 0 (PR tree-optimization/77664)
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 6 Oct 2016 23:55:00 +0200 (CEST)
- Subject: Re: [PATCH] Optimize a >= 0 && a < b if VR info says b >= 0 (PR tree-optimization/77664)
- Authentication-results: sourceware.org; auth=none
- References: <20161006212208.GB7282@tucnak.redhat.com>
- Reply-to: gcc-patches at gcc dot gnu dot org
On Thu, 6 Oct 2016, Jakub Jelinek wrote:
For signed a, if we see a >= 0 && a < b and from VR know that b >= 0,
we can optimize those 2 comparisons into one unsigned -
(unsigned) a < (unsigned) b. Similarly for a < 0 || a > b (and also
for a <= b in the first and a >= b in the second).
I guess that the slightly more general:
X >= A && X < B where we know that A <= B
--> (unsigned)X - (unsigned)A < (unsigned)B - (unsigned)A
generates too many operations and does not gain anything? The case where A
and B are constants seems to be handled by ifcombine, currently.
--
Marc Glisse