Bug 24408 - [4.1 Regression] Invariant code no longer removed from loop when doing FDO.
Summary: [4.1 Regression] Invariant code no longer removed from loop when doing FDO.
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Steven Bosscher
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: missed-optimization
Depends on: 24265 24762
Blocks: 22366
  Show dependency treegraph
 
Reported: 2005-10-17 15:12 UTC by Pete Steinmetz
Modified: 2006-02-11 11:40 UTC (History)
3 users (show)

See Also:
Host:
Target: powerpc*-*-* and others
Build:
Known to work: 4.2.0
Known to fail: 4.1.0
Last reconfirmed: 2005-11-08 20:36:56


Attachments
merge patch from the killloop-branch (7.89 KB, patch)
2005-11-08 07:44 UTC, Steven Bosscher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pete Steinmetz 2005-10-17 15:12:35 UTC
There was some discussion on the GCC mailing list in late August, early September about a performance regression caused by the disabling of the old loop optimizer when doing FDO.

http://gcc.gnu.org/ml/gcc/2005-08/msg00899.html

Loop invariant motions done by the old loop optimizer no longer occur.  This is causing a performance regression on some benchmarks.

The following patch enables loop invariant motions during FDO and fixes the observed performance regression:

http://gcc.gnu.org/ml/gcc-patches/2005-10/msg00224.html
Comment 1 Andrew Pinski 2005-10-17 15:14:13 UTC
Confirmed.
Comment 2 Andrew Pinski 2005-10-17 15:26:58 UTC
Linking to the testcase for future reference:
http://gcc.gnu.org/ml/gcc/2005-08/msg00910.html
Comment 3 Mark Mitchell 2005-10-31 06:30:44 UTC
Leaving as P2.
Comment 4 Steven Bosscher 2005-11-03 08:50:00 UTC
We have the following two options:
- Make loop.c preserve the profile. We all know that's not doable.
- Backport the loop-invariant.c changes from the killloop-branch
  and enable -fmove-loop-invariants when doing FDO.  We should not
  do this because loop-invariant.c has not seen enough testing yet.

So IMHO this is not fixable for GCC 4.1.

Comment 5 Steven Bosscher 2005-11-08 07:44:18 UTC
Created attachment 10170 [details]
merge patch from the killloop-branch

With this patch applied and -fmove-loop-invariants enabled by default at -O2, I am getting regressions in libjava on ia64. But it does bootstrap there and also passes bootstrap&testing on i686, x86_64, ppc, and ppc64 without problems.
Comment 6 Steven Bosscher 2005-11-08 20:36:56 UTC
I found an extra problem with loop-invariant.c, which is that it would move expressions out of loops with calls, even if the expressions used call clobbered hard registers.  I'm testing a fix for this bug now, too...
Comment 7 Steven Bosscher 2005-12-18 17:17:01 UTC
This will *NOT* be fixed for GCC 4.1.

Comment 8 Steven Bosscher 2006-02-11 11:40:42 UTC
Fixed in GCC 4.2 now that -fmove-loop-invariants is enabled by default.

Closing as WONTFIX because this is really not fixable for GCC 4.1. without major surgery or ugly and unsafe hacks.