JDK-8145754 : PhaseIdealLoop::is_scaled_iv_plus_offset() does not match AddI
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8u60,9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-12-18
  • Updated: 2016-04-27
  • Resolved: 2015-12-21
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 8 JDK 9
8u101Fixed 9 b103Fixed
Description
PhaseIdealLoop::is_scaled_iv_plus_offset() returns false if 'exp' is an AddI node with the scaled iv as second input because is_scaled_iv() is only invoked for exp->in(1). We should fix it like this:

--- a/src/share/vm/opto/loopTransform.cpp	Fri Dec 18 12:51:19 2015 +0100
+++ b/src/share/vm/opto/loopTransform.cpp	Fri Dec 18 12:57:39 2015 +0100
@@ -1913,6 +1913,12 @@
       }
       return true;
     }
+    if (is_scaled_iv(exp->in(2), iv, p_scale)) {
+      if (p_offset != NULL) {
+        *p_offset = exp->in(1);
+      }
+      return true;
+    }
     if (exp->in(2)->is_Con()) {
       Node* offset2 = NULL;
       if (depth < 2 &&

Comments
ILW = disables optimizations, easy to reproduce, no workaround = MHH = P2
18-12-2015