JDK-8322572 : AllocationMergesTests.java fails with "IRViolationException: There were one or multiple IR rule failures."
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux,os_x,windows
  • CPU: x86_64,aarch64
  • Submitted: 2023-12-20
  • Updated: 2024-01-23
  • Resolved: 2024-01-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 masterFixed
Related Reports
Relates :  
Description
The following test failed in the JDK22 CI:

compiler/c2/irTests/scalarReplacement/AllocationMergesTests.java

Here's a snippet from the log file:

----------System.err:(49/6271)*----------

Command Line:
/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk-22+29-2283/macosx-aarch64-debug.jdk/jdk-22/fastdebug/bin/java -DReproduce=true -cp /System/Volumes/Data/mesos/work_dir/slaves/b8be9c31-0e0c-4781-900b-aa9694854b6a-S5114/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/14fd9bf0-f3f3-4b93-8575-4dbbfd6dab11/runs/dc6218c6-a1d9-414c-a58b-5f631d26577e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler_1/classes/2/compiler/c2/irTests/scalarReplacement/AllocationMergesTests.d:/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk-22+29-2283/src.full/open/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement:/System/Volumes/Data/mesos/work_dir/slaves/b8be9c31-0e0c-4781-900b-aa9694854b6a-S5114/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/14fd9bf0-f3f3-4b93-8575-4dbbfd6dab11/runs/dc6218c6-a1d9-414c-a58b-5f631d26577e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler_1/classes/2/test/lib:/System/Volumes/Data/mesos/work_dir/slaves/b8be9c31-0e0c-4781-900b-aa9694854b6a-S5114/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/14fd9bf0-f3f3-4b93-8575-4dbbfd6dab11/runs/dc6218c6-a1d9-414c-a58b-5f631d26577e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler_1/classes/2:/System/Volumes/Data/mesos/work_dir/jib-master/install/jtreg/7.3.1/1/bundles/jtreg-7.3.1+1.zip/jtreg/lib/jtreg.jar:/System/Volumes/Data/mesos/work_dir/jib-master/install/jtreg/7.3.1/1/bundles/jtreg-7.3.1+1.zip/jtreg/lib/junit-platform-console-standalone-1.9.2.jar:/System/Volumes/Data/mesos/work_dir/jib-master/install/jtreg/7.3.1/1/bundles/jtreg-7.3.1+1.zip/jtreg/lib/testng-7.3.0.jar:/System/Volumes/Data/mesos/work_dir/jib-master/install/jtreg/7.3.1/1/bundles/jtreg-7.3.1+1.zip/jtreg/lib/jcommander-1.82.jar:/System/Volumes/Data/mesos/work_dir/jib-master/install/jtreg/7.3.1/1/bundles/jtreg-7.3.1+1.zip/jtreg/lib/guice-5.1.0.jar -Djava.library.path=/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk-22+29-2283/macosx-aarch64-debug.test/hotspot/jtreg/native -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:MaxRAMPercentage=6.25 -Dtest.boot.jdk=/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk/21/35/bundles/macos-aarch64/jdk-21_macos-aarch64_bin.tar.gz/jdk-21.jdk/Contents/Home -Djava.io.tmpdir=/System/Volumes/Data/mesos/work_dir/slaves/b8be9c31-0e0c-4781-900b-aa9694854b6a-S5114/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/14fd9bf0-f3f3-4b93-8575-4dbbfd6dab11/runs/dc6218c6-a1d9-414c-a58b-5f631d26577e/testoutput/test-support/jtreg_open_test_hotspot_jtreg_tier1_compiler_1/tmp -Dir.framework.server.port=51995 -XX:+UnlockDiagnosticVMOptions -XX:+ReduceAllocationMerges -XX:+TraceReduceAllocationMerges -XX:+DeoptimizeALot -XX:CompileCommand=inline,*::charAt* -XX:CompileCommand=inline,*PicturePositions::* -XX:CompileCommand=inline,*Point::* -XX:CompileCommand=exclude,*::dummy* -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation -XX:CompilerDirectivesFile=test-vm-compile-commands-pid-31819.log -XX:CompilerDirectivesLimit=421 -XX:-OmitStackTraceInFastThrow -DShouldDoIRVerification=true -XX:-BackgroundCompilation -XX:CompileCommand=quiet compiler.lib.ir_framework.test.TestVM compiler.c2.irTests.scalarReplacement.AllocationMergesTests

One or more @IR rules failed:

Failed IR Rules (1) of Methods (1)
----------------------------------
1) Method "int compiler.c2.irTests.scalarReplacement.AllocationMergesTests.testLoadAfterLoopAlias_C2(boolean,int,int)" - [Failed IR rules: 1]:
   * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={}, counts={}, applyIfPlatform={}, applyIfPlatformOr={}, failOn={"_#ALLOC#_"}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
     > Phase "PrintOptoAssembly":
       - failOn: Graph contains forbidden nodes:
         * Constraint 1: "(.*precise .*\\R((.*(?i:mov|mv|xorl|nop|spill).*|\\s*)\\R)*.*(?i:call,static).*wrapper for: _new_instance_Java)"
           - Matched forbidden nodes (2):
             * 1fc +   mov  R1, precise compiler/c2/irTests/scalarReplacement/AllocationMergesTests$Point: 0x000000013aa249f8:Constant:exact *	# ptr
               	
               208     call,static 0x00000001176e44c0 	// ==>  wrapper for: _new_instance_Java
             * 228 +   mov  R1, precise compiler/c2/irTests/scalarReplacement/AllocationMergesTests$Point: 0x000000013aa249f8:Constant:exact *	# ptr
               	
               234     call,static 0x00000001176e44c0 	// ==>  wrapper for: _new_instance_Java

>>> Check stdout for compilation output of the failed methods


  #############################################################
   - To only run the failed tests use -DTest, -DExclude,
     and/or -DScenarios.
   - To also get the standard output of the test VM run with
     -DReportStdout=true or for even more fine-grained logging
     use -DVerbose=true.
  #############################################################


compiler.lib.ir_framework.driver.irmatching.IRViolationException: There were one or multiple IR rule failures. Please check stderr for more information.
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.reportFailures(IRMatcher.java:61)
	at compiler.lib.ir_framework.driver.irmatching.IRMatcher.match(IRMatcher.java:49)
	at compiler.lib.ir_framework.TestFramework.runTestVM(TestFramework.java:753)
	at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:718)
	at compiler.lib.ir_framework.TestFramework.start(TestFramework.java:338)
	at compiler.lib.ir_framework.TestFramework.runWithFlags(TestFramework.java:244)
	at compiler.c2.irTests.scalarReplacement.AllocationMergesTests.main(AllocationMergesTests.java:42)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
	at java.base/java.lang.Thread.run(Thread.java:1570)

JavaTest Message: Test threw exception: compiler.lib.ir_framework.driver.irmatching.IRViolationException
JavaTest Message: shutting down test

result: Failed. Execution failed: `main' threw exception: compiler.lib.ir_framework.driver.irmatching.IRViolationException: There were one or multiple IR rule failures. Please check stderr for more information.

This is a Tier1 test failure so I'm starting this off a P2.
Comments
Changeset: 76afa02d Author: Cesar Soares Lucas <cslucas@openjdk.org> Committer: Tobias Hartmann <thartmann@openjdk.org> Date: 2024-01-22 08:22:33 +0000 URL: https://git.openjdk.org/jdk/commit/76afa02dabb45a0648cc13de40657d15ded73b4a
22-01-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17469 Date: 2024-01-17 21:41:49 +0000
17-01-2024

[~thartmann] I'll start taking a look into this today.
16-01-2024

[~cslucas] any update on this? The test fails regularly in our CI. Thanks!
10-01-2024

I've had a closer look at the failing test method testLoadAfterLoopAlias_C2() which calls testLoadAfterLoopAlias(): int testLoadAfterLoopAlias(boolean cond, int x, int y) { Point a = new Point(x, y); Point b = new Point(y, x); Point c = a; for (int i=10; i<232; i++) { if (i == x) { c = b; } } return cond ? c.x : c.y; } x is passed in with a random value chosen with random.nextInt(). Almost always, profiling says that "if (i == x)" is never executed and C2 inserts a trap. The likelihood to draw a value between 10 and 232 out of the entire integer range is extremely low - but not zero. And this is exactly what happened in the CI here: We got a value between 10 and 232 and C2 no longer emitted a trap (I'm not sure how exactly the seed for the Random class is taken but it looks like that with this one particular build, we will always get a value in this range). This results in EA being unable to remove the allocations of this method. We have the following additional output of TraceReduceAllocationMerges: Can NOT reduce Phi 257 during invocation 0 because it's nullable. Now the question is if the test should only work with a trap or if it should also work if there is no trap. My guess is that it should only work with a trap, is that correct [~cslucas]? To reliably reproduce it with mainline, one can use the following seed which is the one chosen for the build where this failure was observed: -Djdk.test.lib.random.seed=3749837072262727509
21-12-2023

Given that this is only a test failure and extremely rare, I lower its priority. ILW = Single test failure, extremely rare, no workaround = MLH = P4
21-12-2023

Test is failing consistently in tiers 1 - 3 on all platforms, yet the build which first saw the failures contains only one changeset related to localization: JDK-8322041: JDK 22 RDP1 L10n resource files update ????
21-12-2023