8387369: Extend ReduceAllocationMerges to CheckCastPP and SubTypeCheck nodes#31699
Conversation
This patch strengthens the escape analysis in ReduceAllocationMerges to now recognize merges whose users are either `CheckCastPP` and `SubTypeCheck` nodes, which in turn enables optimizations over conditional statements that merge values from two or more allocations (see the JBS issue for code snippet). The key idea is to hoist the `CheckCastPP` and `SubTypeCheck` nodes before the Phi node, thus isolating the allocation. Prior to this patch, neither `CheckCastPP` nodes nor `SubTypeCheck` nodes were recognized as reducible, so merge nodes were left in place and allocation nodes could not be replaced with scalars. With this patch, each allocation node is isolated and non-escaping, so ordinary scalar replacment is able to remove the node.
|
👋 Welcome back arane! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@raneashay 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. |
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
CheckCastPP and SubTypeCheck nodes|
Here are the numbers from the included JMH microbenchmark on an x64 machine, reordered for easier legibility: |
This patch strengthens the escape analysis in ReduceAllocationMerges to
now recognize merges whose users are either
CheckCastPPandSubTypeChecknodes, which in turn enables optimizations overconditional statements that merge values from two or more allocations
(see the JBS issue for code snippet). The key idea is to hoist the
CheckCastPPandSubTypeChecknodes before the Phi node, thusisolating the allocation.
Prior to this patch, neither
CheckCastPPnodes norSubTypeChecknodes were recognized as reducible, so merge nodes were left in place
and allocation nodes could not be replaced with scalars. With this
patch, each allocation node is isolated and non-escaping, so ordinary
scalar replacment is able to remove the node.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/31699/head:pull/31699$ git checkout pull/31699Update a local copy of the PR:
$ git checkout pull/31699$ git pull https://git.openjdk.org/jdk.git pull/31699/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 31699View PR using the GUI difftool:
$ git pr show -t 31699Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/31699.diff
Using Webrev
Link to Webrev Comment