RFR: 8347365: C2: Fix the handling of depends_only_on_test [v2]
Quan Anh Mai
qamai at openjdk.org
Fri Jan 16 16:26:49 UTC 2026
On Fri, 16 Jan 2026 14:45:02 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:
>> Quan Anh Mai has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - more clarification
>> - Refine comments
>
> Thank you for working on this, @merykitty! As far as I can understand it, the fix looks good. I do have a question and a few nitpicks below.
>
> Is this change already tested well enough by the regression tests from JDK-8331717 and JDK-8257822? If so, please add `noreg-sqe`. Or are there possibly additional cases that could be covered?
@mhaessig Thanks for your reviews, I have addressed them.
For the regression tests from JDK-8331717 and JDK-8257822, they are run by themselves as well as with multiple stress flags. For the details, regarding JDK-8331717, previously, the zero divisor check of `2 / i4` is removed because it is dominated by an equivalent check of `1 / i4`, however, the division is incorrectly wired to the immediate dominator of the removed test, which is the range check `iArr[0]`. Now, the division will be correctly rewired from the zero divisor check of `2 / i4` to the zero divisor check of `1 / i4`. As a result, loop predication will not bring the division out of the loop without also pulling the zero divisor check out with it. For JDK-8257822, `split_if` will pin the division, so it cannot be hoisted incorrectly.
I tried to construct a test for this but did not succeed. Some ideas involve taking advantage of range check predication, or range check smearing, then having the resulting check be dominated by an equivalent check, leading to the `CastNode` floating above . But for the former, range check predication often means the the operation is loop-variant even if its control input is above the node, while the latter looks the dominating chain in the same way as when the `IfNode` is elided, so range check smearing would just use the dominating check anyway. Furthermore, the regression tests for the SIGFPE caused by division can be served as tests since they exercise that mechanism.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29158#issuecomment-3760824885
More information about the hotspot-compiler-dev
mailing list