This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/15242] pessimization of "goto *"
- From: "anton at mips dot complang dot tuwien dot ac dot at" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jul 2004 13:03:28 -0000
- Subject: [Bug rtl-optimization/15242] pessimization of "goto *"
- References: <20040501142654.15242.anton@mips.complang.tuwien.ac.at>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From anton at mips dot complang dot tuwien dot ac dot at 2004-07-08 13:03 -------
Subject: Re: pessimization of "goto *"
zlomek at gcc dot gnu dot org wrote:
> The optimization is enabled at -O2
Not as far as I can tell (tried it on i386 with patched versions of
gcc-3.5-20040704 and gcc-3.5-20040523).
> (or -O -freorder-blocks).
That seems to work, though.
We would like to use -fno-reorder-blocks with
duplicate_computed_gotos, either through an extra option, or by just
having duplicate_computed_gotos all the time (at least for our code
these gotos were duplicated already in the source code, so duplicating
them again in the back end is closer to the idea of
-fno-reorder-blocks than not duplicating them).
> If there is a uncond jump to a block containing a computed jump and the block is
> small enough (several instructions) the block is copied to eliminate the uncond
> jump.
>
> When I was testing the patch with current mainline I have noticed that the
> current_function_has_computed_jump flag is incorrectly unset in make_edges()
> when compiling ef.i.
Ok, that explains why this patch does not work for ef.i.
One other thing I noticed is that apparently there is no combining
pass (or its tree-ssa equivalent) after duplicate_computed_gotos,
resulting in compiling code like
goto *a[i];
into
movl a.0(,%ebx,4), %eax
jmp *%eax
instead of
jmp *a.0(,%ebx,4)
Thanks for your efforts,
- anton
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15242