RFR: 8350896: Integer/Long.compress gets wrong type from CompressBitsNode::Value [v4]

Emanuel Peter epeter at openjdk.org
Mon Apr 21 10:31:52 UTC 2025


On Mon, 21 Apr 2025 06:40:42 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> Hi All,
>> 
>> This bugfix patch fixes incorrect value computation for Integer/Long. compress APIs.
>> 
>> Problems occur with a constant input and variable mask where the input's value is equal to the lower bound of the mask value., In this case, an erroneous value range estimation results in a constant value. Existing value routine first attempts to constant fold the compression operation if both input and compression mask are constant values; otherwise, it attempts to constrain the value range of result based on the upper and lower bounds of mask type.
>> 
>> New IR test covers the issue reported in the bug report along with a case for value range based logic pruning.
>> 
>> Kindly review and share your feedback.
>> 
>> Best Regards,
>> Jatin
>
> Jatin Bhateja 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 four additional commits since the last revision:
> 
>  - Merge branch 'master' of http://github.com/openjdk/jdk into JDK-8350896
>  - Review comments resolutions
>  - Review comments resolutions
>  - 8350896: Integer/Long.compress gets wrong type from CompressBitsNode::Value

test/hotspot/jtreg/compiler/c2/TestBitCompressValueTransform.java line 29:

> 27:  * @library /test/lib /
> 28:  * @summary C2: wrong result: Integer/Long.compress gets wrong type from CompressBitsNode::Value.
> 29:  * @run main/othervm compiler.c2.TestBitCompressValueTransform

Now that you have no flags any more, I think we can use the `driver`.
Suggestion:

 * @run driver compiler.c2.TestBitCompressValueTransform

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23947#discussion_r2052236081


More information about the hotspot-compiler-dev mailing list