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

Emanuel Peter epeter at openjdk.org
Wed Apr 17 14:03:01 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!

Looks reasonable, thanks for the fix!

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

Marked as reviewed by epeter (Reviewer).

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


More information about the hotspot-compiler-dev mailing list