linux-gcc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why -fPIC stops some optimization?
@ 2004-07-09 15:02 Denis Zaitsev
  2004-07-09 20:45 ` Michel Lespinasse
  0 siblings, 1 reply; 4+ messages in thread
From: Denis Zaitsev @ 2004-07-09 15:02 UTC (permalink / raw)
  To: gcc, linux-gcc

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.

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

end of thread, other threads:[~2004-07-11 22:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-09 15:02 Why -fPIC stops some optimization? Denis Zaitsev
2004-07-09 20:45 ` Michel Lespinasse
2004-07-09 21:58   ` Denis Zaitsev
2004-07-11 22:28     ` Michel Lespinasse

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 NNTP newsgroup(s).