public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/42635]  New: no-op conversions hinder if-conversion
Date: Wed, 06 Jan 2010 15:16:00 -0000	[thread overview]
Message-ID: <bug-42635-10053@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2010-01-06 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06 15:16 rguenth at gcc dot gnu dot org [this message]
2010-01-06 15:17 ` [Bug tree-optimization/42635] " rguenth at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-42635-10053@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).