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

Jasmine Karthikeyan jkarthikeyan at openjdk.org
Thu Apr 11 01:53:17 UTC 2024


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!

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

Commit messages:
 - Modify IR test

Changes: https://git.openjdk.org/jdk/pull/18734/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18734&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8329531
  Stats: 49 lines in 1 file changed: 29 ins; 0 del; 20 mod
  Patch: https://git.openjdk.org/jdk/pull/18734.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18734/head:pull/18734

PR: https://git.openjdk.org/jdk/pull/18734


More information about the hotspot-compiler-dev mailing list