Skip to content

8382054: TestLoopPeelingDisabled.java fails with -DVerifyIR=false#30713

Open
raneashay wants to merge 3 commits intoopenjdk:masterfrom
raneashay:JDK-8382054-loop-peeling-test-with-verifyir
Open

8382054: TestLoopPeelingDisabled.java fails with -DVerifyIR=false#30713
raneashay wants to merge 3 commits intoopenjdk:masterfrom
raneashay:JDK-8382054-loop-peeling-test-with-verifyir

Conversation

@raneashay
Copy link
Copy Markdown
Contributor

@raneashay raneashay commented Apr 13, 2026

TestLoopPeelingDisabled.java contains a test that expects an IR
violation exception when loop peeling is disabled. Specifically, the
test has an @IR annotation that checks for the presence of loop
peeling phases and we expect this IR check to fail when loop peeling is
disabled. But when IR checks are disabled using -DVerifyIR=false, the
framework skips checking the annotation, resulting in no IR violation
exception, causing the test to fail.

This patch adds a guard so that only when VerifyIR is set that we look
for the IR violation exception.

Credit to Tobias Hartmann for discovering and reporing the issue.



Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8382054: TestLoopPeelingDisabled.java fails with -DVerifyIR=false (Bug - P5)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30713/head:pull/30713
$ git checkout pull/30713

Update a local copy of the PR:
$ git checkout pull/30713
$ git pull https://git.openjdk.org/jdk.git pull/30713/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 30713

View PR using the GUI difftool:
$ git pr show -t 30713

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30713.diff

Using Webrev

Link to Webrev Comment

TestLoopPeelingDisabled.java contains a test that expects an IR
violation exception when loop peeling is disabled.  Specifically, the
test has an `@IR` annotation that checks for the presence of loop
peeling phases and we expect this IR check to fail when loop peeling is
disabled.  But when IR checks are disabled using `-DVerifyIR=false`, the
framework skips checking the annotation, resulting in no IR violation
exception, causing the test to fail.

This patch adds a guard so that only when `VerifyIR` is set that we look
for the IR violation exception.

Credit to Tobias Hartmann for discovering and reporing the issue.
@bridgekeeper
Copy link
Copy Markdown

bridgekeeper bot commented Apr 13, 2026

👋 Welcome back raneashay! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 13, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the hotspot-compiler hotspot-compiler-dev@openjdk.org label Apr 13, 2026
@openjdk
Copy link
Copy Markdown

openjdk bot commented Apr 13, 2026

@raneashay The following label will be automatically applied to this pull request:

  • hotspot-compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 13, 2026
@mlbridge
Copy link
Copy Markdown

mlbridge bot commented Apr 13, 2026

Webrevs

Copy link
Copy Markdown
Contributor

@dafedafe dafedafe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @raneashay. Just running some testing...

// Then, run the same test with loop peeling disabled, which should
// elide the {BEFORE,AFTER}_LOOP_PEELING compilation phases, causing the
// test to throw an IRViolationException. We then check whether the
// test to throw an IRViolationException. We then check whether the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// test to throw an IRViolationException. We then check whether the
// test to throw an IRViolationException. We then check whether the

Copy link
Copy Markdown
Member

@chhagedorn chhagedorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this, I have some comments.

// Then, run the same test with loop peeling disabled, which should
// elide the {BEFORE,AFTER}_LOOP_PEELING compilation phases, causing the
// test to throw an IRViolationException. We then check whether the
// test to throw an IRViolationException. We then check whether the
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// test to throw an IRViolationException. We then check whether the
// test to throw an IRViolationException. We then check whether the

Asserts.fail("Unexpected IR violation: " + info);
}
System.out.println("Loop peeling correctly disabled");
// phase was not found). If IR verification is disabled, this test will
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// phase was not found). If IR verification is disabled, this test will
// phase was not found). If IR verification is disabled, this test will

}
System.out.println("Loop peeling correctly disabled");
// phase was not found). If IR verification is disabled, this test will
// not throw IRViolationException.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// not throw IRViolationException.
// not throw an IRViolationException.

Comment on lines 56 to 68
if (Boolean.parseBoolean(System.getProperty("VerifyIR", "true"))) {
try {
TestFramework.runWithFlags("-XX:+UnlockDiagnosticVMOptions",
"-XX:LoopPeeling=0");
Asserts.fail("Expected IRViolationException");
} catch (IRViolationException e) {
String info = e.getExceptionInfo();
if (!info.contains("NO compilation output found for this phase")) {
Asserts.fail("Unexpected IR violation: " + info);
}
System.out.println("Loop peeling correctly disabled");
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only execute the test with LoopPeeling=0 if VerifyIR is true. But we should also execute it if VerifyIR is false. A better fix could be:

Suggested change
if (Boolean.parseBoolean(System.getProperty("VerifyIR", "true"))) {
try {
TestFramework.runWithFlags("-XX:+UnlockDiagnosticVMOptions",
"-XX:LoopPeeling=0");
Asserts.fail("Expected IRViolationException");
} catch (IRViolationException e) {
String info = e.getExceptionInfo();
if (!info.contains("NO compilation output found for this phase")) {
Asserts.fail("Unexpected IR violation: " + info);
}
System.out.println("Loop peeling correctly disabled");
}
}
try {
TestFramework.runWithFlags("-XX:+UnlockDiagnosticVMOptions",
"-XX:LoopPeeling=0");
Asserts.assertFalse(Boolean.parseBoolean(System.getProperty("VerifyIR", "true")),
"Expected IRViolationException when performing IR matching");
} catch (IRViolationException e) {
String info = e.getExceptionInfo();
if (!info.contains("NO compilation output found for this phase")) {
Asserts.fail("Unexpected IR violation: " + info);
}
System.out.println("Loop peeling correctly disabled");
}

The key change is that instead of not running the test at all when
verifyIR is false, we now run the test unconditionally and throw an
assertion only if verifyIR is false AND if we didn't catch
IRViolationException.
@raneashay
Copy link
Copy Markdown
Contributor Author

Thanks @dafedafe and @chhagedorn! I've updated the patch to include your suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-compiler hotspot-compiler-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants