This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why -fPIC stops some optimization?
- From: Michel Lespinasse <walken at zoy dot org>
- To: Denis Zaitsev <zzz at anda dot ru>
- Cc: gcc at gcc dot gnu dot org, linux-gcc at vger dot kernel dot org
- Date: Fri, 9 Jul 2004 13:45:50 -0700
- Subject: Re: Why -fPIC stops some optimization?
- References: <20040709210230.C7162@natasha.ward.six>
On Fri, Jul 09, 2004 at 09:02:30PM +0600, Denis Zaitsev wrote:
> 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 ... \
> ... \
> } \
> ... \
> })
I can not comment about your specific case, but in the past I've had a
fairly similar issue with an inline function that had branches and was
supposed to be optimized out to straight-line code at the call site.
Try making __n a const and see if it helps. Yes, this is something
that gcc should really figure it out by itself.
--
Michel "Walken" Lespinasse
"In this time of war against Osama bin Laden and the oppressive
Taliban regime, we are thankful that OUR leader isn't the spoiled son
of a powerful politician from a wealthy oil family who is supported by
religious fundamentalists, operates through clandestine organizations,
has no respect for the democratic electoral process, bombs innocents,
and uses war to deny people their civil liberties." --The Boondocks