Bug 15023 - -frename-registers is slow
Summary: -frename-registers is slow
Status: RESOLVED DUPLICATE of bug 38582
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.0.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: compile-time-hog
Depends on: 16586 18599 22469 22472 23392 24034
Blocks: 20376 22208
  Show dependency treegraph
 
Reported: 2004-04-20 09:34 UTC by Paolo Bonzini
Modified: 2009-01-03 15:25 UTC (History)
3 users (show)

See Also:
Host:
Target: many
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-15 18:19:08


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Bonzini 2004-04-20 09:34:38 UTC
On 2004-04-17 I tried (as suggested some time earlier by Josef Zlomek) to move 
-frename-registers to -O1 level.  Though the patch was successfully 
bootstrapped and regtested on i686-pc-linux-gnu, it caused a lot of 
bootstrapping failures on several targets, so Geoff keating approved another 
patch to remove -frename-registers from any -O level.  At the same time, 
Richard Sandiford pointed out that -rename-registers takes up to 4% of 
compile-time, being quite a CPU hog. 
 
This PR tracks register renaming problems.  Most likely it applies to earlier 
versions than 3.5 as well.
Comment 1 Andrew Pinski 2004-04-20 11:08:17 UTC
Looks like the buggy part is target bugginess and not -frename-register's fault at all.  Confirmed based 
on the emails in the mailing lists.
Comment 2 Paolo Bonzini 2004-04-26 15:00:35 UTC
ia64 and arm have been fixed.  x86_64 has not, as far as I know, and regrename
still remains a CPU hog.
Comment 3 Steven Bosscher 2005-06-25 13:29:54 UTC
This bug report is totally useless.  There are no links to the relevant 
discussions that have apparently taken place.  There are no test cases, 
no examples of what or where or why things go wrong.  I believe this 
register renaming would be a useful pass for many targets, including 
amd64, so it would be nice to have this bug figured out and fixed.  So 
if anyone knows where to find those discussions mentioned in comments 
#0 and #1, can he/she please link them to this report? 
Comment 4 Serge Belyshev 2005-06-26 00:57:48 UTC
(In reply to comment #3)
> if anyone knows where to find those discussions mentioned in comments 
> #0 and #1, can he/she please link them to this report? 

http://gcc.gnu.org/ml/gcc-patches/2004-04/msg00961.html
Comment 5 Steven Bosscher 2005-06-26 09:21:26 UTC
Thanks Serge! 
Comment 6 Steven Bosscher 2005-06-26 11:26:11 UTC
The patch for PR18599 might have addressed the "slow" part of this bug 
report.  The "buggy" part may also be fixed already -- a number of e500 
related regrename.c patches went in since this bug report was opened, 
and it does look like those patches fixed real bugs, and maybe the same 
bugs as those referred to in this report. 
 
Comment 7 Eric Botcazou 2005-08-04 09:04:46 UTC
I'd like to mention a known problem with -frename-registers.  Quoting my
analysis for another bug report:

"However the underlying problem is still present and is now visible on x86-64:
the register renaming pass (regrename.c) uses its own life analysis engine to 
compute the def-use chains.  It turns out that it is less accurate than the 
all-purpose life analysis engine (flow.c) and, consequently, when the latter 
is invoked to update the global liveness info at the end of the pass, it may 
flag internal inconsistencies introduced because of the former.

It is not immediately obvious what the best approach to solving that would be.
A third life analysis engine exists (df.c) and is supposed to be modular, so 
we could try to plug it into regrename.c."

The typical example is PR rtl-optimization/16586.
Comment 8 Steven Bosscher 2005-08-04 09:51:06 UTC
The liveness analysis in df.c misses the registers marked in 
flow.c:mark_regs_live_at_end, so that'd have to be fixed first. 
 
 
 
Comment 9 Dale Johannesen 2005-10-24 17:58:39 UTC
Another bug in renaming just showed up on darwin rs6000.  When renaming changes a register in the RTL, it does not make the corresponding change in attached FRAME_RELATED notes.  This leads to inaccurate Dwarf exception tables and runtime failures in unwinding after a throw.  Don't know how widespread this would be; other rs6000 targets for sure.
Comment 10 Andrew Pinski 2005-10-24 18:03:27 UTC
(In reply to comment #9)
>Don't know how widespread this would be; other rs6000 targets for sure.

Yes this shows up as PR 23392 with the GNU runtime and objc exceptions.
Comment 11 Steven Bosscher 2006-04-24 22:29:49 UTC
Still an issue here??
Comment 12 Andrew Pinski 2006-08-15 18:19:08 UTC
(In reply to comment #11)
> Still an issue here??
I think the slowness still exist.
Comment 13 Steven Bosscher 2007-02-03 16:20:17 UTC
Haven't seen any reports of wrong-code coming out of register renaming in a while. Register renaming is enabled if loop unrolling / peeling is enabled.  So the test coverage of this pass is much better than it used to be.  I think that the wrong-code issue for this bug is fixed.
Comment 14 Ian Lance Taylor 2007-04-25 06:26:44 UTC
-frename-registers should be rewritten to use the new DF framework when dataflow branch is merged.

Lowering priority to P3.  This is not high priority.
Comment 15 Eric Botcazou 2007-11-03 07:57:42 UTC
Paolo, do you know what the status of this PR is?  Ian said in comment #14 that
the pass should be rewritten to use the DF framework.  Has this happened?  TIA.
Comment 16 Paolo Bonzini 2007-11-05 08:21:31 UTC
No, but I don't think this should hold up marking this PR as fixed.
Comment 17 Joost VandeVondele 2008-12-22 08:18:06 UTC
reopening as of PR38582 (where rename registers takes 13 hours to do its job).
Comment 18 Steven Bosscher 2009-01-03 15:24:02 UTC
Closing this as a dup of bug 38582 because that bug has a test case.

*** This bug has been marked as a duplicate of 38582 ***