Skip to content

Conversation

@EgorBo
Copy link
Member

@EgorBo EgorBo commented Jan 13, 2026

A couple of diffs from copying this optimization from global morph to VN

// Remove double negation/not.
if (op1->OperIs(oper))
{
JITDUMP("Remove double negation/not\n")
GenTree* op1op1 = op1->gtGetOp1();
DEBUG_DESTROY_NODE(tree);
DEBUG_DESTROY_NODE(op1);
return op1op1;
}

Copilot AI review requested due to automatic review settings January 13, 2026 23:16
@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 Jan 13, 2026
Copy link
Contributor

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 pull request adds a double negation/not removal optimization to the Value Numbering (VN) phase of the JIT compiler. The optimization removes redundant consecutive NOT or NEG operations (e.g., NOT(NOT(x)) → x, NEG(NEG(x)) → x), matching similar logic already implemented in the global morph phase.

Changes:

  • Added double negation removal optimization for VNF_NOT and VNF_NEG operations in VNForFunc

@AndyAyersMS
Copy link
Member

I had some similar VN things in #88527 including using De Morgan's laws to push NOT down in boolean VN "trees" ... feel free to poach or ignore.

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.

2 participants