Skip to content

JIT: Fix assertion failed 'genActualType(cmp->gtGetOp1()) == genActualType(cmp->gtGetOp2())'#128959

Open
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:fix-ir-validation-in-fgOptimizeRelationalComparisonWithCasts
Open

JIT: Fix assertion failed 'genActualType(cmp->gtGetOp1()) == genActualType(cmp->gtGetOp2())'#128959
BoyBaykiller wants to merge 1 commit into
dotnet:mainfrom
BoyBaykiller:fix-ir-validation-in-fgOptimizeRelationalComparisonWithCasts

Conversation

@BoyBaykiller
Copy link
Copy Markdown
Contributor

Fix #128947

This assert is not a function specific assumption, rather a general IR validation - to my understanding.
The function uses the supportedOp lambda to actually cull out unsupported/uninteresting comparisons.
So it should be fine to change it.

The existing assert fired when seeing EQ(byref, long), for example:

*  NE        int   
+--*  LCL_VAR   byref  V01 arg1         
\--*  CAST      long <- ulong <- uint
   \--*  CNS_INT   int    0

Because it only considers genActualType(cmp->gtGetOp1()) == genActualType(cmp->gtGetOp2()) legal.

I don't really know what we consider legal IR and there is no centralized place so as a fix I copied this existing assert from importer:

assertImp((genActualType(op1) == genActualType(op2)) || (varTypeIsI(op1) && varTypeIsI(op2)) ||
(varTypeIsFloating(op1) && varTypeIsFloating(op2)));

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 3, 2026
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 3, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@BoyBaykiller
Copy link
Copy Markdown
Contributor Author

@EgorBo PTAL.

Copy link
Copy Markdown
Member

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

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

Thanks

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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ci-scan] Test failure: GitHub_19288 JIT assert genActualType mismatch in Morph under MinOpts stress

2 participants