This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/42635] New: no-op conversions hinder if-conversion


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]