public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amacleod at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/105086] [12 Regression] Dead Code Elimination Regression at -Os (trunk vs. 11.2.0) 25
Date: Tue, 29 Mar 2022 13:24:02 +0000	[thread overview]
Message-ID: <bug-105086-4-ALj2O8nnQG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-105086-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105086

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
(In reply to Richard Biener from comment #3)
> (In reply to Andrew Macleod from comment #2)

> 
> > I have an alternate question.  it looks like when we utilize scev to pick up
> > ranges we just give up if scev_probably_wraps_p() is true.
> > 
> > Analyzing # of iterations of loop 1
> >   exit condition 1 < [4294967273, + , 1]
> >   bounds on difference of bases: 4294967272 ... 4294967272
> >   result:
> >     # of iterations 23, bounded by 23
> > 
> > Statement (exit)if (a_1 > 1)
> > is executed at most 23 (bounded by 23) + 1 times in loop 1.
> > 
> > but we neglect to create range for the PHI. We should be able to properly
> > create a  range for this from the SCEV info rather than giving up?  It would
> > be [0,0][4294967273, 4294967295]. 
> 
> Well, we give up if the IV wraps because then the logic we have to compute
> the IV range doesn't work.  I'm talking about bounds_of_var_in_loop
> which basically computes the range as [base, base + step * niter] with
> adjustments to create proper ranges for negative step.
> 
Yeah, that is exactly where I was looking, and it looked like it was just to
keep things simple.

> > And even with the old value_range we could use anti-range and produce
> > ~[1, 4294967272]?
> 
> It should use the range as computed by the "iteration", just not use
> SCEV to refine it.
> 
> > Is there a practical reason we don't look any closer at wrap cases to see if
> > they are "simple wraps" or not?  I think that would also solve this issue.
> 
> The only reason is that nobody implemented it.  The important thing is to
> compute that it will wrap exactly once of course.

I suspected as much. I think we can enhance this next stage 1.

  parent reply	other threads:[~2022-03-29 13:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 17:06 [Bug tree-optimization/105086] New: " yann at ywg dot ch
2022-03-28 17:11 ` [Bug tree-optimization/105086] [12 Regression] " jakub at gcc dot gnu.org
2022-03-28 20:07 ` amacleod at redhat dot com
2022-03-29  7:31 ` rguenth at gcc dot gnu.org
2022-03-29 13:24 ` amacleod at redhat dot com [this message]
2022-03-29 13:37 ` jakub at gcc dot gnu.org
2022-03-29 13:41 ` amacleod at redhat dot com
2022-04-19 15:37 ` rguenth at gcc dot gnu.org
2022-05-06  8:33 ` [Bug tree-optimization/105086] [12/13 " jakub at gcc dot gnu.org
2023-05-08 12:24 ` [Bug tree-optimization/105086] [12/13/14 " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-105086-4-ALj2O8nnQG@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).