JDK-8253923 : C2 doesn't always run loop opts for compilations that include loops
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,16
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-10-02
  • Updated: 2023-11-02
  • Resolved: 2020-10-12
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 11 JDK 16
11.0.12-oracleFixed 16 b20Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
I noticed that c2 wouldn't always run loop opts when the compilation include loops. Compile::has_loops() is what controls whether loop opts are executed. It's initially false and then set to true as parsing finds new loops. Parsing doesn't seem to always update the flag when it should.
Comments
11u Fix Request This fixes a major performance issue that was reported by a user: https://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2021-February/044115.html. Part of the discussion is private but the user was handed a build with the fix and verified his performance issue was solved. The root cause is that under some uncommon (but possibly not as rare as initially thought) conditions, c2 doesn't apply any loop optimizations. In the reporter's case, all loops are in a virtual method that's inlined from profile data. This bug was initially filed because I noticed an inconsistency in c2's handling of loop detection but it was at the time not considered a serious performance issue. The fix is relatively simple and low risk. That's why I think it should be considered for a backport. 11u RFR: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2021-March/005240.html
05-03-2021

Changeset: a6c23b77 Author: Roland Westrelin <roland@openjdk.org> Date: 2020-10-12 10:55:22 +0000 URL: https://git.openjdk.java.net/jdk/commit/a6c23b77
12-10-2020

ILW = Missed optimization opportunity in C2, rare cases, no workaround = MLH = P4
05-10-2020