public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Veksler <VEKSLER@il.ibm.com>
To: "Giovanni Bajo" <rasky@develer.com>
Cc: gcc@gcc.gnu.org, tromey@redhat.com
Subject: Re: potential simple loop optimization assistance strategy?
Date: Sat, 02 Jul 2005 15:39:00 -0000	[thread overview]
Message-ID: <OF003C77DC.BEBBB0C7-ONC2257032.00559976-C2257032.0055ED3B@il.ibm.com> (raw)
In-Reply-To: <002801c57ee6$f11b6750$7ebf2997@bagio>





Giovanni Bajo wrote on 02/07/2005 12:18:00:
>
> Yes, but the condition is still morally true in the code. NDEBUG is meant
to
> speed up the generated code, and it's actually a pity that instead it
> *disables* some optimizations because we don't see the condition anymore.
My
> suggestion is that assert with NDEBUG might expand to something like:
>
> if (condition)
>    unreachable();
>
> where unreachable is a function call marked with a special attribute
saying
> that execution can never get there. This way the run-time check is
> removed from
> the code, but the range information can still be propagated and used.
>
> Notice that such an attribute would be needed in the first place for
> gcc_unreachable() in our own sources. Right now we expand it to
gcc_assert(0),
> but we could do much better with a special attribute.

I always thought that when NDEBUG is set, then assert(x) should
have no side effects. So if "condition" contains any side effect,
or potential side effect (e.g. through function call), then the
compiler should not generate the code for "condition".

  Michael

  reply	other threads:[~2005-07-02 15:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01 15:51 Paul Schlie
2005-07-01 16:24 ` Gabriel Dos Reis
2005-07-01 17:15   ` Paul Schlie
2005-07-01 16:27 ` Devang Patel
2005-07-01 18:16 ` Giovanni Bajo
2005-07-01 18:22   ` Diego Novillo
2005-07-01 18:26     ` Giovanni Bajo
2005-07-01 19:42       ` Paul Schlie
     [not found]       ` <m3k6ka6po1.fsf@localhost.localdomain>
2005-07-02  9:18         ` Giovanni Bajo
2005-07-02 15:39           ` Michael Veksler [this message]
2005-07-02 18:58             ` Giovanni Bajo

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=OF003C77DC.BEBBB0C7-ONC2257032.00559976-C2257032.0055ED3B@il.ibm.com \
    --to=veksler@il.ibm.com \
    --cc=gcc@gcc.gnu.org \
    --cc=rasky@develer.com \
    --cc=tromey@redhat.com \
    /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).