JDK-6837146 : Should perform unswitch before maximally unroll in loop transformation
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-05-04
  • Updated: 2010-04-02
  • Resolved: 2009-06-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u18Fixed 7Fixed hs16Fixed
Description
Here is the piece of code in loop transformation:
   if( should_maximally_unroll ) {
      // Here we did some unrolling and peeling.  Eventually we will
      // completely unroll this loop and it will no longer be a loop.
      phase->do_maximally_unroll(this,old_new);
      return true;
    }
    if (should_unswitch) {
      phase->do_unswitching(this, old_new);
      return true;
    }

Suppose the loop can be both fully unrolled and unswitched, the loop unswitching 
optimization will never be executed. However, if we change the order of these two optimizations, both can be performed (and thus has the potential benefit).

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/273b2358ef1a
28-05-2009