RFR: 8329531: compiler/c2/irTests/TestIfMinMax.java fails with IRViolationException: There were one or multiple IR rule failures.

Damon Fenacci dfenacci at openjdk.org
Mon Apr 22 07:31:37 UTC 2024


On Thu, 11 Apr 2024 01:38:28 GMT, Jasmine Karthikeyan <jkarthikeyan at openjdk.org> wrote:

> This patch fixes an issue with the `TestIfMinMax` IR test where specific random seeds cause the branch probability to be so low that the branch cannot CMove, causing the IR check to fail for min/max reductions. For example, if the first value returned by `Random#nextInt` was `int_min` then the branch will be only taken once, which works out to `1/512 => ~0.002`. This value is smaller than the CMove threshold `0.01`, so it cannot CMove.
> I've added sequential values from 1 to 50 and -1 to -50 before inserting random values in the array, so there will be a guaranteed 50 successes and 50 failures for each run. I've also replaced the multiplication by two with an opaque multiplication by one to prevent the randomly generated numbers from becoming larger, like what the test `MinMaxRed_Int` does.
> 
> Thoughts and reviews would be appreciated!

Marked as reviewed by dfenacci (Committer).

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

PR Review: https://git.openjdk.org/jdk/pull/18734#pullrequestreview-2013964089


More information about the hotspot-compiler-dev mailing list