Bug 18399 - Class initialization optimization does not work with the inliner
Summary: Class initialization optimization does not work with the inliner
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: missed-optimization
: 21044 (view as bug list)
Depends on: 15576
Blocks: 17574
  Show dependency treegraph
Reported: 2004-11-09 14:36 UTC by Andrew Pinski
Modified: 2016-09-30 22:50 UTC (History)
3 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2006-03-05 03:47:58


Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-11-09 14:36:12 UTC
As reported in <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00713.html>.  We no longer do the 
class initializer optimization after inlining.
Comment 1 Andrew Pinski 2004-11-09 14:53:00 UTC
A good small example:
public class t
  static final int nn()
    return 0;

  public static void main (String[] argv)
    int n = 0;
    for (int i = 0; i < 1000; i++)
      n += nn();
Comment 2 Andrew Pinski 2004-12-12 04:39:18 UTC
Actually the way this used to work before the tree-ssa was during inlining we called out to the front-
end to merge the two variables.
Comment 3 Mark Mitchell 2005-01-19 18:52:03 UTC
Ada and Java bugs are not release-critical; therefore, I've removed the target
Comment 4 Andrew Pinski 2005-04-16 16:57:17 UTC
*** Bug 21044 has been marked as a duplicate of this bug. ***
Comment 5 Andrew Haley 2005-05-03 13:12:39 UTC
This bug is obsoleted by the fix for PR java/19285.
Comment 6 Andrew Pinski 2005-08-20 19:29:12 UTC
Actually this still does not work:
From .final_cleanup:
  _Jv_InitClass (&t.class);

  i = i + 1;
  if (i == 1000) goto <L4>; else goto <L1>;
Comment 7 Andrew Pinski 2005-08-20 19:31:58 UTC
I should copy and paste the full tree dump:
<bb 0>:
  _Jv_InitClass (&t.class);
  n = 0;

  _Jv_InitClass (&t.class);
  n = n + 1;

  if (n == 1000) goto <L4>; else goto <L1>;

The call to _Jv_InitClass is in the inner loop which causes a slow down and use not to be able to remove 
the loop.
Comment 8 Andrew Pinski 2016-09-30 22:50:37 UTC
Closing as won't fix as the Java front-end has been removed from the trunk.