public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/51030] New: PHI opt does not handle value-replacement with a transfer function
@ 2011-11-08 12:02 rguenth at gcc dot gnu.org
  2011-11-10 12:51 ` [Bug tree-optimization/51030] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-08 12:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51030

             Bug #: 51030
           Summary: PHI opt does not handle value-replacement with a
                    transfer function
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org


int f(int i)
{
  if (i)
    return i+2;
  return 2;
}

struct C { int i; };
int *g(struct C *p)
{
  if (p)
    return &p->i;
  return (int *)0;
}

both cases can be optimized to return i + 2 or &p->i, respectively.
Currently it only handles

int f(int i)
{
  if (i != 1)
    return i;
  return 1;
}


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

* [Bug tree-optimization/51030] PHI opt does not handle value-replacement with a transfer function
  2011-11-08 12:02 [Bug tree-optimization/51030] New: PHI opt does not handle value-replacement with a transfer function rguenth at gcc dot gnu.org
@ 2011-11-10 12:51 ` rguenth at gcc dot gnu.org
  2011-11-10 13:09 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-10 12:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51030

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-10 12:24:56 UTC ---
Author: rguenth
Date: Thu Nov 10 12:24:52 2011
New Revision: 181254

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181254
Log:
2011-11-10  Richard Guenther  <rguenther@suse.de>

    PR tree-optimization/51030
    * tree-ssa-phiopt.c (jump_function_from_stmt): New function.
    (value_replacement): Use it to handle trivial non-empty
    intermediate blocks.

    * gcc.dg/tree-ssa/phi-opt-6.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-6.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-phiopt.c


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

* [Bug tree-optimization/51030] PHI opt does not handle value-replacement with a transfer function
  2011-11-08 12:02 [Bug tree-optimization/51030] New: PHI opt does not handle value-replacement with a transfer function rguenth at gcc dot gnu.org
  2011-11-10 12:51 ` [Bug tree-optimization/51030] " rguenth at gcc dot gnu.org
@ 2011-11-10 13:09 ` rguenth at gcc dot gnu.org
  2012-01-24  0:04 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-11-10 13:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51030

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-10
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-11-10 12:25:09 UTC ---
Easy case handled now.


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

* [Bug tree-optimization/51030] PHI opt does not handle value-replacement with a transfer function
  2011-11-08 12:02 [Bug tree-optimization/51030] New: PHI opt does not handle value-replacement with a transfer function rguenth at gcc dot gnu.org
  2011-11-10 12:51 ` [Bug tree-optimization/51030] " rguenth at gcc dot gnu.org
  2011-11-10 13:09 ` rguenth at gcc dot gnu.org
@ 2012-01-24  0:04 ` pinskia at gcc dot gnu.org
  2023-10-27  5:47 ` pinskia at gcc dot gnu.org
  2023-10-27  5:50 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-24  0:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51030

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-23 23:44:11 UTC ---
*** Bug 42635 has been marked as a duplicate of this bug. ***


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

* [Bug tree-optimization/51030] PHI opt does not handle value-replacement with a transfer function
  2011-11-08 12:02 [Bug tree-optimization/51030] New: PHI opt does not handle value-replacement with a transfer function rguenth at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-01-24  0:04 ` pinskia at gcc dot gnu.org
@ 2023-10-27  5:47 ` pinskia at gcc dot gnu.org
  2023-10-27  5:50 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-27  5:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am rewriting value-replacement in phi-opt to use match-and-simplify which
should simplify many of this.

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

* [Bug tree-optimization/51030] PHI opt does not handle value-replacement with a transfer function
  2011-11-08 12:02 [Bug tree-optimization/51030] New: PHI opt does not handle value-replacement with a transfer function rguenth at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-10-27  5:47 ` pinskia at gcc dot gnu.org
@ 2023-10-27  5:50 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-27  5:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 56317
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56317&action=edit
First set of patches

Note the last patch is still being worked on really.
Note the first patch is just a small speed up and makes the last patch easier
to write.
The middle 2 patches are ones which move some of the optimizations that
value_replacement does to match. I think I need the `a == 1` cases still.

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

end of thread, other threads:[~2023-10-27  5:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08 12:02 [Bug tree-optimization/51030] New: PHI opt does not handle value-replacement with a transfer function rguenth at gcc dot gnu.org
2011-11-10 12:51 ` [Bug tree-optimization/51030] " rguenth at gcc dot gnu.org
2011-11-10 13:09 ` rguenth at gcc dot gnu.org
2012-01-24  0:04 ` pinskia at gcc dot gnu.org
2023-10-27  5:47 ` pinskia at gcc dot gnu.org
2023-10-27  5:50 ` 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).