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

Ensure that we are correctly typing simd comparison nodes #105883

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

tannergooding
Copy link
Member

This fixes #105623

@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 Aug 2, 2024
@tannergooding
Copy link
Member Author

cc @dotnet/jit-contrib this is ready for review and resolves #105623

if (lookupType != retType)
{
assert(varTypeIsMask(lookupType));
tree->gtType = lookupType;
Copy link
Member

Choose a reason for hiding this comment

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

Why is it ok to retype tree to a mask type here if it didn't start out as a mask type? Won't the parent node be expecting a non-mask type?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because we're inserting and returning the CvtMaskToVector below if the final tree produced by morph ends up mismatching.

We don't insert it here because we still want to try and fold and finish morphing the new comparison node in case other optimizations are available.

There's many morph paths that return new nodes, so this should be no different.

Copy link
Member Author

@tannergooding tannergooding Aug 2, 2024

Choose a reason for hiding this comment

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

-- It's inserted here: https://github.com/dotnet/runtime/pull/105883/files/92b5f01f4d490f84949f1afc3c9eb02678394b57#diff-5b83397bbbdd17bb9457998b520fdaaa474d165390985b66f32371561b6d0bacR11610-R11616

We make this transform, we try to fold, we try to optimize, and then we insert the CvtMaskToVector in the case the expected and actual return types mismatch (with assert that they mismatch because the actual is mask and expected is simd).

@tannergooding tannergooding merged commit 9390b99 into dotnet:main Aug 2, 2024
114 checks passed
@tannergooding tannergooding deleted the fix-105623 branch August 2, 2024 23:59
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

JIT: Assertion failed '!varTypeIsMask(tree)' during 'Linear scan register alloc'
2 participants