linux-gcc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denis Zaitsev <zzz@anda.ru>
To: gcc@gcc.gnu.org, linux-gcc@vger.kernel.org
Subject: Why -fPIC stops some optimization?
Date: Fri, 9 Jul 2004 21:02:30 +0600	[thread overview]
Message-ID: <20040709210230.C7162@natasha.ward.six> (raw)

I have met such a behaviour while compiling GLIBC for x86.  A
construct which suffers looks like:


#define __xyz(x,y,z) ({ \
    ...                 \
    size_t __n= (z);    \
    ...                 \
    switch (__n) {      \
        case ...        \
        ...             \
    }                   \
    ...                 \
})


This macro is intended for use with some constant z
(__builtin_constant_p(z) is true).  And when this macro is used such a
way, GCC should unroll (or what is the word for this?) the switch into
the only branch which is needed.  And GCC does this optimization, but
only not for the -fPIC case.  There GCC emits the whole body for the
switch operator and then does just a jump for the correct branch.
Why?  Or it is some expected misbehaviour for the -fPIC case?

GCC-3.3.2.

Thanks in advance.

             reply	other threads:[~2004-07-09 15:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-09 15:02 Denis Zaitsev [this message]
2004-07-09 20:45 ` Why -fPIC stops some optimization? Michel Lespinasse
2004-07-09 21:58   ` Denis Zaitsev
2004-07-11 22:28     ` Michel Lespinasse

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=20040709210230.C7162@natasha.ward.six \
    --to=zzz@anda.ru \
    --cc=gcc@gcc.gnu.org \
    --cc=linux-gcc@vger.kernel.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).