Skip to content

Conversation

@dchopra001
Copy link
Contributor

@dchopra001 dchopra001 commented Nov 20, 2025

The z/codegen skips evaluation of a comparison operation if the first OR second child is a bu2i node and its grandchild is a bloadi. This condition needs to be modified from OR to AND (i.e so that both children of the comparison operation satisfy all conditions). This fixes a bug where the second comparison child has an
incompatible type with the bu2i node.

@dchopra001
Copy link
Contributor Author

This commit fixes eclipse-openj9/openj9#22835

@r30shah Can I get a review?

Copy link
Contributor

@r30shah r30shah left a comment

Choose a reason for hiding this comment

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

@dchopra001 This is the fix for the J9 issue Henry has pointed out. Please change the commit message accordingly to reflect that.

if (root->getOpCode().isBooleanCompare() || nonClobberingDestination) {
if (firstChild->getOpCodeValue() == TR::bu2i && firstChild->getReferenceCount() == 1
if ((firstChild->getOpCodeValue() == TR::bu2i && firstChild->getReferenceCount() == 1
&& firstChild->getRegister() == NULL
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel that indentation does not help with the the condition here. Can you apply the recommendation from the clang format error and see how it looks ?

@dchopra001 dchopra001 force-pushed the fixBu2iBug branch 2 times, most recently from c8629b4 to 5610daa Compare November 26, 2025 19:15
Copy link
Contributor

@joransiu joransiu left a comment

Choose a reason for hiding this comment

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

LGTM.

@r30shah
Copy link
Contributor

r30shah commented Dec 9, 2025

@dchopra001 I think it should be Fixes: https://github.com/eclipse-openj9/openj9/issues/22835 . I am not sure what you have would automatically closes the OpenJ9 issue.

Copy link
Contributor

@r30shah r30shah left a comment

Choose a reason for hiding this comment

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

@hzongaro Can I request your review / merge of this PR ?

The z/codegen skips evaluation of a comparison operation
if the first OR second child is a bu2i node and its
grandchild is a bloadi. This condition needs to be
modified from OR to AND (i.e so that both children of the
comparison operation satisfy all conditions). This fixes a
bug where the second comparison child has an
incompatible type with the bu2i node.

Fixes: eclipse-openj9/openj9#22835

Signed-off-by: Dhruv Chopra <[email protected]>
Copy link
Contributor

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

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

I think this change looks good. I will test it out in conjunction with draft pull request #8005.

@hzongaro
Copy link
Contributor

Sorry for the long delay. I've made a number of attempts to reproduce the failure that I had been seeing with CFG Simplifier enabled in order to verify that this change fixes the problem. I haven't managed to reproduce that failure again; however, I think your fix looks correct, so I will go ahead and approve this pull request.

Copy link
Contributor

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@hzongaro
Copy link
Contributor

Jenkins build zos,zlinux

@hzongaro
Copy link
Contributor

z/os testing timed out as nodes are off-line. zLinux testing was successful. The change is safe as it makes the optimization more conservative. Merging.

@hzongaro hzongaro merged commit a384e0b into eclipse-omr:master Jan 16, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants