public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/76174] Missed VRP optimization
       [not found] <bug-76174-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-19  1:43 ` pinskia at gcc dot gnu.org
  2021-08-19 13:33 ` amacleod at redhat dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-19  1:43 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2016-08-13 00:00:00         |2021-8-18

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
VN can optimizes this away now.
So you need "-fno-tree-fre -fno-tree-pre -fno-code-hoisting" to see VRP is not
able to optimize this away.

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

* [Bug middle-end/76174] Missed VRP optimization
       [not found] <bug-76174-4@http.gcc.gnu.org/bugzilla/>
  2021-08-19  1:43 ` [Bug middle-end/76174] Missed VRP optimization pinskia at gcc dot gnu.org
@ 2021-08-19 13:33 ` amacleod at redhat dot com
  2022-01-11 21:04 ` amacleod at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: amacleod at redhat dot com @ 2021-08-19 13:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
I would argue that this isn't a range issue.
Looking at the code generated without the c *= 2 I see:
 <bb 2> :
  goto <bb 6>; [INV]

  <bb 3> :
  if (q_1 == r_6(D))
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]

  <bb 4> :
  m ();

  <bb 5> :
  q_11 = q_1 + 1;
  x_12 = x_2 + 1;

  <bb 6> :
  # q_1 = PHI <0(2), q_11(5)>
  # x_2 = PHI <0(2), x_12(5)>
  if (x_2 < r_6(D))
    goto <bb 3>; [INV]
  else
    goto <bb 7>; [INV]

  <bb 7> :
  return;

we know that x_2<r_6 in in bb3 given the condition on the edge 6->3.

What isn't obvious from a range point of view is that x and q are in lockstep
and are actually equivalent.  There is nothing to indicate they are equivalent
other than they execute the same sequence of code. 

Given that, I would claim that VN or some other pass is required to sort this
out, which is exactly what happens now.

As we now get this optimization, I think the PR should be closed as this is not
something VRP would be planning to get.

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

* [Bug middle-end/76174] Missed VRP optimization
       [not found] <bug-76174-4@http.gcc.gnu.org/bugzilla/>
  2021-08-19  1:43 ` [Bug middle-end/76174] Missed VRP optimization pinskia at gcc dot gnu.org
  2021-08-19 13:33 ` amacleod at redhat dot com
@ 2022-01-11 21:04 ` amacleod at redhat dot com
  2022-01-12  7:12 ` cvs-commit at gcc dot gnu.org
  2022-01-12  7:14 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: amacleod at redhat dot com @ 2022-01-11 21:04 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Macleod <amacleod at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> ---
VN performs this optimization.

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

* [Bug middle-end/76174] Missed VRP optimization
       [not found] <bug-76174-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2022-01-11 21:04 ` amacleod at redhat dot com
@ 2022-01-12  7:12 ` cvs-commit at gcc dot gnu.org
  2022-01-12  7:14 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-12  7:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:45ddb395187f8f5f278880fe1422d8958ac35da6

commit r12-6513-g45ddb395187f8f5f278880fe1422d8958ac35da6
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jan 12 08:10:19 2022 +0100

    tree-optimization/76174 - testcase for fixed PR

    This adds a testcase for the fixed PR, VN now gets us the transform
    via IV equality plus predication.

    2022-01-12  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/76174
            * gcc.dg/tree-ssa/pr76174.c: New testcase.

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

* [Bug middle-end/76174] Missed VRP optimization
       [not found] <bug-76174-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-01-12  7:12 ` cvs-commit at gcc dot gnu.org
@ 2022-01-12  7:14 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-12  7:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

end of thread, other threads:[~2022-01-12  7:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-76174-4@http.gcc.gnu.org/bugzilla/>
2021-08-19  1:43 ` [Bug middle-end/76174] Missed VRP optimization pinskia at gcc dot gnu.org
2021-08-19 13:33 ` amacleod at redhat dot com
2022-01-11 21:04 ` amacleod at redhat dot com
2022-01-12  7:12 ` cvs-commit at gcc dot gnu.org
2022-01-12  7:14 ` pinskia at gcc dot gnu.org

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).