Skip to content

Prevent reordering node above its check node - #7607

Merged
vijaysun-omr merged 1 commit into
eclipse-omr:masterfrom
ehsankianifar:PreventReorderingTreeAboveACheckNode
Jan 21, 2025
Merged

vijaysun-omr merged 1 commit into
eclipse-omr:masterfrom
ehsankianifar:PreventReorderingTreeAboveACheckNode

Conversation

@ehsankianifar

Copy link
Copy Markdown
Contributor

Reordering should not move a node above where its children are checked.
@hzongaro

@ehsankianifar
ehsankianifar marked this pull request as draft January 16, 2025 20:29
Comment thread compiler/optimizer/LocalReordering.cpp Resolved
@ehsankianifar
ehsankianifar force-pushed the PreventReorderingTreeAboveACheckNode branch 3 times, most recently from cb09e9c to 5c3ed5d Compare January 20, 2025 14:50
stopHere = true;
}
// Moving a node earlier than a check may have unforeseeable consequences as sophisticated optimizations like global vp can perform transformations based on value numbers.
if (!stopHere && currentNode->getOpCode().isCheck())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@hzongaro @vijaysun-omr it was blocking move above checkCast before. I changed it to block moving for all check nodes. Please let me know if it looks good to you. Thanks.

@ehsankianifar
ehsankianifar marked this pull request as ready for review January 20, 2025 17:06
@ehsankianifar
ehsankianifar marked this pull request as draft January 20, 2025 17:52
@ehsankianifar
ehsankianifar marked this pull request as ready for review January 20, 2025 19:27
@ehsankianifar

Copy link
Copy Markdown
Contributor Author

All sanity.functional tests passed on arm 64 linux, z linux, and x86-64 linux with java 11 and 21.
java 8 builds and functional tests passed on zos, z linux, and x86 linux.
manually tested and confirm that the wrong reordering is not happening with this fix.

storeTree->setNextTreeTop(nextTree);
nextTree->setPrevTreeTop(storeTree);
}
}

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.

Indentation is not right (before the change, but also after it).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This closing bracket does not belong to if (stopHere). there is a nested if inside it which this bracket belongs to.

@vijaysun-omr

vijaysun-omr commented Jan 20, 2025 •

Copy link
Copy Markdown
Contributor

Small typo in commit message : "casing" should be "causing"

@vijaysun-omr

Copy link
Copy Markdown
Contributor

Small typo in commit message : "abode" should be "above"

Local reordering was moving nodes above null checks and causing failure.
It is also possible that some optimizations do transformations based
on value number in check nodes and create bug if child node is
relocated above check node. To be safe, I prevent reordering before
any check node in this PR.

Fixes: eclipse-openj9/openj9#20267
Signed-off-by: Ehsan Kiani Far <ehsan.kianifar@gmail.com>
@ehsankianifar
ehsankianifar force-pushed the PreventReorderingTreeAboveACheckNode branch from 5c3ed5d to f37fa67 Compare January 21, 2025 14:07
@ehsankianifar

Copy link
Copy Markdown
Contributor Author

thanks @vijaysun-omr for your review. I changed the commit message. Also added link to the github issue that it fix but not sure if it was okay since the issue is on openj9 repo. Please let me know if it looks good to you.

@vijaysun-omr

Copy link
Copy Markdown
Contributor

I approved, but will wait for @hzongaro to review before I launch more testing.

@hzongaro hzongaro left a comment

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.

I think the change looks good. Thanks for tracking down the problem!

@vijaysun-omr

Copy link
Copy Markdown
Contributor

Jenkins build all

@vijaysun-omr

Copy link
Copy Markdown
Contributor

Checks have passed except zos. Reviews are also done. Merging.

@vijaysun-omr
vijaysun-omr merged commit 7772690 into eclipse-omr:master Jan 21, 2025
@ehsankianifar
ehsankianifar deleted the PreventReorderingTreeAboveACheckNode branch September 29, 2025 17:52
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.

3 participants