RFR: 8250607: C2: Filter type in PhiNode::Value() for induction variables of trip-counted integer loops
Christian Hagedorn
chagedorn at openjdk.java.net
Mon Nov 9 08:56:54 UTC 2020
On Mon, 9 Nov 2020 08:26:17 GMT, Roland Westrelin <roland at openjdk.org> wrote:
> 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.
Thanks for the investigation of the micro benchmark regression! I also think that having the additional type information should justify the small regression and should not block this change. But would be interesting to hear what others think about that.
-------------
Marked as reviewed by chagedorn (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/1114
More information about the hotspot-compiler-dev
mailing list