Skip to content

Remove unwanted ternary node in lowering #115584

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 3 commits into from
May 15, 2025

Conversation

kunalspathak
Copy link
Member

Fixes: #115488

@Copilot Copilot AI review requested due to automatic review settings May 14, 2025 21:03
@kunalspathak kunalspathak changed the title Remove unwanted ternary node Remove unwanted ternary node in lowering May 14, 2025
@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 May 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses issue #115488 by removing an unwanted ternary node during the JIT lowering phase. Key changes include:

  • Adding a regression test project and source file to exercise the affected hardware intrinsic logic.
  • Modifying the lowering logic in lowerxarch.cpp to remove unnecessary nodes.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/tests/JIT/Regression/JitBlue/Runtime_115488.csproj New test project file to build the regression case
src/tests/JIT/Regression/JitBlue/Runtime_115488.cs New test case invoking Avx512F.TernaryLogic to reproduce the issue
src/coreclr/jit/lowerxarch.cpp Updated lowering logic: removed unused nodes to fix the ternary node issue
Comments suppressed due to low confidence (1)

src/coreclr/jit/lowerxarch.cpp:4130

  • Verify that removing 'node' and returning 'node->gtNext' maintains the intended control flow without unintended side effects in later phases.
BlockRange().Remove(node);

@@ -4052,6 +4052,7 @@ GenTree* Lowering::LowerHWIntrinsicTernaryLogic(GenTreeHWIntrinsic* node)
replacementNode = comp->gtNewAllBitsSetConNode(simdType);
}

Copy link
Preview

Copilot AI May 14, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider adding an inline comment explaining why 'op4' is removed to help future maintainers understand its necessity.

Suggested change
// Remove op4 as it is not used in this scenario and does not contribute to the result.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

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

@kunalspathak
Copy link
Member Author

superpmi-diff is timing out for tpdiff.

@kunalspathak kunalspathak merged commit 3b409f0 into dotnet:main May 15, 2025
110 of 114 checks passed
@kunalspathak kunalspathak deleted the issue_115488 branch May 15, 2025 04:43
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.

Assertion failed '!(checkUnusedValues && def->IsUnusedValue()) && "operands should never be marked as unused values"' during 'Lowering nodeinfo'
2 participants