RFR: 8250607: C2: Filter type in PhiNode::Value() for induction variables of trip-counted integer loops

Roland Westrelin roland at openjdk.java.net
Mon Nov 9 08:31:04 UTC 2020


PhiNode::Value() has special logic to compute the type of an iv phi
based on the counted loop's init value and limit. The type is
recomputed from scratch on every call to PhiNode::Value(). As the loop
is transformed, PhiNode::Value() may return a type for the iv phi that
widens. For instance, for:

for (int i = 0; i < 100; i++) {
}

PhiNode::value() returns accurate bounds for the iv phi. But if the
loop is transformed to pre/main/post loops, the init and limit no
longer have types that no longer allow an accurate computation of the
iv phi bounds.

The fix is to filter with the recorded _type for the Phi on every call
of PhiNode::Value().

This change was considered before (by Christian) but was not proposed
for integration because of a performance regression on a micro
benchmark. I investigated the performance regression and added my
findings to the bug report. While I'm not 100% sure I found the root
cause of the regression, the differences I see in the ideal graph of
the hottest methods of the micro benchmark with the change are fairly
small and I don't think that regression should block this fix.

-------------

Commit messages:
 - fix

Changes: https://git.openjdk.java.net/jdk/pull/1114/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1114&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8250607
  Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1114.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1114/head:pull/1114

PR: https://git.openjdk.java.net/jdk/pull/1114


More information about the hotspot-compiler-dev mailing list