RFR: 8281429: PhiNode::Value() is too conservative for tripcount of CountedLoop [v7]

Roland Westrelin roland at openjdk.java.net
Fri Apr 29 14:08:56 UTC 2022


On Mon, 25 Apr 2022 09:29:38 GMT, Roland Westrelin <roland at openjdk.org> wrote:

>> The type for the iv phi of a counted loop is computed from the types
>> of the phi on loop entry and the type of the limit from the exit
>> test. Because the exit test is applied to the iv after increment, the
>> type of the iv phi is at least one less than the limit (for a positive
>> stride, one more for a negative stride).
>> 
>> Also, for a stride whose absolute value is not 1 and constant init and
>> limit values, it's possible to compute accurately the iv phi type.
>> 
>> This change caused a few failures and I had to make a few adjustments
>> to loop opts code as well.
>
> Roland Westrelin has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 19 additional commits since the last revision:
> 
>  - undo unneeded change
>  - Merge branch 'master' into JDK-8281429
>  - redo change removed by error
>  - review
>  - Merge branch 'master' into JDK-8281429
>  - undo
>  - test fix
>  - more test
>  - test & fix
>  - other fix
>  - ... and 9 more: https://git.openjdk.java.net/jdk/compare/19794c52...19b38997

Hi Vladimir. Thanks for reviewing this.

> There should be correctness tests for MAX_INT,MIN_INT,MAX_LONG,MIN_LONG boundaries, positive and negative strides and `abs(stride) != 1`. All combinations.

That's reasonable but what kind of tests? Executing a simple counted loop that iterates from MIN_INT to MAX_INT is unlikely to lead to an incorrect result even if the iv type is wrong.

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

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


More information about the hotspot-compiler-dev mailing list