public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/51988] New: value_replacement in PHIOPT should handle even the cases where there are other PHIs even with non equal value
@ 2012-01-25  0:25 pinskia at gcc dot gnu.org
  2012-01-25  0:27 ` [Bug tree-optimization/51988] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-25  0:25 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51988
           Summary: value_replacement in PHIOPT should handle even the
                    cases where there are other PHIs even with non equal
                    value
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pinskia@gcc.gnu.org


Take:
int g(int,int);
int f(int t, int c)
{
  int d = 0;
  int e = 0;
  if (t)
    {
      d = t;
      if (c) e = 1;
    }
  else d = 0, e = 0;
  return g(d,e);
}

--- CUT ---
Currently we get:
<bb 2>:
  if (t_5(D) != 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 3>:
  if (c_7(D) != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:

<bb 5>:
  # d_1 = PHI <t_5(D)(4), 0(2), t_5(D)(3)>
  # e_2 = PHI <3(4), 0(2), 0(3)>

But we could reduce it down to:
<bb 2>:
  if (t_5(D) != 0)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 3>:
  if (c_7(D) != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

<bb 4>:

<bb 5>:
  # d_1 = PHI <t_5(D)(4), t_5(D)(2), t_5(D)(3)>
  # e_2 = PHI <3(4), 0(2), 0(3)>

As t_5 on the edge from bb 2 to bb 5, t_5 is 0.


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

end of thread, other threads:[~2013-11-09 22:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25  0:25 [Bug tree-optimization/51988] New: value_replacement in PHIOPT should handle even the cases where there are other PHIs even with non equal value pinskia at gcc dot gnu.org
2012-01-25  0:27 ` [Bug tree-optimization/51988] " pinskia at gcc dot gnu.org
2012-01-25  0:45 ` pinskia at gcc dot gnu.org
2012-01-25  0:59 ` pinskia at gcc dot gnu.org
2012-01-25  2:05 ` pinskia at gcc dot gnu.org
2012-01-25  2:26 ` pinskia at gcc dot gnu.org
2012-01-25  3:30 ` pinskia at gcc dot gnu.org
2012-01-25  4:40 ` pinskia at gcc dot gnu.org
2012-01-25 23:18 ` pinskia at gcc dot gnu.org
2012-03-09  9:27 ` pinskia at gcc dot gnu.org
2013-11-09 22:21 ` 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).