Skip to content
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

Reapply "Fold "X relop 0" in assertprop" (#110129) #110142

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

EgorBo
Copy link
Member

@EgorBo EgorBo commented Nov 25, 2024

This reverts commit da9381e.

The bug was in optAssertionProp_RangeProperties, when we check First, analyze possible X ==/!= CNS assertions. assertions we need to make sure it's O1K_LCLVAR assertion, not e.g. O1K_ARR_BND

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 25, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Comment on lines +3960 to +3961
if (curAssertion->IsConstantInt32Assertion() && (curAssertion->op1.kind == O1K_LCLVAR) &&
(curAssertion->op1.vn == treeVN))
Copy link
Member

Choose a reason for hiding this comment

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

Why must the first operand be a LCLVAR to allow using these assertions?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jakobbotsch because O1K_ARR_BND is a weird assertion (when used with OAK_EQUAL/OAK_NOT_EQUAL). See here

e.g. when we have if (arr.Length == 0) we create an assertion op1 OAK_NOT_EQUAL 0 (inside true edge). To be fair, I think this one should be removed completely and be replaced with O1K_LCLVAR (not sure it works for trees not being GT_LCLVAR).

Copy link
Member

Choose a reason for hiding this comment

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

To be fair, I think this one should be removed completely

Yeah, it seems like it's just creating wrong assertions that the rest of assertion prop then needs to compensate for? Definitely looks odd that you have to dig into the operands and then the entire assertion changes meaning depending on what the first operand is.

@EgorBo
Copy link
Member Author

EgorBo commented Nov 25, 2024

/azp run runtime-coreclr libraries-pgo

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants