Skip to content

Ensure that we are correctly typing simd comparison nodes#105883

Merged
tannergooding merged 1 commit intodotnet:mainfrom
tannergooding:fix-105623
Aug 2, 2024
Merged

Ensure that we are correctly typing simd comparison nodes#105883
tannergooding merged 1 commit intodotnet:mainfrom
tannergooding:fix-105623

Conversation

@tannergooding
Copy link
Member

This fixes #105623

@ghost ghost 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
@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