-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8344251: C2: remove blackholes with dead control input #24663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8344251: C2: remove blackholes with dead control input #24663
Conversation
👋 Welcome back mchevalier! A progress list of the required criteria for merging this PR into |
@marc-chevalier This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 46 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@shipilev, @vnkozlov, @TobiHartmann) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
@marc-chevalier The following label will be automatically applied to this pull request:
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. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I should have done the similar thing from the day 1 :)
public class DeadBhElimination { | ||
public static void main(String[] args) { | ||
TestFramework.runWithFlags( | ||
"-Xcomp", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-Xcomp
is likely too heavy-weight here. Other tests use -XX:CompileThreshold=100
. I think that is enough for IR tests to compile the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or you can di separate runs with different flags, including default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the -Xcomp
flag because the dead if
branch was compiled into an uncommon trap (reason = unstable_if), and I had no BlackholeNode
. Looking at the code emitting the trap, it seems to come from some profiling information, but that the generation of this uncommon trap is explicitly disabled if -Xcomp
is given. I am not entirely sure why, but -XX:CompileThreshold=100
does the job to make the compilation of the dead if
branch happen as well. But if I give no such flag, the test fails for lack of a BlackholeNode
after parsing (also meaning that the test doesn't exercise the deletion of the BlackholeNode
).
I'm currently testing further with -XX:CompileThreshold=100
as suggested (it works on my laptop so far), but if you have a more canonical trick to inhibit the uncommon trap in the dead branch, I'd take happily!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last time I had this problem, I did this:
// Use PerMethodTrapLimit=0 to compile all branches in the intrinsics. | |
args.add("-XX:PerMethodTrapLimit=0"); |
jdk/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java
Lines 303 to 307 in cec48ed
// CTW does not have good execution profile info, which would uncommon-trap | |
// a lot of branches/calls that are presumed to be never executed. | |
// Expand the optimization scope by disallowing most traps. | |
"-XX:PerMethodTrapLimit=0", | |
"-XX:PerMethodSpecTrapLimit=0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks exactly like what I'm trying to achieve. I'll re-test with that. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-Xcomp is likely too heavy-weight here.
FTR another alternative is to keep -Xcomp
, but limit compilation to test methods (-XX:CompileCommand=compileonly,<Test::test>
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C2 fix code is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work extracting a standalone reproducer for this and narrowing it down! The fix looks good to me.
/integrate Thanks @shipilev, @vnkozlov and @TobiHartmann for reviews! |
@marc-chevalier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still good.
/sponsor |
@vnkozlov The PR has been updated since the change author (@marc-chevalier) issued the |
/integrate |
@marc-chevalier |
/sponsor |
Going to push as commit 1138a18.
Your commit was automatically rebased without conflicts. |
@TobiHartmann @marc-chevalier Pushed as commit 1138a18. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
When a BlackholeNode's control input becomes dead, the node is not removed causing the crash
In the case reported in the issue, after a round of peeling, a condition becomes constant, and the branch containing the blackhole becomes dead:
I simply use
Node::remove_dead_region(PhaseGVN*, bool)
to remove the blackhole, as many other node types do.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24663/head:pull/24663
$ git checkout pull/24663
Update a local copy of the PR:
$ git checkout pull/24663
$ git pull https://git.openjdk.org/jdk.git pull/24663/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24663
View PR using the GUI difftool:
$ git pr show -t 24663
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24663.diff
Using Webrev
Link to Webrev Comment