RFR: 8250607: C2: Filter type in PhiNode::Value() for induction variables of trip-counted integer loops
Roland Westrelin
roland at openjdk.java.net
Thu Nov 12 14:18:56 UTC 2020
On Tue, 10 Nov 2020 13:15:34 GMT, Tobias Hartmann <thartmann 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.
>
> Looks good to me.
@TobiHartmann @chhagedorn thanks for the review
-------------
PR: https://git.openjdk.java.net/jdk/pull/1114
More information about the hotspot-compiler-dev
mailing list