public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42635]  New: no-op conversions hinder if-conversion
@ 2010-01-06 15:16 rguenth at gcc dot gnu dot org
  2010-01-06 15:17 ` [Bug tree-optimization/42635] " rguenth at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-06 15:16 UTC (permalink / raw)
  To: gcc-bugs

The following two functions are not if-converted at the tree level (the 2nd
example happens a lot from VEC code via VEC_BASE):

int *bar (char *p)
{
  int *q;
  if (p)
    q = (int *)p;
  else
    q = (int *)0;
  return q;
}

struct X { int q; };
int *foo (struct X *p)
{
  int *q;
  if (p)
    q = &p->q;
  else
    q = (int *)0;
  return q;
}

before phiopt1 we have

bar (char * p)
{
  int * q;

<bb 2>:
  if (p_2(D) != 0B)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  q_3 = (int *) p_2(D);

<bb 4>:
  # q_1 = PHI <q_3(3), 0B(2)>
  return q_1;

which can be optimized to just

<bb 2>:
  return (int *) p_2(D);

well - with a separate stmt for the conversion.


-- 
           Summary: no-op conversions hinder if-conversion
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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


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

* [Bug tree-optimization/42635] no-op conversions hinder if-conversion
  2010-01-06 15:16 [Bug tree-optimization/42635] New: no-op conversions hinder if-conversion rguenth at gcc dot gnu dot org
@ 2010-01-06 15:17 ` rguenth at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-01-06 15:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-01-06 15:17 -------
Created an attachment (id=19485)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19485&action=view)
testcase using vec.h


-- 


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


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

end of thread, other threads:[~2010-01-06 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-06 15:16 [Bug tree-optimization/42635] New: no-op conversions hinder if-conversion rguenth at gcc dot gnu dot org
2010-01-06 15:17 ` [Bug tree-optimization/42635] " rguenth at gcc dot gnu dot 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).