Skip to content

Fix asserts that were always true due to a missed neg. #44095

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

Merged
merged 2 commits into from
Nov 3, 2020

Conversation

sandreenko
Copy link
Contributor

@sandreenko sandreenko commented Oct 31, 2020

It took me a while to understand how in #43397 (comment) we did not fail on assert("Unhandled containment for ternary hardware intrinsic with immediate operand");

cc @janvorli

@sandreenko sandreenko added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 31, 2020
@sandreenko
Copy link
Contributor Author

The assert is failing on NI_AVX2_ShiftLeftLogical128BitLane, cc @tannergooding @echesakovMSFT

@tannergooding
Copy link
Member

Will take a look, it's likely a simple fix.

@tannergooding
Copy link
Member

tannergooding commented Nov 2, 2020

@sandreenko, I just added the following at L5467, just above the default case for assert(!"Unhandled containment for binary hardware intrinsic with immediate operand");:

                        case NI_SSE2_ShiftLeftLogical128BitLane:
                        case NI_SSE2_ShiftRightLogical128BitLane:
                        case NI_AVX2_ShiftLeftLogical128BitLane:
                        case NI_AVX2_ShiftRightLogical128BitLane:
                        {
#if DEBUG
                            // These intrinsics should have been marked contained by the general-purpose handling earlier in the method.

                            GenTree* lastOp = HWIntrinsicInfo::lookupLastOp(node);
                            assert(lastOp != nullptr);

                            if (HWIntrinsicInfo::isImmOp(intrinsicId, lastOp) && lastOp->IsCnsIntOrI())
                            {
                                assert(lastOp->isContained());
                            }
#endif

                            break;
                        }

Do you want me to push a new commit directly to the PR or would you like to just cherry-pick the change (or some variant) yourself?

@sandreenko
Copy link
Contributor Author

Do you want me to push a new commit directly to the PR or would you like to just cherry-pick the change (or some variant) yourself?

Please push your changes directly to this PR or you can open a new one and I will close this.

@sandreenko sandreenko merged commit 2eb63c2 into dotnet:master Nov 3, 2020
@sandreenko
Copy link
Contributor Author

Thanks @tannergooding for the fix.

@sandreenko sandreenko deleted the fixAlwaysTrueAsserts branch November 3, 2020 01:26
case NI_AVX2_ShiftRightLogical128BitLane:
{
#if DEBUG
// These intrinsics should have been marked contained by the general-purpose handling earlier in the method.
Copy link
Member

Choose a reason for hiding this comment

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

This is causing CI to fail in the formatting job. It failed on this PR as well.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like you fixed this in #44197, 👍

@ghost ghost locked as resolved and limited conversation to collaborators Dec 6, 2020
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.

4 participants