public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anton at mips dot complang dot tuwien dot ac dot at" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/15242] pessimization of "goto *" Date: Fri, 16 Jul 2004 08:17:00 -0000 [thread overview] Message-ID: <20040716081746.17296.qmail@sourceware.org> (raw) In-Reply-To: <20040501142654.15242.anton@mips.complang.tuwien.ac.at> ------- Additional Comments From anton at mips dot complang dot tuwien dot ac dot at 2004-07-16 08:17 ------- Subject: Re: pessimization of "goto *" zlomj9am at artax dot karlin dot mff dot cuni dot cz 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). > > Yes, it is enabled by the patch. The patch duplicates block with computed goto > to place where a uncond jump to the conputed goto block is if the block is > small enough. > The computed jump in the small testcase is not duplicated, because the uncond > jumps from other places do not jump to a basic block which contains the > computed jump but to other block: ... Thanks for opening my eyes. > > 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). > > Adding an new flag is possible. However, I do not see why you explicitelly want > to disable reorder-blocks. We need it for the dynamic superinstruction optimization (aka selective inlining, PLDI'98 p. 291) in Gforth and further optimizations building on that (other people working on efficient interpreters/dynamic code generators have the same problem; e.g., I recently talked to Etienne Gagnon (http://sablevm.org/) about this; qemu also uses -fno-reorder-blocks). For dynamic superinstructions we need to ensure that the machine code corresponding to source code between two labels is between the addresses that gcc produces for the labels. The flag -fno-reorder-blocks almost gives us that (but the sharing of the "goto *"s breaks that). Even for just plain interpreters (without dynamic superinstructions), the sharing of the "goto *"s resulting from the merging of code after conditional jumps (as shown in the simplified testcase) will often reduce performance significantly through lower BTB accuracy. So for performance one probably wants to use -fno-reorder-blocks there, unless this results in merging the "goto *"s, as it does now. > > 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) > > The combiner should have already combined these insns before the duplication of > computed gotos is run. This pass just duplicates some insns. My guess is that the combiner does not combine these insns before duplication, because they are in different basic blocks before duplication. Without duplication the code would look like: movl a.0(,%ebx,4), %eax jmp .L9 ... .L9: jmp *%eax - anton -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15242
next prev parent reply other threads:[~2004-07-16 8:17 UTC|newest] Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-05-01 14:27 [Bug optimization/15242] New: " anton at mips dot complang dot tuwien dot ac dot at 2004-05-01 14:30 ` [Bug optimization/15242] " anton at mips dot complang dot tuwien dot ac dot at 2004-05-01 14:38 ` pinskia at gcc dot gnu dot org 2004-05-01 14:41 ` pinskia at gcc dot gnu dot org 2004-05-01 14:42 ` pinskia at gcc dot gnu dot org 2004-05-01 15:03 ` anton at a0 dot complang dot tuwien dot ac dot at 2004-05-01 15:13 ` pinskia at gcc dot gnu dot org 2004-05-02 7:24 ` anton at a0 dot complang dot tuwien dot ac dot at 2004-05-02 19:06 ` jsm at polyomino dot org dot uk 2004-05-04 15:06 ` anton at a0 dot complang dot tuwien dot ac dot at 2004-05-06 4:45 ` pinskia at gcc dot gnu dot org 2004-05-23 9:40 ` [Bug rtl-optimization/15242] " zlomek at gcc dot gnu dot org 2004-05-25 9:28 ` zlomek at gcc dot gnu dot org 2004-05-26 18:57 ` pinskia at gcc dot gnu dot org 2004-06-16 7:01 ` pinskia at gcc dot gnu dot org 2004-07-06 20:35 ` anton at mips dot complang dot tuwien dot ac dot at 2004-07-06 22:00 ` pinskia at gcc dot gnu dot org 2004-07-07 4:49 ` zlomj9am at artax dot karlin dot mff dot cuni dot cz 2004-07-07 13:34 ` zlomek at gcc dot gnu dot org 2004-07-08 13:03 ` anton at mips dot complang dot tuwien dot ac dot at 2004-07-16 6:50 ` zlomek at gcc dot gnu dot org 2004-07-16 7:01 ` zlomj9am at artax dot karlin dot mff dot cuni dot cz 2004-07-16 8:17 ` anton at mips dot complang dot tuwien dot ac dot at [this message] 2004-07-16 8:42 ` zlomj9am at artax dot karlin dot mff dot cuni dot cz 2004-10-03 20:25 ` bernd dot paysan at gmx dot de 2004-10-04 12:21 ` giovannibajo at libero dot it 2004-10-25 21:10 ` steven at gcc dot gnu dot org 2004-12-18 16:46 ` [Bug rtl-optimization/15242] [4.0 regression] " steven at gcc dot gnu dot org 2004-12-18 18:18 ` [Bug rtl-optimization/15242] [3.3/3.4/4.0 " pinskia at gcc dot gnu dot org 2005-01-26 17:28 ` steven at gcc dot gnu dot org 2005-01-27 13:45 ` pinskia at gcc dot gnu dot org 2005-02-01 10:04 ` cvs-commit at gcc dot gnu dot org 2005-02-01 10:11 ` [Bug rtl-optimization/15242] [3.3/3.4 " steven at gcc dot gnu dot org 2005-02-07 18:56 ` kazu at cs dot umass dot edu 2005-02-07 19:00 ` pinskia at gcc dot gnu dot org 2005-02-27 18:12 ` anton at mips dot complang dot tuwien dot ac dot at 2005-03-10 12:48 ` steven at gcc dot gnu dot org 2005-03-12 21:38 ` anton at mips dot complang dot tuwien dot ac dot at 2005-03-12 21:54 ` stevenb at suse dot de 2005-04-03 13:24 ` schwab at suse dot de 2005-04-07 9:03 ` schwab at suse dot de 2005-04-07 14:45 ` schwab at suse dot de 2005-05-19 17:36 ` mmitchel at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040716081746.17296.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).