This is the mail archive of the gcc@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]

Why -fPIC stops some optimization?


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.


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