Skip to content

Handle CheckCastPP and SubTypeCheck in allocation merge reduction#61

Draft
raneashay wants to merge 1 commit intomicrosoft:mainfrom
raneashay:ashay/checkcastpp-subtypecheck-phi
Draft

Handle CheckCastPP and SubTypeCheck in allocation merge reduction#61
raneashay wants to merge 1 commit intomicrosoft:mainfrom
raneashay:ashay/checkcastpp-subtypecheck-phi

Conversation

@raneashay
Copy link

Prior to this patch, the ReduceAllocationMerges optimization only
recognized CastPP, CmpP, and CmpN nodes as Phi users that could be
moved into the input branches of the Phi node, thus rejecting
CheckCastPP and SubTypeCheck nodes generated by the instanceof
keyword or using pattern matching. As a result, allocations couldn't be
merge through Phi nodes when the source Java prograpms contained
instanceof checks or pattern matching code.

This patch largely extends the logic for handling CastPP nodes to
CheckCastPP nodes and that for handling CmpP and CmpN nodes to
SubTypeCheck nodes. Effectively, this patch exposes more optimization
opportunities in escape analysis.

Prior to this patch, the ReduceAllocationMerges optimization only
recognized `CastPP`, `CmpP`, and `CmpN` nodes as Phi users that could be
moved into the input branches of the `Phi` node, thus rejecting
`CheckCastPP` and `SubTypeCheck` nodes generated by the `instanceof`
keyword or using pattern matching.  As a result, allocations couldn't be
merge through `Phi` nodes when the source Java prograpms contained
`instanceof` checks or pattern matching code.

This patch largely extends the logic for handling `CastPP` nodes to
`CheckCastPP` nodes and that for handling `CmpP` and `CmpN` nodes to
`SubTypeCheck` nodes.  Effectively, this patch exposes more optimization
opportunities in escape analysis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant