Why -fPIC stops some optimization?
Denis Zaitsev <[email protected]> Fri, 9 Jul 2004 21:02:30 +0600
| Newsgroups | org.kernel.vger.linux-gcc |
|---|---|
| Message-ID | <[email protected]> |
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.