This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/69526] ivopts candidate strangeness
- From: "amker at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 28 Jan 2016 10:10:52 +0000
- Subject: [Bug middle-end/69526] ivopts candidate strangeness
- Auto-submitted: auto-generated
- References: <bug-69526-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69526
--- Comment #3 from amker at gcc dot gnu.org ---
(In reply to rdapp from comment #2)
> Ok, that's sensible but why is the - 1 necessary in the first place?
>
> n_5 - 1 can only underflow if n_5 == 0 which is checked by
>
> testl %edx, %edx
>
> before. This is in a previous basic block, unfortunately, and will not be
> regarded by ivopts then (because strictly speaking, it has no influence on
> the induction variable)?
yes, one way out is use loop preconditions to improve range information and
then use that info to prove non-overflow. This has already been applied to
loop niter analysis and scev overflow check. I once opened a PR about this in
items of loop header bloated issue. (will update the PR number cause I don't
have it now). Another point is I think Richard planned to improve range
analysis wrto control flow? It could be helpful here in items of compilation
time.